OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Apr 21, 2024 8:52 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: SMBIOS/64-bit pointer woes
PostPosted: Sun Feb 25, 2024 9:29 am 
Offline
Member
Member
User avatar

Joined: Mon Sep 21, 2020 9:51 am
Posts: 100
Location: Aboard the Enterprise
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.

_________________
USS Enterprise NCC-1701,
The Final Frontier,
Space,
The Universe

Live Long And Prosper

Slava Ukraini!
Слава Україні!


Top
 Profile  
 
 Post subject: Re: SMBIOS/64-bit pointer woes
PostPosted: Sun Feb 25, 2024 12:15 pm 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1604
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.

_________________
Carpe diem!


Top
 Profile  
 
 Post subject: Re: SMBIOS/64-bit pointer woes
PostPosted: Sun Feb 25, 2024 4:21 pm 
Offline
Member
Member
User avatar

Joined: Mon Sep 21, 2020 9:51 am
Posts: 100
Location: Aboard the Enterprise
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.

_________________
USS Enterprise NCC-1701,
The Final Frontier,
Space,
The Universe

Live Long And Prosper

Slava Ukraini!
Слава Україні!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: maxtyson123 and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group