MdePkg/BaseLib: add PatchInstructionX86()
Some edk2 modules generate X86 machine code at module execution time by: - compiling "template" code with NASM at module build time, - linking the object code into the module, - and patching the immediate (constant) operands of some instructions when the module is executed. Add a helper function to BaseLib so that the C code performing the patching is easier to read and maintain. The implementation in this patch is taken mainly from Mike Kinney's mailing list messages at <http://mid.mail-archive.com/E92EE9817A31E24EB0585FDF735412F5B895C360@ORSMSX113.amr.corp.intel.com>, <http://mid.mail-archive.com/E92EE9817A31E24EB0585FDF735412F5B898BF66@ORSMSX112.amr.corp.intel.com>. Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=866 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@@ -431,6 +431,7 @@
|
||||
X86DisablePaging64.c
|
||||
X86DisablePaging32.c
|
||||
X86RdRand.c
|
||||
X86PatchInstruction.c
|
||||
|
||||
[Sources.X64]
|
||||
X64/Thunk16.nasm
|
||||
@@ -757,6 +758,7 @@
|
||||
X86DisablePaging64.c
|
||||
X86DisablePaging32.c
|
||||
X86RdRand.c
|
||||
X86PatchInstruction.c
|
||||
X64/GccInline.c | GCC
|
||||
X64/Thunk16.S | XCODE
|
||||
X64/SwitchStack.nasm| GCC
|
||||
|
Reference in New Issue
Block a user