BaseTools/tools_def: Add NASM_FLAGS

Note: Only tested with the GCC49 toolchain so far.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
BaseTools/build_rule: Add .nasm => .obj build rule

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
MdePkg/Base.h: Always define ASM_PFX

Some compilers may define __USER_LABEL_PREFIX__ to determine the
prefix used with ASM_PFX. Otherwise, IA32 will use a single underscore
'_' character, and all other architectures will use an empty prefix.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
MdePkg/BaseLib Thunk16: Replace IA32 GAS Thunk16 with NASM version

This is a translation of Ia32/Thunk16.asm to NASM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
MdePkg/BaseLib Thunk16: Replace X64 GAS Thunk16 with NASM version

This is a translation of X64/Thunk16.asm to NASM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
MdePkg/BaseLib NASM Thunk16: Use NASM local labels

http://www.nasm.us/doc/nasmdoc3.html#section-3.9

A local label is a label beginning with the period, and it's actual
name is prefixed by the previous non-local label.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
MdePkg/BaseLib NASM Thunk16: Use bits 16 for 16-bit code

By using 'bits 16', we can write code for 16-bit use the actual
assembly syntax rather than 'DB' and sometimes writing code with
seemingly incorrect operands because we know it will run correctly
when the processor is running in 16-bit mode.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
MdePkg/BaseLib NASM Thunk16: Remove remain 'DB' code

Convert remaining 'DB' code to assembly code by:
* Move instruction immediate data labels to end of instruction
* Use strict keyword to make sure immediate data size is not optimized

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
BaseTools: Revert r15816 and r15831 to fix !if in .fdf

r15816: "This patch is going to retire the top level makefile on
BaseTools for supporting a pure binary build without any complier."

r15831: "This patch is going to fix a build failure (running of
GenFds) in Linux system caused by patch at r15816."

Something in these changes causes !if processing to not work
correctly. Reverting these changes appears to fix it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>