Find EFI_RUNTIME_SERVICES from Windows kernel mode driver

I’m trying to find the EFI_RUNTIME_SERVICES structure from inside the Windows OS using a kernel mode driver. The structure is guaranteed to be allocated somewhere in physical memory below 4GB and has a distinctive byte signature at its start address. My plan was to scan the entire physical memory below 4GB, but I’m not sure how to do this safely and efficiently. Using MmMapIoSpace works theoretically, but this API is not designed for such usage and it’s very slow on top of that.

How can I safely and efficiently search for the EFI_RUNTIME_SERVICES structure in physical memory from a Windows kernel mode driver?

I might add that I’m not a professional developer yet (student), so there might be obvious things that I don’t know about yet.

Can’t do it. The OS has the pointer, and it’s not exported to drivers… and I can’t think of any legitimate reason a driver would need it.

So, let me ask: What larger problem are you trying to solve.

Peter

You can’t just troll through physical memory. A big chunk of the physical space below 4GB is assigned to PCI devices, and you don’t know what effect reading from them might have. Plus, when you map pages, you have to use the same caching scheme in use by any other mapping of the pages, which you don’t know.