[EDK DEV] I have this chicken, see, and this egg.

Subject: [EDK DEV] I have this chicken, see, and this egg.

From: Randy Thelen <rthelen@vmware.com>

To: dev@edk.tianocore.org

Date: 2008-07-03 20:14:00

Folks --

On the one hand, I want a simple SEC phase.  And, I've accomplished  
that.  I took the PeiMain code and linked its address into the ROM at  
the address where it will be when PEI runs out of ROM.  The issue  
here, in case you've missed my previous comments and questions on the  
subject, is that PeiMain (along with all of the PeiModules) use global  
variables for things like GUIDs and those addresses have to be  
resolved (i.e., linked) so that the code can properly function.

OK, that's great.  I solved this problem by pre-linking my PeiMain and  
various modules directly into my ROM.  I wrote Rebase.c and fixed bugs  
in PeCoffRelocate() and things are mostly happy.

On the other hand, I had assumed that PeiMain and various modules did  
NOT have any writable global variables.  Why is this important?  I'm  
glad you asked.  Because the code is linked into an address in ROM,  
there is no writable memory associated with the module.

However, DxeIpl contains a global variable.  And, it appears to be  
important: gPeiServices.

I could solve this by including into the SEC phase a link/loader to  
load and then link PeiMain.  Then, I could teach PeiMain to link/load  
each of the modules.  But that is at once a lot of work and apparently  
inconsistent with the current design.  Maybe I could just do the  
latter, i.e., have PeiMain link/load PEI Modules.  But, why am -I-  
bumping into this?  Am I the only one with this issue?

I therefore ask you, dear reader: What am I to do to resolve the issue  
of linking and loading PeiMain and modules in order to create a  
runtime environment for the PEI code?  The Nt32 code sample doesn't  
help resolve this dilemma.  In fact, it completely skirts it by using  
a link loader in the SEC phase.  Is that the only solution?

-- Randy

To unsubscribe, e-mail: dev-unsubscribe@edk.tianocore.org
For additional commands, e-mail: dev-help@edk.tianocore.org