# entry.S .option norvc .section .data .section .text.init .global _entry _entry: # Any hardware threads (hart) that are not bootstrapping # need to wait for an IPI csrr t0, mhartid bnez t0, 3f # SATP should be zero, but let's make sure csrw satp, zero .option push .option norelax la gp, _global_pointer .option pop li t5, 0xffff csrw medeleg, t5 csrw mideleg, t5 la sp, _stack_end li t0, (0b11 << 11) | (1 << 7) | (1 << 3) csrw mstatus, t0 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: j 4f 3: wfi j 3b 4: tail start