Files
lk/arch/m68k/start.S
Travis Geiselbrecht 49644a2c39 [platform][rosco-m68k] Add port to the Rosco M68k board
Port to the really neat 68010 based board at https://rosco-m68k.com/

Port Features:
-10Mhz 68010
-1MB ram
-Dual UART + timer implemented as a 68c681 chip
-timer running at 1Khz, UART A for console
-interrupt driven RX support

Some amount of extending of the 68k exceptinon code was needed to
support the autovectored irqs that the 68681 uart uses. Added build
system support for 68010.
2022-04-12 00:25:12 -07:00

66 lines
1.3 KiB
ArmAsm

/*
* Copyright (c) 2021 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#include <lk/asm.h>
.section .text.boot
FUNCTION(_start)
#if ARCH_DO_RELOCATION
lea %pc@(_start),%a0 // load the current address using PC relative addressing mode
movl #_start,%a1 // load the same symbol absolutely
cmpal %a0,%a1
beqs bss_clear
// load the end address for loop termination
movl #_end,%a2
// copy forwards
// NOTE: assumes the source and target do not overlap
0:
movel %a0@+,%a1@+
cmpal %a1,%a2
bne 0b
// branch to the new location
movl #bss_clear,%a0
jmp %a0@
#endif
// clear bss
bss_clear:
lea __bss_start,%a0
lea __bss_end,%a1
cmpl %a0,%a1
beqs 1f
// zero 4 bytes at a time
0:
clrl %a0@+
cmpal %a1,%a0
bne 0b
1:
// load the initial stack pointer
lea _default_stack_top,%sp
// branch into C land with 4 zeroed args
clrl %sp@-
clrl %sp@-
clrl %sp@-
clrl %sp@-
jsr lk_main
// if we return from main just loop forever
bra .
END_FUNCTION(_start)
.bss
.align 4
_default_stack_base:
.skip 4096
_default_stack_top: