Commit Graph

239 Commits

Author SHA1 Message Date
Liming Gao 13688930ae MdePkg: Remove X86 ASM and S files
NASM has replaced ASM and S files.
1. Remove ASM from all modules.
2. Remove S files from the drivers only.
3. https://bugzilla.tianocore.org/show_bug.cgi?id=881
After NASM is updated, S files can be removed from Library.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
2018-06-07 15:26:27 +08:00
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
Pete Batard da351bdbe2 MdePkg/Library/BaseLib: Enable VS2017/ARM64 builds
Required GCC assembly files are converted for the MSFT assembler

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-03-19 17:05:38 +08:00
Pete Batard 30939ff2bc MdePkg/Library/BaseLib: Enable VS2017/ARM builds
Most of the RVCT assembly can be reused as is for MSFT except
for CpuBreakpoint.asm, which we need to force to Arm mode.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-02-07 09:49:21 +08:00
Jian J Wang 364a54742f MdePkg/BaseLib: Add stack switch related definitions for IA32
The new definitions include two structures

  IA32_TASK_STATE_SEGMENT
  IA32_TSS_DESCRIPTOR

two macros

  IA32_GDT_TYPE_TSS
  IA32_GDT_ALIGNMENT

and one API

  VOID
  EFIAPI
  AsmWriteTr (
    IN UINT16 Selector
    );

