Re: Porting NetBSD to the Nintendo 3DS

Paul Walker <[email protected]>
Newsgroups gmane.os.netbsd.ports.arm
Message-ID <[email protected]>
On 11/28/24 14:05, Paul Walker wrote:
> I'm going to start by writing firmware to load a NetBSD kernel.

I got the kernel loaded. Now I just need to resolve an issue with 
uvm_km_bootstrap panicking with "could not reserve space for kernel".

Does anyone know what's causing this?

The following is the boot log:
[   1.0000000] arm32_bootmem_init: memstart=0x20000000, memsize=0x8000000
[   1.0000000] arm32_bootmem_init: kernelstart=0x20008000, 
kernelend=0x20283000
[   1.0000000] arm32_bootmem_init: kernel phys start 0x20008000 end 
0x20283000
[   1.0000000] arm32_bootmem_init: adding 32125 free pages: 
[0x20283000..0x27ffffff] (VA 0x20283000)
[   1.0000000] arm32_bootmem_init: adding 8 free pages: 
[0x20000000..0x20007fff] (VA 0x20000000)
[   1.0000000] arm32_kernel_vm_init: 1 L2 pages are needed to map 
0x2ab000 kernel bytes
[   1.0000000] arm32_kernel_vm_init: allocating page tables for 
vectoradd_pages: adding pv 0x20273ed4 (pa 0x20283000, va 0x20283000, 1 
pages) at tail
[   1.0000000]  kernel l1ptadd_pages: appending pv 0x2027562c 
(0x20284000..0x20287fff) to 0x20283000..0x20283fff
[   1.0000000] add_pages: appending pv 0x20273fd0 
(0x20288000..0x20288fff) to 0x20283000..0x20287fff
[   1.0000000]  vmadd_pages: appending pv 0x20273fe4 
(0x20289000..0x20289fff) to 0x20283000..0x20288fff
[   1.0000000] add_pages: appending pv 0x20273ff8 
(0x2028a000..0x2028afff) to 0x20283000..0x20289fff
[   1.0000000] add_pages: appending pv 0x2027400c 
(0x2028b000..0x2028bfff) to 0x20283000..0x2028afff
[   1.0000000] add_pages: appending pv 0x20274020 
(0x2028c000..0x2028cfff) to 0x20283000..0x2028bfff
[   1.0000000] add_pages: appending pv 0x20274034 
(0x2028d000..0x2028dfff) to 0x20283000..0x2028cfff
[   1.0000000] add_pages: appending pv 0x20274048 
(0x2028e000..0x2028efff) to 0x20283000..0x2028dfff
[   1.0000000] add_pages: appending pv 0x2027405c 
(0x2028f000..0x2028ffff) to 0x20283000..0x2028efff
[   1.0000000] add_pages: appending pv 0x20274070 
(0x20290000..0x20290fff) to 0x20283000..0x2028ffff
[   1.0000000] arm32_kernel_vm_init: allocating stacks
[   1.0000000] add_pages: appending pv 0x20274e44 
(0x20291000..0x20291fff) to 0x20283000..0x20290fff
[   1.0000000] add_pages: appending pv 0x20274e30 
(0x20292000..0x20292fff) to 0x20283000..0x20291fff
[   1.0000000] add_pages: appending pv 0x20274e1c 
(0x20293000..0x20293fff) to 0x20283000..0x20292fff
[   1.0000000] add_pages: appending pv 0x20274e08 
(0x20294000..0x20294fff) to 0x20283000..0x20293fff
[   1.0000000] add_pages: appending pv 0x20274df4 
(0x20295000..0x20296fff) to 0x20283000..0x20294fff
[   1.0000000] add_pages: appending pv 0x20274e58 
(0x20297000..0x20298fff) to 0x20283000..0x20296fff
[   1.0000000] add_pages: appending pv 0x20273b50 
(0x20299000..0x2029cfff) to 0x20283000..0x20298fff
[   1.0000000]  vectorCreating L1 page table at 0x20284000/0x20284000
[   1.0000000] arm32_kernel_vm_init: adding L2 pt (VA 0x20283000, PA 
0x20283000) for VA 0xffff0000 (vectors)
[   1.0000000] arm32_kernel_vm_init: kernel_base 20000000 
KERNEL_L2PT_KERNEL_NUM 1
[   1.0000000] arm32_kernel_vm_init: adding L2 pt (VA 0x20288000, PA 
0x20288000) for VA 0x20000000 (kernel)
[   1.0000000] arm32_kernel_vm_init: kernel_vm_base 20008000 
KERNEL_L2PT_VMDATA_NUM 8
[   1.0000000] arm32_kernel_vm_init: adding L2 pt (VA 0x20289000, PA 
0x20289000) for VA 0x20008000 (vm)
[   1.0000000] arm32_kernel_vm_init: adding L2 pt (VA 0x2028a000, PA 
0x2028a000) for VA 0x20408000 (vm)
[   1.0000000] arm32_kernel_vm_init: adding L2 pt (VA 0x2028b000, PA 
0x2028b000) for VA 0x20808000 (vm)
[   1.0000000] arm32_kernel_vm_init: adding L2 pt (VA 0x2028c000, PA 
0x2028c000) for VA 0x20c08000 (vm)
[   1.0000000] arm32_kernel_vm_init: adding L2 pt (VA 0x2028d000, PA 
0x2028d000) for VA 0x21008000 (vm)
[   1.0000000] arm32_kernel_vm_init: adding L2 pt (VA 0x2028e000, PA 
0x2028e000) for VA 0x21408000 (vm)
[   1.0000000] arm32_kernel_vm_init: adding L2 pt (VA 0x2028f000, PA 
0x2028f000) for VA 0x21808000 (vm)
[   1.0000000] arm32_kernel_vm_init: adding L2 pt (VA 0x20290000, PA 
0x20290000) for VA 0x21c08000 (vm)
[   1.0000000] Mapping kernel
[   1.0000000] arm32_kernel_vm_init: adding chunk for kernel text 
0x20008000..0x2018efff (VA 0x20008000)
[   1.0000000] add_pages: adding pv 0x20273ec0 (pa 0x20008000, va 
0x20008000, 391 pages) before pa 0x20283000
[   1.0000000] arm32_kernel_vm_init: adding chunk for kernel data/bss 
0x2018f000..0x20282fff (VA 0x2018f000)
[   1.0000000] add_pages: adding pv 0x20273eac (pa 0x2018f000, va 
0x2018f000, 244 pages) before pa 0x20283000
[   1.0000000] Listing Chunks
[   1.0000000] arm32_kernel_vm_init: pv 0x20273ec0: chunk VA 
0x20008000..0x2018efff (PA 0x20008000, prot 5, cache 1)
[   1.0000000] arm32_kernel_vm_init: pv 0x20273eac: chunk VA 
0x2018f000..0x20282fff (PA 0x2018f000, prot 3, cache 1)
[   1.0000000] arm32_kernel_vm_init: pv 0x20273ed4: chunk VA 
0x20283000..0x2029cfff (PA 0x20283000, prot 3, cache 1)

