Andreas Färber wrote:
While I'm not against reversing the direction, your above statement worries me. Our claim code should only claim free memory. So either the respective boot loader doesn't actually claim the memory it's using (the recent ppc bug that broke Haiku), or there's a bug in ofmem that you're hiding by this change. Both directions should in theory work, I believe.
Okay - having played with this a bit further, it seems that it's the physical memory allocations that need to be reversed in order to prevent my Solaris 8 kernel from crashing mid-boot. Below is the log from my OFMEM-enabled SPARC32 OpenBIOS booting Solaris 8 with physical memory allocated from the bottom upwards:
OFMEM: ofmem_map_page_range ffe27000 -> d00000000 00001000 mode 0000003c Configuration device id QEMU version 1 machine id 32 OFMEM: ofmem_map_page_range ffe26000 -> 010000000 00001000 mode 0000003c OFMEM: ofmem_map_page_range ffe25000 -> 071100000 00001000 mode 0000003c OFMEM: ofmem_map_page_range ffe24000 -> 071000000 00001000 mode 0000003c OFMEM: ofmem_map_page_range ffe22000 -> 071200000 00002000 mode 0000003c OFMEM: ofmem_map_page_range ffe21000 -> 071400000 00001000 mode 0000003c OFMEM: ofmem_map_page_range ffe20000 -> 071910000 00001000 mode 0000003c OFMEM: ofmem_map_page_range ffe1f000 -> 071f00000 00001000 mode 0000003c OFMEM: ofmem_map_page_range ffe0e000 -> 071d00000 00011000 mode 0000003c OFMEM: ofmem_map_page_range ffdfd000 -> 071e00000 00011000 mode 0000003c OFMEM: ofmem_map_page_range ffdfc000 -> 007fff000 00001000 mode 0000003c OFMEM: ofmem_map_page_range ffdfb000 -> 010001000 00001000 mode 0000003c OFMEM: ofmem_map_page_range ffdfa000 -> 078400000 00001000 mode 0000003c OFMEM: ofmem_map_page_range ffdf9000 -> 078800000 00001000 mode 0000003c CPUs: 1 x FMI,MB86904 UUID: 00000000-0000-0000-0000-000000000000 Welcome to OpenBIOS v1.0 built on Dec 22 2010 01:15 Type 'help' for detailed information Trying cdrom:d... Not a bootable ELF image Loading a.out image... Loaded 7680 bytes entry point is 0x4000 bootpath: /iommu/sbus/espdma/esp/sd@2,0:d
Jumping to entry point 00004000 for type 00000005... switching to new context: OFMEM: ofmem_claim phys=ffffffffffffffff size=00040000 align=00000008 OFMEM: ofmem_claim phys returned 000000000 OFMEM: ofmem_claim_virt virt=f0040000 size=00040000 align=00000000 OFMEM: ofmem_map_page_range f0040000 -> 000000000 00040000 mode 000000bc OFMEM: ofmem_claim phys=ffffffffffffffff size=00019000 align=00000008 OFMEM: ofmem_claim phys returned 000040000 OFMEM: ofmem_claim_virt virt=f0240000 size=00019000 align=00000000 OFMEM: ofmem_map_page_range f0240000 -> 000040000 00019000 mode 000000bc OFMEM: ofmem_claim phys=ffffffffffffffff size=00007000 align=00000008 OFMEM: ofmem_claim phys returned 000059000 OFMEM: ofmem_claim_virt virt=f0080000 size=00007000 align=00000000 OFMEM: ofmem_map_page_range f0080000 -> 000059000 00007000 mode 000000bc OFMEM: ofmem_claim phys=ffffffffffffffff size=00001000 align=00000008 OFMEM: ofmem_claim phys returned 000060000 OFMEM: ofmem_claim_virt virt=f0087000 size=00001000 align=00000000 OFMEM: ofmem_map_page_range f0087000 -> 000060000 00001000 mode 000000bc OFMEM: ofmem_claim phys=ffffffffffffffff size=00001000 align=00000008 OFMEM: ofmem_claim phys returned 000061000 OFMEM: ofmem_claim_virt virt=f0088000 size=00001000 align=00000000 OFMEM: ofmem_map_page_range f0088000 -> 000061000 00001000 mode 000000bc OFMEM: ofmem_claim phys=ffffffffffffffff size=00003000 align=00000008 OFMEM: ofmem_claim phys returned 000062000 OFMEM: ofmem_claim_virt virt=f0089000 size=00003000 align=00000000 OFMEM: ofmem_map_page_range f0089000 -> 000062000 00003000 mode 000000bc OFMEM: ofmem_claim phys=ffffffffffffffff size=00003000 align=00000008 OFMEM: ofmem_claim phys returned 000065000 OFMEM: ofmem_claim_virt virt=f008c000 size=00003000 align=00000000 OFMEM: ofmem_map_page_range f008c000 -> 000065000 00003000 mode 000000bc OFMEM: ofmem_claim phys=ffffffffffffffff size=00001000 align=00000008 OFMEM: ofmem_claim phys returned 000068000 OFMEM: ofmem_claim_virt virt=f0259000 size=00001000 align=00000000 OFMEM: ofmem_map_page_range f0259000 -> 000068000 00001000 mode 000000bc OFMEM: ofmem_claim phys=ffffffffffffffff size=00001000 align=00000008 OFMEM: ofmem_claim phys returned 000069000 OFMEM: ofmem_claim_virt virt=f025a000 size=00001000 align=00000000 OFMEM: ofmem_map_page_range f025a000 -> 000069000 00001000 mode 000000bc OFMEM: ofmem_claim phys=ffffffffffffffff size=00001000 align=00000008 OFMEM: ofmem_claim phys returned 00006a000 OFMEM: ofmem_claim_virt virt=f025b000 size=00001000 align=00000000 OFMEM: ofmem_map_page_range f025b000 -> 00006a000 00001000 mode 000000bc OFMEM: ofmem_claim phys=ffffffffffffffff size=00001000 align=00000008 OFMEM: ofmem_claim phys returned 00006b000 OFMEM: ofmem_claim_virt virt=f025c000 size=00001000 align=00000000 OFMEM: ofmem_map_page_range f025c000 -> 00006b000 00001000 mode 000000bc OFMEM: ofmem_claim phys=ffffffffffffffff size=000c9000 align=00000008 OFMEM: ofmem_claim phys returned 00006c000 OFMEM: ofmem_claim_virt virt=f008f000 size=000c9000 align=00000000 OFMEM: ofmem_map_page_range f008f000 -> 00006c000 000c9000 mode 000000bc OFMEM: ofmem_claim phys=ffffffffffffffff size=00018000 align=00000008 OFMEM: ofmem_claim phys returned 000135000 OFMEM: ofmem_claim_virt virt=f025d000 size=00018000 align=00000000 OFMEM: ofmem_map_page_range f025d000 -> 000135000 00018000 mode 000000bc
(hangs at this point)
The Solaris boot loader appears to be claiming specific virtual addresses, but claiming the physical addresses from the pool. The last physical address allocated from the pool before the crash is 0x135000 which I think may be overwriting the kernel itself as I have something in the back of my mind that says the kernel is loaded at 0x100000 - Blue any ideas?
ATB,
Mark.