>> The ImageBase is the same for PE/COFF and TE.
>> In the code ImageAddress points to the start of T or P (well P can have a 
>> DOS header
>> prepended etc). I think a lot of the code operates on ImageAddress and thus 
>> needs the
>> adjustment.

Well, I don't want to abuse your attention. Just last try to explain
the incosistency here I can not resolve.
Suppose we have some imaginable ISA instruction somewhere in code:
LOAD r1, [0x402f04bc]
and 0x402f04bc is the address of some symbol, resolved by linker.
let's parse this address. Let ImageBase be 0x402f0000, and data
section offset be 0x400 and finally data item offset in the section be
0xbc. Data section is also at 0x400 from the file beginning, since
sectionalignment==filealignment, which means the layout is the same.
When it is loaded at 0x402f000, everything works. Data section is at
0x400 from there, and our variable is at 0xbc from the section start.
Now, we make TE from it. Now, the data section in the TE file is NOT
at 0x400 from the file beginning (it is closer). And when (and if) TE
is loaded such that TE header is placed in memory at THE SAME
ImageBase address as the original PE would have been, the referenced
variable will not be at 402f04bc. And the code, referencing address
0x402f4bc, would get something else instead of this variable content.
This is not the case in the reality. But why? The PI specification
recipe, with only AddressOfEntryPoint adjustment and without
adjustment of anything else referenced (in the code) should result in
this incostistency.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to