[haiku-bugs] Re: [Haiku] #16712: Failure to boot with wrong reporting too much RAM

  • From: "Haiku" <trac@xxxxxxxxxxxx>
  • To: undisclosed-recipients: ;
  • Date: Wed, 14 Dec 2022 08:17:47 -0000

#16712: Failure to boot with wrong reporting too much RAM
---------------------------------+-------------------------
  Reporter:  eu                  |      Owner:  nobody
      Type:  bug                 |     Status:  assigned
  Priority:  normal              |  Milestone:  Unscheduled
 Component:  System/Boot Loader  |    Version:  R1/beta2
Resolution:                      |   Keywords:
Blocked By:                      |   Blocking:  17586
  Platform:  x86-64              |
---------------------------------+-------------------------
Comment (by korli):

 I checked what would be mapped for such a processor, for instance, https
 ://linux-hardware.org/?probe=64299c7b4a&log=dmesg
 {{{
 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009ffff] usable
 [    0.000000] BIOS-e820: [mem 0x00000000000a0000-0x00000000000fffff]
 reserved
 [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000009e01fff]
 usable
 [    0.000000] BIOS-e820: [mem 0x0000000009e02000-0x0000000009ffffff]
 reserved
 [    0.000000] BIOS-e820: [mem 0x000000000a000000-0x000000000a1fffff]
 usable
 [    0.000000] BIOS-e820: [mem 0x000000000a200000-0x000000000a20ffff] ACPI
 NVS
 [    0.000000] BIOS-e820: [mem 0x000000000a210000-0x000000000affffff]
 usable
 [    0.000000] BIOS-e820: [mem 0x000000000b000000-0x000000000b020fff]
 reserved
 [    0.000000] BIOS-e820: [mem 0x000000000b021000-0x00000000a05bafff]
 usable
 [    0.000000] BIOS-e820: [mem 0x00000000a05bb000-0x00000000a65bafff]
 reserved
 [    0.000000] BIOS-e820: [mem 0x00000000a65bb000-0x00000000a666afff] ACPI
 data
 [    0.000000] BIOS-e820: [mem 0x00000000a666b000-0x00000000a866afff] ACPI
 NVS
 [    0.000000] BIOS-e820: [mem 0x00000000a866b000-0x00000000a9ffdfff]
 reserved
 [    0.000000] BIOS-e820: [mem 0x00000000a9ffe000-0x00000000a9ffefff]
 usable
 [    0.000000] BIOS-e820: [mem 0x00000000a9fff000-0x00000000a9ffffff]
 reserved
 [    0.000000] BIOS-e820: [mem 0x00000000aa000000-0x00000000abffcfff]
 usable
 [    0.000000] BIOS-e820: [mem 0x00000000abffd000-0x00000000acffffff]
 reserved
 [    0.000000] BIOS-e820: [mem 0x00000000ad7f5000-0x00000000afffffff]
 reserved
 [    0.000000] BIOS-e820: [mem 0x00000000f0000000-0x00000000f7ffffff]
 reserved
 [    0.000000] BIOS-e820: [mem 0x00000000fd000000-0x00000000ffffffff]
 reserved
 [    0.000000] BIOS-e820: [mem 0x0000000100000000-0x0000000747ffffff]
 usable
 [    0.000000] BIOS-e820: [mem 0x0000000748000000-0x0000000847ffffff]
 reserved
 [    0.000000] BIOS-e820: [mem 0x000000084eec0000-0x00000008701fffff]
 reserved
 [    0.000000] BIOS-e820: [mem 0x000000fd00000000-0x000000ffffffffff]
 reserved
 }}}

 This means, the top reserved ranges should be ignored. At https://cgit
 .haiku-
 os.org/haiku/tree/src/system/boot/platform/efi/arch/x86_64/arch_mmu.cpp#n226

 {{{
         for (size_t i = 0; i < memory_map_size / descriptor_size; ++i) {
                 efi_memory_descriptor *entry
                         = (efi_memory_descriptor *)((addr_t)memory_map + i
 * descriptor_size);
                 switch (entry->Type) {
                 case EfiLoaderCode:
                 case EfiLoaderData:
                 case EfiBootServicesCode:
                 case EfiBootServicesData:
                 case EfiConventionalMemory:
                 case EfiRuntimeServicesCode:
                 case EfiRuntimeServicesData:
                 case EfiPersistentMemory:
                 case EfiACPIReclaimMemory:
                 case EfiACPIMemoryNVS:
                         maxAddress = std::max(maxAddress,
                                 entry->PhysicalStart +
 entry->NumberOfPages * 4096);
                         break;
                 }
                 default:
                         break;
         }
 }}}

 I'll submit a patch, or you can try yourself.
-- 
Ticket URL: <https://dev.haiku-os.org/ticket/16712#comment:54>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: