Index: head/sys/riscv/riscv/locore.S =================================================================== --- head/sys/riscv/riscv/locore.S +++ head/sys/riscv/riscv/locore.S @@ -186,8 +186,10 @@ /* Initialize stack pointer */ la s3, initstack_end mv sp, s3 - addi sp, sp, -PCB_SIZE + /* Allocate space for thread0 PCB and riscv_bootparams */ + addi sp, sp, -(PCB_SIZE + 40) & ~STACKALIGNBYTES + /* Clear BSS */ la s0, _C_LABEL(__bss_start) la s1, _C_LABEL(_end) @@ -203,8 +205,6 @@ #endif /* Fill riscv_bootparams */ - addi sp, sp, -40 - la t0, pagetable_l1 sd t0, 0(sp) /* kern_l1pt */ sd s9, 8(sp) /* kern_phys */