GalSa
GalSa

Reputation: 53

Passing information from UEFI to the OS

I am familiar with BIOS int 15 - E820 function, where you could choose a fixed physical location, put there whatever you wanted, the OS would not overwrite it, and you could just access that fixed memory address (may map it to a virtual pointer first etc).

But in the UEFI case, as much as I am aware, there is no memory area reserved for the user, so I couldn't rely on allocating a buffer at a specific memory address (if that's even possible?), therefore I have to use a UEFI memory memory function - which returns a pointer that is not fixed.

So my questions are -

  1. Is it possible to allocate a buffer that will not be overwritten once the OS goes up?

  2. How is it possible to pass the OS the pointer of the allocated buffer, so I could access it from the OS (again, since allocation, hopefully given that the buffer itself is not overwritten, is not in a fixed location).

Thank you!

Upvotes: 3

Views: 1057

Answers (1)

unixsmurf
unixsmurf

Reputation: 6234

  1. Yes. Allocate memory memory of a non-reclaimable type, such as EfiRuntimeServicesData.
  2. The mechanism UEFI uses is called configuration tables.

Note: EfiPersistentMemory is something completely different.

Configuration tables are installed by calling InstallConfigurationTable during boot services, with the two parameters being a GUID and a pointer to the physical address of the data structure you want to pass. This pair is then linked into an array pointed to by the UEFI System Table.

How you extract that information in Windows, I do not know. In Linux, the UEFI system table is globally accessible in kernel space (efi->systab), so the pointer can be extracted from there.

Upvotes: 3

Related Questions