Excelent! While testing pmap_bootstrap locally the kernel never reached c_boot_entry: _start faults in its .bss clear (QEMU -d int shows fault_store at _start+0x2c, tval = higher-half address of _edata).
Cause: the Debian cross toolchain defaults to PIC/PIE, so 'la' in boothdr.S assembles to GOT loads (R_RISCV_GOT_HI20) and the GOT holds VMAs, which do not exist in Bare mode. I would fix this by building with -fno-pie -fno-PIE -fno-pic, as i386 and x86_64 already do (also in AM_CCASFLAGS; that is how boothdr.o got the GOT relocations). Does that look right to you? If so I will send the patch. Best, Diego El jue, 1 oct 2026 a la(s) 4:07 p.m., Hakan Candar ([email protected]) escribió: > Hi Diego, > > On Monday, 28 September 2026 at 01:39, Diego Meretta <[email protected]> > wrote: > > > Rework of the previously sent patch, with the review comments > > addressed: ceiling division for the kernel superpage count, a 1GiB > > gigapage direct map over phys_mem_start + phys_mem_size with every PA > > mapped at DIRECT_MAP_VA_BASE + PA (phystokv contract) and RW > > permissions, a temporary identity map so execution survives enabling > > satp, and kernel_virtual_start placed after the kernel image mapping. > > > > Thanks for your patch! This revision looks good, and I applied it. > > > While testing this locally I found an issue that prevents the kernel > > from reaching this code at all with the current toolchain defaults. > > If this looks good, I will send the next patch about that finding. > > > > Could you kindly pull latest changes in the branch high-address-kernel > and confirm whether the issue still persists? I found a problem that > only occurs when the kernel is compiled with -O0 and subsequently fixed > it. If that fix is unrelated, I will be glad to hear the issue you are > running into and try reproducing it in my testing setup. > > I am currently able to build and reach the GNU Mach banner on QEMU after > pmap_bootstrap. > > > * riscv64/riscv64/pmap.c: Include <string.h> and <riscv64/proc_reg.h>. > > (pmap_bootstrap): Implement Sv39 bootstrap. > > * riscv64/riscv64/pmap.h (RISCV_L1_SPAN, RISCV_L2_SPAN, round_l1, > > trunc_l1, round_l2, trunc_l2, RISCV_PTE_LEAF_RWX, RISCV_PTE_LEAF_RW): > > New macros. > > > > [...] > > > > -- > > 2.43.0 > > Hakan >
