I'm currently collecting the SMBIOS data in my bootloader (getting the table pointer from the entry point), but finding that relies on using physical addresses, yet the pointer to the table is a 64-bit address. I can't access that outside of long mode, but I need to enable paging to get to long mode, thus making the whole exercise moot, because my kernel wouldn't be able to access the physical address. Is there a commonly accepted solution to this problem? What can I do short of making a copy of the table in a location that will be mapped and passing the address of that?
Thanks.
SMBIOS/64-bit pointer woes
- PavelChekov
- Member
- Posts: 113
- Joined: Mon Sep 21, 2020 9:51 am
- Location: Aboard the Enterprise
SMBIOS/64-bit pointer woes
USS Enterprise NCC-1701,
The Final Frontier,
Space,
The Universe
Live Long And Prosper
Slava Ukraini!
Слава Україні!
The Final Frontier,
Space,
The Universe
Live Long And Prosper
Slava Ukraini!
Слава Україні!
Re: SMBIOS/64-bit pointer woes
You're wrong, you can use PAE paging in 32-bit mode and access as much of the 64-bit physical address space as in long mode (namely the architecturally defined 52 bits). Of course I'd recommend 64-bit mode over 32-bit mode, but that doesn't mean you can't use it still.PavelChekov wrote:but finding that relies on using physical addresses, yet the pointer to the table is a 64-bit address. I can't access that outside of long mode,
Surely your kernel has some way to map arbitrary physical addresses, right? It must have, since many device drivers require this. When you write any driver for a PCI device, it will read the IO base address out of some BAR, and then need to access that memory block as MMIO. You can't use a normal RAM mapping for this, because you need to map the memory as uncached. My solution for this is to have a function ioremap() that takes a physical address and a memory type and returns a virtual address. On x86_64, this basically adds or modifies the mapping in the linear range to have the requested memory type.PavelChekov wrote:thus making the whole exercise moot, because my kernel wouldn't be able to access the physical address.
Carpe diem!
- PavelChekov
- Member
- Posts: 113
- Joined: Mon Sep 21, 2020 9:51 am
- Location: Aboard the Enterprise
Re: SMBIOS/64-bit pointer woes
Thank you. I didn't think of PAE as an individual feature in that way.nullplan wrote:You're wrong, you can use PAE paging in 32-bit mode and access as much of the 64-bit physical address space as in long mode (namely the architecturally defined 52 bits). Of course I'd recommend 64-bit mode over 32-bit mode, but that doesn't mean you can't use it still.PavelChekov wrote:but finding that relies on using physical addresses, yet the pointer to the table is a 64-bit address. I can't access that outside of long mode,
USS Enterprise NCC-1701,
The Final Frontier,
Space,
The Universe
Live Long And Prosper
Slava Ukraini!
Слава Україні!
The Final Frontier,
Space,
The Universe
Live Long And Prosper
Slava Ukraini!
Слава Україні!