# boot.S (RISC-V rv64) — the minimal asm entry. # QEMU 'virt' with -bios none enters here at 0x80000000 in M-mode, # all harts. We park every hart but hart 0, set a stack, clear .bss, # and jump to kmain(). This is the irreducible asm part for this arch. .section .text.boot .globl _start _start: # Only hart 0 continues; others wait forever (WFI loop). csrr t0, mhartid bnez t0, park # Set up the stack (defined in the linker script). la sp, _stack_top # Zero the .bss section: [__bss_start, __bss_end). la t0, __bss_start la t1, __bss_end 1: bgeu t0, t1, 2f sd zero, (t0) addi t0, t0, 8 j 1b 2: call kmain park: wfi j park