mirror of
https://github.com/acidanthera/audk.git
synced 2025-09-23 09:47:44 +02:00
MdePkg/PeCoffLib2: Expose ARM Thumb MOVW/MOVT relocation helpers
This commit is contained in:
parent
fff229d0cb
commit
a8f69bde96
@ -564,4 +564,28 @@ PeCoffLoaderGetImageAddress (
|
|||||||
IN CONST PE_COFF_LOADER_IMAGE_CONTEXT *Context
|
IN CONST PE_COFF_LOADER_IMAGE_CONTEXT *Context
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieve the immediate data encoded in an ARM MOVW/MOVT instruciton pair.
|
||||||
|
|
||||||
|
@param[in] Instructions Pointer to an ARM MOVW/MOVT insturction pair.
|
||||||
|
|
||||||
|
@returns The Immediate address encoded in the instructions.
|
||||||
|
**/
|
||||||
|
UINT32
|
||||||
|
PeCoffThumbMovwMovtImmediateAddress (
|
||||||
|
IN CONST VOID *Instructions
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Relocate an ARM MOVW/MOVT immediate instruction instruction pair.
|
||||||
|
|
||||||
|
@param[in,out] Instructions Pointer to ARM MOVW/MOVT instruction pair.
|
||||||
|
@param[in] Adjust The delta to add to the addresses.
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
PeCoffThumbMovwMovtImmediateFixup (
|
||||||
|
IN OUT VOID *Instructions,
|
||||||
|
IN UINT64 Adjust
|
||||||
|
);
|
||||||
|
|
||||||
#endif // PE_COFF_LIB2_H_
|
#endif // PE_COFF_LIB2_H_
|
||||||
|
@ -137,16 +137,8 @@ ThumbMovtImmediatePatch (
|
|||||||
(PatchedInstruction & ~(UINT16) 0x70FFU) | Patch;
|
(PatchedInstruction & ~(UINT16) 0x70FFU) | Patch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Retrieve the immediate data encoded in an ARM MOVW/MOVT instruciton pair.
|
|
||||||
|
|
||||||
@param[in] Instructions Pointer to an ARM MOVW/MOVT insturction pair.
|
|
||||||
|
|
||||||
@returns The Immediate address encoded in the instructions.
|
|
||||||
**/
|
|
||||||
STATIC
|
|
||||||
UINT32
|
UINT32
|
||||||
ThumbMovwMovtImmediateAddress (
|
PeCoffThumbMovwMovtImmediateAddress (
|
||||||
IN CONST VOID *Instructions
|
IN CONST VOID *Instructions
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -192,9 +184,8 @@ ThumbMovwMovtImmediatePatch (
|
|||||||
@param[in,out] Instructions Pointer to ARM MOVW/MOVT instruction pair.
|
@param[in,out] Instructions Pointer to ARM MOVW/MOVT instruction pair.
|
||||||
@param[in] Adjust The delta to add to the addresses.
|
@param[in] Adjust The delta to add to the addresses.
|
||||||
**/
|
**/
|
||||||
STATIC
|
|
||||||
VOID
|
VOID
|
||||||
ThumbMovwMovtImmediateFixup (
|
PeCoffThumbMovwMovtImmediateFixup (
|
||||||
IN OUT VOID *Instructions,
|
IN OUT VOID *Instructions,
|
||||||
IN UINT64 Adjust
|
IN UINT64 Adjust
|
||||||
)
|
)
|
||||||
@ -203,7 +194,7 @@ ThumbMovwMovtImmediateFixup (
|
|||||||
//
|
//
|
||||||
// Relocate the instruction pair.
|
// Relocate the instruction pair.
|
||||||
//
|
//
|
||||||
Fixup32 = ThumbMovwMovtImmediateAddress (Instructions) + (UINT32) Adjust;
|
Fixup32 = PeCoffThumbMovwMovtImmediateAddress (Instructions) + (UINT32) Adjust;
|
||||||
ThumbMovwMovtImmediatePatch (Instructions, Fixup32);
|
ThumbMovwMovtImmediatePatch (Instructions, Fixup32);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +387,7 @@ InternalApplyRelocation (
|
|||||||
//
|
//
|
||||||
// Relocate the target instruction.
|
// Relocate the target instruction.
|
||||||
//
|
//
|
||||||
ThumbMovwMovtImmediateFixup (Fixup, Adjust);
|
PeCoffThumbMovwMovtImmediateFixup (Fixup, Adjust);
|
||||||
//
|
//
|
||||||
// Record the relocated value for Image runtime relocation.
|
// Record the relocated value for Image runtime relocation.
|
||||||
//
|
//
|
||||||
@ -715,7 +706,7 @@ InternalApplyRelocationRuntime (
|
|||||||
return RETURN_VOLUME_CORRUPTED;
|
return RETURN_VOLUME_CORRUPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThumbMovwMovtImmediateFixup (Fixup, Adjust);
|
PeCoffThumbMovwMovtImmediateFixup (Fixup, Adjust);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user