Very little needed to port except to conditionalize some assembly in the context switch and exception code. Mostly needed to move build system stuff around and add a new project.
56 lines
1.0 KiB
ArmAsm
56 lines
1.0 KiB
ArmAsm
/*
|
|
* Copyright (c) 2015 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)
|
|
.option push
|
|
.option norelax
|
|
# set the global pointer
|
|
la gp, __global_pointer$
|
|
.option pop
|
|
|
|
# set the default stack
|
|
la sp, default_stack_top
|
|
|
|
#if ARCH_RISCV_TWOSEGMENT
|
|
# copy preinitialized data from flash to memory
|
|
la t0, __data_start_rom
|
|
la t1, __data_start
|
|
la t2, __data_end
|
|
beq t0, t1, 1f
|
|
|
|
0:
|
|
lw t3, (t0)
|
|
sw t3, (t1)
|
|
add t0, t0, 4
|
|
add t1, t1, 4
|
|
bne t1, t2, 0b
|
|
#endif
|
|
|
|
# zero bss
|
|
1:
|
|
la t0, __bss_start
|
|
la t1, __bss_end
|
|
0:
|
|
sw x0, (t0)
|
|
add t0, t0, 4
|
|
bne t0, t1, 0b
|
|
|
|
# call main
|
|
jal lk_main
|
|
|
|
# should never return here
|
|
j .
|
|
|
|
.bss
|
|
.align 4
|
|
LOCAL_DATA(default_stack)
|
|
.skip 1024
|
|
LOCAL_DATA(default_stack_top)
|