[   1.0000000] Mapping Chunks
[   1.0000000] arm32_kernel_vm_init: mapping chunk VA 
0x20008000..0x2018efff (PA 0x20008000, prot 5, cache 1)
[   1.0000000] PPPPPPPPLLLLLLLLLLLLLLLLLLLLLLLPPPPPPPPPPPPPPP
[   1.0000000] arm32_kernel_vm_init: mapping chunk VA 
0x2018f000..0x20282fff (PA 0x2018f000, prot 3, cache 1)
[   1.0000000] PLLLLLLLLLLLLLLLPPP
[   1.0000000] arm32_kernel_vm_init: mapping last chunk VA 
0x20283000..0x2029cfff (PA 0x20283000, prot 3, cache 1)
[   1.0000000] PPPPPPPPPPPPPPPPPPPPPPPPPP
[   1.0000000] S
[   1.0000000] SSSSSS
[   1.0000000] 
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
[   1.0000000] S
[   1.0000000]                              Physical 
Virtual        Num
[   1.0000000]                        Starting    Ending    Starting 
Ending   Pages
[   1.0000000]         text section: 0x20008000 0x2018efff 0x20008000 
0x2018efff 391
[   1.0000000]         data section: 0x201d0000 0x20272f08 0x201d0000 
0x20272f08 163
[   1.0000000]          bss section: 0x20272f08 0x20282d68 0x20272f08 
0x20282d68 17
[   1.0000000]    L1 page directory: 0x20284000 0x20287fff 0x20284000 
0x20287fff 4
[   1.0000000]    ABT stack (CPU 0): 0x20291000 0x20291fff 0x20291000 
0x20291fff 1
[   1.0000000]    FIQ stack (CPU 0): 0x20292000 0x20292fff 0x20292000 
0x20292fff 1
[   1.0000000]    IRQ stack (CPU 0): 0x20293000 0x20293fff 0x20293000 
0x20293fff 1
[   1.0000000]    UND stack (CPU 0): 0x20294000 0x20294fff 0x20294000 
0x20294fff 1
[   1.0000000]   IDLE stack (CPU 0): 0x20295000 0x20296fff 0x20295000 
0x20296fff 2
[   1.0000000]            SVC stack: 0x20297000 0x20298fff 0x20297000 
0x20298fff 2
[   1.0000000]       Message Buffer: 0x20299000 0x2029cfff 0x20299000 
0x2029cfff 4
[   1.0000000]    Exception Vectors: 0x2029d000 0x2029dfff 0xffff0000 
0xffff0fff 1
[   1.0000000]          Free Memory: 0x2029e000 0x27ffffff 
         32098
