audk/MdePkg/Library/BaseLib
Laszlo Ersek 8596c14090 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>
2018-04-04 16:43:58 +02:00
..
AArch64 MdePkg/Library/BaseLib/AArch64: Comment style harmonization 2018-03-20 10:03:05 +08:00
Arm MdePkg/Library/BaseLib: Enable VS2017/ARM builds 2018-02-07 09:49:21 +08:00
Ebc MdePkg/BaseLib: add attribute 'RETURNS_TWICE' to SetJump 2018-01-10 11:42:17 +08:00
Ia32 MdePkg/BaseLib: add attribute 'RETURNS_TWICE' to SetJump 2018-01-10 11:42:17 +08:00
Ipf Current IPF version SwitchStack implementation uses loadrs instruction to restore dirty partition of register stack from the backing store, but there is no guarantee to make the backing store valid before. So add flushrs before loadrs to make sure backing store valid. 2012-04-11 01:56:48 +00:00
X64 MdePkg/BaseLib: Add stack switch related definitions for IA32 2017-12-08 14:38:48 +08:00
ARShiftU64.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
BaseLib.inf MdePkg/BaseLib: add PatchInstructionX86() 2018-04-04 16:43:58 +02:00
BaseLib.uni MdePkg: Convert all .uni files to utf-8 2015-12-15 04:53:50 +00:00
BaseLibInternals.h MdePkg/BaseLib: Add IsNodeInList() function. 2017-08-16 16:55:30 +08:00
BitField.c Correctly character in comments of BaseLib BitField. 2013-07-22 06:41:52 +00:00
CheckSum.c MdePkg BaseLib: Add new API CalculateCrc32() 2017-10-10 18:10:15 +08:00
ChkStkGcc.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
Cpu.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
CpuDeadLoop.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
DivS64x64Remainder.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
DivU64x32.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
DivU64x32Remainder.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
DivU64x64Remainder.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
FilePaths.c MdePkg/BaseLib: Avoid reading content beyond string boundary 2017-09-21 14:06:28 +08:00
GetPowerOfTwo32.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
GetPowerOfTwo64.c Fixed K9 scan issues. 2010-08-09 06:28:01 +00:00
HighBitSet32.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
HighBitSet64.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
LRotU32.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
LRotU64.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
LShiftU64.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
LinkedList.c MdePkg/BaseLib: Update internal LinkedList verifications. 2017-08-16 16:55:32 +08:00
LongJump.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
LowBitSet32.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
LowBitSet64.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
Math64.c MdePkg/BaseLib: do not rely on undefined behavior in arithmetic shift 2015-12-31 10:47:22 +00:00
ModU64x32.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
MultS64x64.c Fixed K9 scan issues. 2010-08-09 06:28:01 +00:00
MultU64x32.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
MultU64x64.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
RRotU32.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
RRotU64.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
RShiftU64.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
SafeString.c MdePkg/SafeString: Fix potential out-of-bound memory access 2018-02-06 17:31:08 +08:00
SetJump.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
String.c MdePkg: Refine casting expression result to bigger size 2017-03-06 14:18:45 +08:00
SwapBytes16.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
SwapBytes32.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
SwapBytes64.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
SwitchStack.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
Unaligned.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
X86DisablePaging32.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
X86DisablePaging64.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
X86EnablePaging32.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
X86EnablePaging64.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
X86FxRestore.c Fix memory out of band access in AsmFxSave() and AsmFxRestore(). 2012-10-30 08:35:08 +00:00
X86FxSave.c Fix memory out of band access in AsmFxSave() and AsmFxRestore(). 2012-10-30 08:35:08 +00:00
X86GetInterruptState.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
X86MemoryFence.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-24 00:20:35 +00:00
X86Msr.c Add ASSERT() for BitField operations to make sure the input value is valid. 2012-12-25 02:25:50 +00:00
X86PatchInstruction.c MdePkg/BaseLib: add PatchInstructionX86() 2018-04-04 16:43:58 +02:00
X86RdRand.c MdePkg/BaseLib: Add one wrapper on RdRand access for parameter check. 2016-11-16 16:49:10 +08:00
X86ReadGdtr.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-25 21:56:02 +00:00
X86ReadIdtr.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-25 21:56:02 +00:00
X86Thunk.c Update the modifier of ThunkContext parameter for AsmPrepareThunk16() in BaseLib from OUT to IN OUT. 2012-02-27 07:46:04 +00:00
X86WriteGdtr.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-25 21:56:02 +00:00
X86WriteIdtr.c Minor grammatical work--mostly adding periods. Items with ONLY period added did not have the heading date changed, but Items with content changes had heading copyright dates updated. Sending separately a list of files missing Doxygen @param and @return information. (PENDING) 2010-06-25 21:56:02 +00:00