mirror of
https://github.com/acidanthera/audk.git
synced 2025-09-24 02:07:44 +02:00
MdePkg/BasePeCoffLib2: Fix ARM Thumb apply relocation routine
Thumb instructions are either 16-bit or 32-bit, and are aligned on a two-byte boundary Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
This commit is contained in:
parent
a07a2ce546
commit
60e0471175
@ -195,7 +195,7 @@ ThumbMovwMovtImmediatePatch (
|
|||||||
STATIC
|
STATIC
|
||||||
VOID
|
VOID
|
||||||
ThumbMovwMovtImmediateFixup (
|
ThumbMovwMovtImmediateFixup (
|
||||||
IN OUT VOID *Fixup,
|
IN OUT VOID *Instructions,
|
||||||
IN UINT64 Adjust
|
IN UINT64 Adjust
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -203,8 +203,8 @@ ThumbMovwMovtImmediateFixup (
|
|||||||
//
|
//
|
||||||
// Relocate the instruction pair.
|
// Relocate the instruction pair.
|
||||||
//
|
//
|
||||||
Fixup32 = ThumbMovwMovtImmediateAddress (Fixup) + (UINT32) Adjust;
|
Fixup32 = ThumbMovwMovtImmediateAddress (Instructions) + (UINT32) Adjust;
|
||||||
ThumbMovwMovtImmediatePatch (Fixup, Fixup32);
|
ThumbMovwMovtImmediatePatch (Instructions, Fixup32);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -379,9 +379,9 @@ InternalApplyRelocation (
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Verify the Base Relocation target is sufficiently aligned.
|
// Verify the Base Relocation target is sufficiently aligned.
|
||||||
// The ARM THunb instruction pait must start on a 32-bit boundary.
|
// The ARM Thumb instruction pair must start on a 16-bit boundary.
|
||||||
//
|
//
|
||||||
if (!IS_ALIGNED (RelocTargetRva, ALIGNOF (UINT32))) {
|
if (!IS_ALIGNED (RelocTargetRva, ALIGNOF (UINT16))) {
|
||||||
DEBUG_RAISE ();
|
DEBUG_RAISE ();
|
||||||
return RETURN_VOLUME_CORRUPTED;
|
return RETURN_VOLUME_CORRUPTED;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user