OSDev.org
https://forum.osdev.org/

SMBIOS/64-bit pointer woes
https://forum.osdev.org/viewtopic.php?f=1&t=57132
Page 1 of 1

Author:  PavelChekov [ Sun Feb 25, 2024 9:29 am ]
Post subject:  SMBIOS/64-bit pointer woes

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.

Author:  nullplan [ Sun Feb 25, 2024 12:15 pm ]
Post subject:  Re: SMBIOS/64-bit pointer woes

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,
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:
thus making the whole exercise moot, because my kernel wouldn't be able to access the physical address.
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.

Author:  PavelChekov [ Sun Feb 25, 2024 4:21 pm ]
Post subject:  Re: SMBIOS/64-bit pointer woes

nullplan wrote:
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,
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.

Thank you. I didn't think of PAE as an individual feature in that way.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/