# entry.s .option norvc .section .data .section .text.init .global _entry _entry: # Set global pointer (gp) # Important to have relaxation off for this instruction .option push .option norelax la gp, _global_pointer .option pop # Set thread pointer (tp) to hart id csrr tp, mhartid # Set stack pointer (sp) for all harts la sp, _stack_end li t0, 0x10000 # Give each hart plenty of space for their stacks mul t0, t0, tp sub sp, sp, t0 # Jump to start if not hart 0 bnez tp, 2f # Prepare BSS section if hart 0 la t0, _bss_start la t1, _bss_end bgeu t0, t1, 2f 1: sb zero, 0(t0) addi t0, t0, 1 bne t0, t1, 1b 2: # Tail call Rust start function tail start