[   1.0000000]          Free Memory: 0x20000000 0x20007fff 
         8
[   1.0000000] TTBR0=0x2028c000 TTBR1=0x1fff4002 TTBCR=0 CONTEXTIDR=0
[   1.0000000] switching to new L1 page table @0x20284000...
[   1.0000000]  ttb (TTBR0=0x20284000) OK
[   1.0000000] nfreeblocks = 2, free_pages = 32106 (0x7d6a)
[   1.0000000] bootstrap done.
[   1.0000000] vectors 0xffff0000
[   1.0000000] init subsystems: stacks vectors undefined vfp page 
pmap_physload
[   1.0000000] block  0 start 2029e000  end 28000000... loading in 
freelist 0
[   1.0000000] block  1 start 20000000  end 20008000... loading in 
freelist 0
[   1.0000000] pmap kpm locks l1pt cache(l1pt) specials pools [ Kernel 
symbol table missing! ]
[   1.0000000] done.
[   1.0000000] panic: uvm_km_bootstrap: could not reserve space for kernel
[   1.0000000] cpu0: Begin traceback...
[   1.0000000] 0x20298e74: 20035ed4
[   1.0000000] 0x20298e94: 200f0c5c
[   1.0000000] 0x20298eac: 200f0d2c
[   1.0000000] 0x20298f2c: 20081d50
[   1.0000000] 0x20298f4c: 20081874
[   1.0000000] 0x20298f9c: 2016e96c
[   1.0000000] 0x20298fac: 20008670
[   1.0000000] cpu0: End traceback...
[   1.0000000] Fatal kernel mode prefetch abort at 0x00000000
[   1.0000000] trapframe: 0x20298c88, spsr=600001d3
[   1.0000000] r0 =ffffffff, r1 =ffffffff, r2 =00000001, r3 =201d0088
[   1.0000000] r4 =00000000, r5 =201d02a8, r6 =20274bc4, r7 =20298cf8
[   1.0000000] r8 =201d0400, r9 =20274bd8, r10=20298ee0, r11=20298cf4
[   1.0000000] r12=20298cf8, ssp=20298cd8, slr=2000ddb4, pc =00000000
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.