They're needed to setup task gate and interrupt stack table for stack switch.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com>
Reviewed-by: Jiewen.yao@intel.com
2017-12-08 14:38:48 +08:00
Qin Long 9ec9a7a597 MdePkg/BaseLib: Add one wrapper on RdRand access for parameter check.
Add one wrapper implementation over assembly RdRand access to check
possible NULL parameter, for better alignment with comment description.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-11-16 16:49:10 +08:00
Liming Gao 6596018924 MdePkg BaseLib: Add the missing nasm source file InternalSwitchStack.nasm
BaseLib Ia32 InternalSwitchStack.S has no matched InternalSwitchStack.nasm.
Use ObjDump to verify the output object files be same.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2016-07-20 13:24:30 +08:00
Liming Gao 7e08bace8c MdePkg BaseLib: Convert Ia32/DisablePaging32.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
Ia32/DisablePaging32.asm to Ia32/DisablePaging32.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:51:52 +08:00
Jordan Justen f84fb93a4f MdePkg BaseLib: Convert X64/ReadMsr64.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadMsr64.asm to X64/ReadMsr64.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:20 +08:00
Jordan Justen 7027169941 MdePkg BaseLib: Convert X64/WriteMsr64.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteMsr64.asm to X64/WriteMsr64.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:19 +08:00
Jordan Justen a2e4c24d4e MdePkg BaseLib: Convert X64/CpuBreakpoint.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/CpuBreakpoint.asm to X64/CpuBreakpoint.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:18 +08:00
Jordan Justen 5401d5beff MdePkg BaseLib: Convert X64/ReadEflags.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadEflags.asm to X64/ReadEflags.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:17 +08:00
Jordan Justen 63a21006e6 MdePkg BaseLib: Convert X64/ReadCr0.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadCr0.asm to X64/ReadCr0.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:17 +08:00
Jordan Justen bcdc107c01 MdePkg BaseLib: Convert X64/ReadCr2.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadCr2.asm to X64/ReadCr2.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:16 +08:00
Jordan Justen f08409a770 MdePkg BaseLib: Convert X64/ReadCr3.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadCr3.asm to X64/ReadCr3.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:15 +08:00
Jordan Justen 656a75dafa MdePkg BaseLib: Convert X64/ReadCr4.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadCr4.asm to X64/ReadCr4.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:15 +08:00
Jordan Justen b2a2273391 MdePkg BaseLib: Convert X64/WriteCr0.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteCr0.asm to X64/WriteCr0.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:14 +08:00
Jordan Justen 94a5acc924 MdePkg BaseLib: Convert X64/WriteCr2.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteCr2.asm to X64/WriteCr2.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:14 +08:00
Jordan Justen 4dac999ffd MdePkg BaseLib: Convert X64/WriteCr3.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteCr3.asm to X64/WriteCr3.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:13 +08:00
Jordan Justen 9f91893f86 MdePkg BaseLib: Convert X64/WriteCr4.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteCr4.asm to X64/WriteCr4.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:12 +08:00
Jordan Justen cb509ade5a MdePkg BaseLib: Convert X64/ReadDr0.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadDr0.asm to X64/ReadDr0.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:11 +08:00
Jordan Justen 3fca763fd4 MdePkg BaseLib: Convert X64/ReadDr1.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadDr1.asm to X64/ReadDr1.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:11 +08:00
Jordan Justen 7df38fad06 MdePkg BaseLib: Convert X64/ReadDr2.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadDr2.asm to X64/ReadDr2.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:10 +08:00
Jordan Justen e8ad4030c5 MdePkg BaseLib: Convert X64/ReadDr3.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadDr3.asm to X64/ReadDr3.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:09 +08:00
Jordan Justen b03d993ad8 MdePkg BaseLib: Convert X64/ReadDr4.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadDr4.asm to X64/ReadDr4.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:08 +08:00
Jordan Justen 9aa2efaacd MdePkg BaseLib: Convert X64/ReadDr5.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadDr5.asm to X64/ReadDr5.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:08 +08:00
Jordan Justen 4153550006 MdePkg BaseLib: Convert X64/ReadDr6.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadDr6.asm to X64/ReadDr6.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:07 +08:00
Jordan Justen dea86a2989 MdePkg BaseLib: Convert X64/ReadDr7.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadDr7.asm to X64/ReadDr7.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:06 +08:00
Jordan Justen aa5bfdcb78 MdePkg BaseLib: Convert X64/WriteDr0.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteDr0.asm to X64/WriteDr0.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:06 +08:00
Jordan Justen f3594c839e MdePkg BaseLib: Convert X64/WriteDr1.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteDr1.asm to X64/WriteDr1.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:04 +08:00
Jordan Justen 30fa9c7953 MdePkg BaseLib: Convert X64/WriteDr2.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteDr2.asm to X64/WriteDr2.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:04 +08:00
Jordan Justen 7b8be91964 MdePkg BaseLib: Convert X64/WriteDr3.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteDr3.asm to X64/WriteDr3.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:03 +08:00
Jordan Justen 5874dd6bbf MdePkg BaseLib: Convert X64/WriteDr4.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteDr4.asm to X64/WriteDr4.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:02 +08:00
Jordan Justen 0490028c18 MdePkg BaseLib: Convert X64/WriteDr5.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteDr5.asm to X64/WriteDr5.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:02 +08:00
Jordan Justen 689759d6b0 MdePkg BaseLib: Convert X64/WriteDr6.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteDr6.asm to X64/WriteDr6.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:01 +08:00
Jordan Justen b09957b792 MdePkg BaseLib: Convert X64/WriteDr7.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteDr7.asm to X64/WriteDr7.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:50:00 +08:00
Jordan Justen b56da74aaf MdePkg BaseLib: Convert X64/ReadCs.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadCs.asm to X64/ReadCs.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:59 +08:00
Jordan Justen c892afaf37 MdePkg BaseLib: Convert X64/ReadDs.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadDs.asm to X64/ReadDs.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:59 +08:00
Jordan Justen 8a63e4e9ec MdePkg BaseLib: Convert X64/ReadEs.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadEs.asm to X64/ReadEs.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:58 +08:00
Jordan Justen 0401a03e0c MdePkg BaseLib: Convert X64/ReadFs.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadFs.asm to X64/ReadFs.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:57 +08:00
Jordan Justen 3c8d7412bd MdePkg BaseLib: Convert X64/ReadGs.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadGs.asm to X64/ReadGs.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:57 +08:00
Jordan Justen fbc9a9104f MdePkg BaseLib: Convert X64/ReadSs.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadSs.asm to X64/ReadSs.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:56 +08:00
Jordan Justen 9967c4b058 MdePkg BaseLib: Convert X64/ReadTr.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadTr.asm to X64/ReadTr.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:55 +08:00
Jordan Justen 33ba62ac07 MdePkg BaseLib: Convert X64/ReadGdtr.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadGdtr.asm to X64/ReadGdtr.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:55 +08:00
Jordan Justen 0339e057bc MdePkg BaseLib: Convert X64/WriteGdtr.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteGdtr.asm to X64/WriteGdtr.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:54 +08:00
Jordan Justen 20bd7f342f MdePkg BaseLib: Convert X64/ReadIdtr.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadIdtr.asm to X64/ReadIdtr.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:54 +08:00
Jordan Justen 8cf392dd88 MdePkg BaseLib: Convert X64/WriteIdtr.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteIdtr.asm to X64/WriteIdtr.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:53 +08:00
Jordan Justen f80180f9c7 MdePkg BaseLib: Convert X64/ReadLdtr.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/ReadLdtr.asm to X64/ReadLdtr.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:52 +08:00
Jordan Justen 0a6729da8a MdePkg BaseLib: Convert X64/WriteLdtr.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/WriteLdtr.asm to X64/WriteLdtr.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:52 +08:00
Jordan Justen fe3034ba66 MdePkg BaseLib: Convert X64/FxSave.asm to NASM
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/FxSave.asm to X64/FxSave.nasm

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2016-06-28 09:49:51 +08:00