mirror of
https://github.com/acidanthera/audk.git
synced 2025-09-25 10:47:47 +02:00
UeImageLib: Fix image debug address
This commit is contained in:
parent
d1d2a0ed1f
commit
948e8e854a
@ -598,7 +598,7 @@ ToolImageEmitUeDebugTable (
|
||||
)
|
||||
{
|
||||
UE_DEBUG_TABLE DebugTable;
|
||||
uint8_t SymOffsetFactor;
|
||||
uint8_t SymSubtrahendFactor;
|
||||
uint32_t DebugTableOffset;
|
||||
uint32_t DebugTableSize;
|
||||
uint16_t Index;
|
||||
@ -609,14 +609,14 @@ ToolImageEmitUeDebugTable (
|
||||
assert (Image->DebugInfo.SymbolsPathLen <= MAX_UINT8);
|
||||
assert (IS_ALIGNED (BaseAddressSubtrahend, Image->SegmentInfo.SegmentAlignment));
|
||||
|
||||
SymOffsetFactor = (uint8_t)(BaseAddressSubtrahend / Image->SegmentInfo.SegmentAlignment);
|
||||
if (SymOffsetFactor > 0x03) {
|
||||
SymSubtrahendFactor = (uint8_t)(BaseAddressSubtrahend / Image->SegmentInfo.SegmentAlignment);
|
||||
if (SymSubtrahendFactor > 0x03) {
|
||||
DEBUG_RAISE ();
|
||||
return false;
|
||||
}
|
||||
|
||||
DebugTable.ImageInfo = SymOffsetFactor;
|
||||
assert (UE_DEBUG_TABLE_IMAGE_INFO_SYM_OFFSET_FACTOR (DebugTable.ImageInfo) == SymOffsetFactor);
|
||||
DebugTable.ImageInfo = SymSubtrahendFactor;
|
||||
assert (UE_DEBUG_TABLE_IMAGE_INFO_SYM_SUBTRAHEND_FACTOR (DebugTable.ImageInfo) == SymSubtrahendFactor);
|
||||
assert ((DebugTable.ImageInfo & 0xFCU) == 0);
|
||||
|
||||
DebugTable.SymbolsPathLength = (uint8_t)Image->DebugInfo.SymbolsPathLen;
|
||||
|
@ -407,11 +407,11 @@ typedef struct {
|
||||
(OFFSET_OF (UE_DEBUG_TABLE, SymbolsPath) + 1U)
|
||||
|
||||
/**
|
||||
Retrieves the UE symbols address offset in SegmentAlignment-units.
|
||||
Retrieves the UE symbol address subtrahend in SegmentAlignment-units.
|
||||
|
||||
@param[in] ImageInfo The UE debug table image information.
|
||||
**/
|
||||
#define UE_DEBUG_TABLE_IMAGE_INFO_SYM_OFFSET_FACTOR(ImageInfo) \
|
||||
#define UE_DEBUG_TABLE_IMAGE_INFO_SYM_SUBTRAHEND_FACTOR(ImageInfo) \
|
||||
((UINT8)((ImageInfo) & 0x03U))
|
||||
|
||||
/**
|
||||
|
@ -1231,21 +1231,21 @@ UeLoaderGetImageDebugAddress (
|
||||
RETURN_STATUS Status;
|
||||
CONST UE_DEBUG_TABLE *DebugTable;
|
||||
UINT8 SymOffsetFactor;
|
||||
UINT32 SymOffsetAddend;
|
||||
UINT32 SymOffsetSubtrahend;
|
||||
|
||||
ASSERT (Context != NULL);
|
||||
|
||||
SymOffsetAddend = 0;
|
||||
SymOffsetSubtrahend = 0;
|
||||
|
||||
Status = InternalGetDebugTable (Context, &DebugTable);
|
||||
if (!RETURN_ERROR (Status)) {
|
||||
SymOffsetFactor = UE_DEBUG_TABLE_IMAGE_INFO_SYM_OFFSET_FACTOR (
|
||||
SymOffsetFactor = UE_DEBUG_TABLE_IMAGE_INFO_SYM_SUBTRAHEND_FACTOR (
|
||||
DebugTable->ImageInfo
|
||||
);
|
||||
SymOffsetAddend = (UINT32)SymOffsetFactor * Context->SegmentAlignment;
|
||||
SymOffsetSubtrahend = (UINT32)SymOffsetFactor * Context->SegmentAlignment;
|
||||
}
|
||||
|
||||
return UeLoaderGetImageAddress (Context) + SymOffsetAddend;
|
||||
return UeLoaderGetImageAddress (Context) - SymOffsetSubtrahend;
|
||||
}
|
||||
|
||||
RETURN_STATUS
|
||||
|
Loading…
x
Reference in New Issue
Block a user