While debugging an issue on NT32, I ran into an issue where PEIMs executing
after permanent memory is installed continue to access temporary memory. After
some debugging, the root cause is the
MdePkg/Library/PeiServicesTablePointerLib, which simply tries to store the PEI
SERVICES table pointer in a global variable. But this global variable is not
shared by all PEIMs. So when the PEI Core updates the PEI Services table
pointer, after permanent memory is installed, the other drivers are not
updated. Instead they still point to the old PEI Services table pointer.
As evidence of this, in NT32's SecMain.c, there is the following code commented
out (which is supposed to simulate the invalidated Temp RAM). If enabled, the
code will hang at the first attempt to call a PEI Service. In most cases, this
is one of the DEBUG() macro calls that end up calling the ReportStatusCode
dispatch, which tries to get the HOB list.
//
// Simulate to invalid temporary memory, terminate temporary memory
//
//ZeroMem ((VOID*)(UINTN)TemporaryMemoryBase, CopySize);
Obviously PeiServicestablePointerLib is designed to work when there is really
RAM available (as with NT32 or a system with RAM from the start). But, because
it does not use a true global storage location, it violates one of the key
design constraints for PEI: it must be global for everyone. That is why the IDT
was chosen on x86.
My initial thought was to try to signal on Permanent Memory Installed to update
the PEI Services pointer, since the NOTIFY function is passed the PEI Services
table pointer from the PEI Core. Thoughts?
Thanks,
Tim
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel