]> git.proxmox.com Git - mirror_edk2.git/commit - MdePkg/Include/Library/BaseLib.h
MdePkg/BaseLib: add PatchInstructionX86()
authorLaszlo Ersek <lersek@redhat.com>
Thu, 1 Feb 2018 21:00:40 +0000 (22:00 +0100)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 4 Apr 2018 14:43:58 +0000 (16:43 +0200)
commit8596c140907ebfeabf62427686280666a4e04893
treece6325ddc65b0a8187f738cf304abe315c19bb16
parentde4f7f52f2003b854a754e3815f0a0c1c611118f
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>
MdePkg/Include/Library/BaseLib.h
MdePkg/Library/BaseLib/BaseLib.inf
MdePkg/Library/BaseLib/X86PatchInstruction.c [new file with mode: 0644]