summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.S10
-rw-r--r--EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S30
-rw-r--r--EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.S4
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c165
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c139
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Mwait.S2
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/SetJump.S4
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.S63
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c5
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c5
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/SmmRuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c5
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c3
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Print/Print.c138
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/X64/ProcessorAsms.S56
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.S4
15 files changed, 265 insertions, 368 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.S b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.S
index 167e7d4cc..36f5fd577 100644
--- a/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.S
+++ b/EdkCompatibilityPkg/Compatibility/BootScriptSaveOnS3SaveStateThunk/X64/AsmDispatchExecute.S
@@ -45,9 +45,9 @@ ASM_PFX(AsmExecute32BitCode):
#
# save orignal GDTR and CS
#
- movq %ds, %rax
+ movl %ds, %eax
push %rax
- movq %cs, %rax
+ movl %cs, %eax
push %rax
subq $0x10, %rsp
sgdt (%rsp)
@@ -209,8 +209,8 @@ ReturnToLongMode:
# Reload original DS/ES/SS
#
pop %rcx
- movq %rcx, %ds
- movq %rcx, %es
- movq %rcx, %ss
+ movl %ecx, %ds
+ movl %ecx, %es
+ movl %ecx, %ss
ret
diff --git a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S
index 5ec90bdaa..6ea0f3e69 100644
--- a/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S
+++ b/EdkCompatibilityPkg/Compatibility/MpServicesOnFrameworkMpServicesThunk/X64/MpFuncs.S
@@ -13,18 +13,18 @@
#------------------------------------------------------------------------------
-.equ VacantFlag, 0x0
-.equ NotVacantFlag, 0xff
-
-.equ LockLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart
-.equ StackStartAddressLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x08
-.equ StackSizeLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x10
-.equ CProcedureLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x18
-.equ GdtrLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x20
-.equ IdtrLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x2A
-.equ BufferStartLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x34
-.equ Cr3OffsetLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x38
-.equ ProcessorNumberLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x38
+.set VacantFlag, 0x0
+.set NotVacantFlag, 0xff
+
+.set LockLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart
+.set StackStartAddressLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x08
+.set StackSizeLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x10
+.set CProcedureLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x18
+.set GdtrLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x20
+.set IdtrLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x2A
+.set BufferStartLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x34
+.set Cr3OffsetLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x38
+.set ProcessorNumberLocation, RendezvousFunnelProcEnd - RendezvousFunnelProcStart + 0x38
#-------------------------------------------------------------------------------------
@@ -186,7 +186,9 @@ RendezvousFunnelProcEnd:
# comments here for definition of address map
ASM_GLOBAL ASM_PFX(AsmGetAddressMap)
ASM_PFX(AsmGetAddressMap):
-
+#ifdef __APPLE__
+ int $3
+#else
movq $RendezvousFunnelProcStart, %rax
movq %rax, (%rcx)
movq $(ProtectedModeStart - RendezvousFunnelProcStart), 0x08(%rcx)
@@ -194,5 +196,5 @@ ASM_PFX(AsmGetAddressMap):
movq $(LongModeStart - RendezvousFunnelProcStart), 0x18(%rcx)
movq $(LONG_JUMP - RendezvousFunnelProcStart), 0x20(%rcx)
movq $(RendezvousFunnelProcEnd - RendezvousFunnelProcStart), 0x28(%rcx)
-
+#endif
ret
diff --git a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.S b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.S
index 5a5050735..ae26a4b30 100644
--- a/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.S
+++ b/EdkCompatibilityPkg/Compatibility/SmmBaseHelper/X64/PageFaultHandler.S
@@ -40,7 +40,11 @@ ASM_PFX(PageFaultHandlerHook):
popq %rcx
popq %rax # restore all volatile registers
jnz L1
+#ifdef __APPLE__
+ int $3
+#else
jmpq *ASM_PFX(mOriginalHandler)
+#endif
L1:
addq $0x08, %rsp # skip error code for PF
iretq
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c
index 91f3aaffb..2c8dc73ae 100644
--- a/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c
+++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Print.c
@@ -65,14 +65,6 @@ Abstract:
#include EFI_PROTOCOL_DEFINITION (Hii)
#endif
-STATIC
-CHAR_W *
-GetFlagsAndWidth (
- IN CHAR_W *Format,
- OUT UINTN *Flags,
- OUT UINTN *Width,
- IN OUT VA_LIST *Marker
- );
STATIC
UINTN
@@ -552,6 +544,7 @@ Returns:
UINTN BufferLeft;
UINT64 Value;
EFI_GUID *TmpGUID;
+ BOOLEAN Done;
//
// Process the format string. Stop if Buffer is over run.
@@ -578,7 +571,64 @@ Returns:
//
// Now it's time to parse what follows after %
//
- Format = GetFlagsAndWidth (Format, &Flags, &Width, &Marker);
+ Flags = 0;
+ Width = 0;
+ for (Done = FALSE; !Done;) {
+ Format++;
+
+ switch (*Format) {
+
+ case '-':
+ Flags |= LEFT_JUSTIFY;
+ break;
+
+ case '+':
+ Flags |= PREFIX_SIGN;
+ break;
+
+ case ' ':
+ Flags |= PREFIX_BLANK;
+ break;
+
+ case ',':
+ Flags |= COMMA_TYPE;
+ break;
+
+ case 'L':
+ case 'l':
+ Flags |= LONG_TYPE;
+ break;
+
+ case '*':
+ Width = VA_ARG (Marker, UINTN);
+ break;
+
+ case '0':
+ Flags |= PREFIX_ZERO;
+
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ Count = 0;
+ do {
+ Count = (Count * 10) +*Format - '0';
+ Format++;
+ } while ((*Format >= '0') && (*Format <= '9'));
+ Format--;
+ Width = Count;
+ break;
+
+ default:
+ Done = TRUE;
+ }
+ }
+
switch (*Format) {
case 'p':
//
@@ -726,103 +776,6 @@ Returns:
}
STATIC
-CHAR_W *
-GetFlagsAndWidth (
- IN CHAR_W *Format,
- OUT UINTN *Flags,
- OUT UINTN *Width,
- IN OUT VA_LIST *Marker
- )
-/*++
-
-Routine Description:
-
- VSPrint worker function that parses flag and width information from the
- Format string and returns the next index into the Format string that needs
- to be parsed. See file headed for details of Flag and Width.
-
-Arguments:
-
- Format - Current location in the VSPrint format string.
-
- Flags - Returns flags
-
- Width - Returns width of element
-
- Marker - Vararg list that may be paritally consumed and returned.
-
-Returns:
-
- Pointer indexed into the Format string for all the information parsed
- by this routine.
-
---*/
-{
- UINTN Count;
- BOOLEAN Done;
-
- *Flags = 0;
- *Width = 0;
- for (Done = FALSE; !Done;) {
- Format++;
-
- switch (*Format) {
-
- case '-':
- *Flags |= LEFT_JUSTIFY;
- break;
-
- case '+':
- *Flags |= PREFIX_SIGN;
- break;
-
- case ' ':
- *Flags |= PREFIX_BLANK;
- break;
-
- case ',':
- *Flags |= COMMA_TYPE;
- break;
-
- case 'L':
- case 'l':
- *Flags |= LONG_TYPE;
- break;
-
- case '*':
- *Width = VA_ARG (*Marker, UINTN);
- break;
-
- case '0':
- *Flags |= PREFIX_ZERO;
-
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- Count = 0;
- do {
- Count = (Count * 10) +*Format - '0';
- Format++;
- } while ((*Format >= '0') && (*Format <= '9'));
- Format--;
- *Width = Count;
- break;
-
- default:
- Done = TRUE;
- }
- }
-
- return Format;
-}
-
-STATIC
UINTN
GuidToString (
IN EFI_GUID *Guid,
diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c
index c07b74738..6585726d2 100644
--- a/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c
+++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/Print/Print.c
@@ -61,15 +61,6 @@ Abstract:
STATIC
-CHAR_W *
-GetFlagsAndWidth (
- IN CHAR_W *Format,
- OUT UINTN *Flags,
- OUT UINTN *Width,
- IN OUT VA_LIST *Marker
- );
-
-STATIC
UINTN
GuidToString (
IN EFI_GUID *Guid,
@@ -180,6 +171,7 @@ Returns:
UINTN BufferLeft;
UINT64 Value;
EFI_GUID *TmpGUID;
+ BOOLEAN Done;
//
// Process the format string. Stop if Buffer is over run.
@@ -204,8 +196,50 @@ Returns:
//
// Now it's time to parse what follows after %
- //
- Format = GetFlagsAndWidth (Format, &Flags, &Width, &Marker);
+ //
+ Flags = 0;
+ Width = 0;
+ for (Done = FALSE; !Done; ) {
+ Format++;
+
+ switch (*Format) {
+
+ case '-': Flags |= LEFT_JUSTIFY; break;
+ case '+': Flags |= PREFIX_SIGN; break;
+ case ' ': Flags |= PREFIX_BLANK; break;
+ case ',': Flags |= COMMA_TYPE; break;
+ case 'L':
+ case 'l': Flags |= LONG_TYPE; break;
+
+ case '*':
+ Width = VA_ARG (Marker, UINTN);
+ break;
+
+ case '0':
+ Flags |= PREFIX_ZERO;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ Count = 0;
+ do {
+ Count = (Count * 10) + *Format - '0';
+ Format++;
+ } while ((*Format >= '0') && (*Format <= '9'));
+ Format--;
+ Width = Count;
+ break;
+
+ default:
+ Done = TRUE;
+ }
+ }
+
switch (*Format) {
case 'p':
//
@@ -347,89 +381,6 @@ Returns:
return &Buffer[Index] - StartOfBuffer;
}
-
-
-STATIC
-CHAR_W *
-GetFlagsAndWidth (
- IN CHAR_W *Format,
- OUT UINTN *Flags,
- OUT UINTN *Width,
- IN OUT VA_LIST *Marker
- )
-/*++
-
-Routine Description:
-
- VSPrint worker function that parses flag and width information from the
- Format string and returns the next index into the Format string that needs
- to be parsed. See file headed for details of Flag and Width.
-
-Arguments:
-
- Format - Current location in the VSPrint format string.
-
- Flags - Returns flags
-
- Width - Returns width of element
-
- Marker - Vararg list that may be paritally consumed and returned.
-
-Returns:
-
- Pointer indexed into the Format string for all the information parsed
- by this routine.
-
---*/
-{
- UINTN Count;
- BOOLEAN Done;
-
- *Flags = 0;
- *Width = 0;
- for (Done = FALSE; !Done; ) {
- Format++;
-
- switch (*Format) {
-
- case '-': *Flags |= LEFT_JUSTIFY; break;
- case '+': *Flags |= PREFIX_SIGN; break;
- case ' ': *Flags |= PREFIX_BLANK; break;
- case ',': *Flags |= COMMA_TYPE; break;
- case 'L':
- case 'l': *Flags |= LONG_TYPE; break;
-
- case '*':
- *Width = VA_ARG (*Marker, UINTN);
- break;
-
- case '0':
- *Flags |= PREFIX_ZERO;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- Count = 0;
- do {
- Count = (Count * 10) + *Format - '0';
- Format++;
- } while ((*Format >= '0') && (*Format <= '9'));
- Format--;
- *Width = Count;
- break;
-
- default:
- Done = TRUE;
- }
- }
- return Format;
-}
-
STATIC
UINTN
GuidToString (
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Mwait.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Mwait.S
index 2f2f18da7..ea684e01d 100644
--- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Mwait.S
+++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Mwait.S
@@ -34,5 +34,5 @@
ASM_PFX(AsmMwait):
mov %ecx,%eax
mov %edx,%ecx
- mwait %rax,%rcx
+ mwait
ret
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/SetJump.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/SetJump.S
index 59b180d4f..ba66f9a49 100644
--- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/SetJump.S
+++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/SetJump.S
@@ -19,12 +19,12 @@
#
#------------------------------------------------------------------------------
#include <EdkIIGlueBase.h>
-.extern InternalAssertJumpBuffer;
+
.globl ASM_PFX(SetJump)
ASM_PFX(SetJump):
push %rcx
add $0xffffffffffffffe0,%rsp
- call _InternalAssertJumpBuffer
+ call ASM_PFX(InternalAssertJumpBuffer)
add $0x20,%rsp
pop %rcx
pop %rdx
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.S b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.S
index da626ad47..1de788a18 100644
--- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.S
+++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/Thunk16.S
@@ -30,31 +30,33 @@
.globl ASM_PFX(InternalAsmThunk16)
# define the structure of IA32_REGS
-.equ _EDI, 0 #size 4
-.equ _ESI, 4 #size 4
-.equ _EBP, 8 #size 4
-.equ _ESP, 12 #size 4
-.equ _EBX, 16 #size 4
-.equ _EDX, 20 #size 4
-.equ _ECX, 24 #size 4
-.equ _EAX, 28 #size 4
-.equ _DS, 32 #size 2
-.equ _ES, 34 #size 2
-.equ _FS, 36 #size 2
-.equ _GS, 38 #size 2
-.equ _EFLAGS, 40 #size 8
-.equ _EIP, 48 #size 4
-.equ _CS, 52 #size 2
-.equ _SS, 54 #size 2
-.equ IA32_REGS_SIZE, 56
+.set _EDI, 0 #size 4
+.set _ESI, 4 #size 4
+.set _EBP, 8 #size 4
+.set _ESP, 12 #size 4
+.set _EBX, 16 #size 4
+.set _EDX, 20 #size 4
+.set _ECX, 24 #size 4
+.set _EAX, 28 #size 4
+.set _DS, 32 #size 2
+.set _ES, 34 #size 2
+.set _FS, 36 #size 2
+.set _GS, 38 #size 2
+.set _EFLAGS, 40 #size 8
+.set _EIP, 48 #size 4
+.set _CS, 52 #size 2
+.set _SS, 54 #size 2
+.set IA32_REGS_SIZE, 56
.data
-
+
+#ifndef __APPLE__
ASM_PFX(m16Size): .word ASM_PFX(InternalAsmThunk16) - ASM_PFX(m16Start)
ASM_PFX(mThunk16Attr): .word _ThunkAttr - ASM_PFX(m16Start)
ASM_PFX(m16Gdt): .word ASM_PFX(NullSeg) - ASM_PFX(m16Start)
ASM_PFX(m16GdtrBase): .word _16GdtrBase - ASM_PFX(m16Start)
ASM_PFX(mTransition): .word _EntryPoint - ASM_PFX(m16Start)
+#endif
.text
@@ -68,6 +70,9 @@ SavedGdt: .space 10
#------------------------------------------------------------------------------
.globl ASM_PFX(BackFromUserCode)
ASM_PFX(BackFromUserCode):
+#ifdef __APPLE__
+ int $3
+#else
#
# The order of saved registers on the stack matches the order they appears
# in IA32_REGS structure. This facilitates wrapper function to extract them
@@ -143,14 +148,17 @@ L_64BitCode:
.byte 0x67,0xbc # mov esp, imm32
SavedSp: .space 4 # restore stack
nop
+#endif
ret
+#ifndef __APPLE__
_EntryPoint: .long ASM_PFX(ToUserCode) - ASM_PFX(m16Start)
.word CODE16
_16Gdtr: .word GDT_SIZE - 1
_16GdtrBase: .quad ASM_PFX(NullSeg)
_16Idtr: .word 0x3ff
.long 0
+#endif
#------------------------------------------------------------------------------
# _ToUserCode() takes control in real mode before passing control to user code.
@@ -158,6 +166,9 @@ _16Idtr: .word 0x3ff
#------------------------------------------------------------------------------
.globl ASM_PFX(ToUserCode)
ASM_PFX(ToUserCode):
+#ifdef __APPLE__
+ int $3
+#else
movl %edx,%ss # set new segment selectors
movl %edx,%ds
movl %edx,%es
@@ -191,11 +202,12 @@ L_RealMode:
.byte 0x66, 0x9d # popfd
leaw 4(%esp),%sp # skip high order 32 bits of EFlags
.byte 0x66 # make the following retf 32-bit
- lret # transfer control to user code
+#endif
+ lret # transfer control to user code
-.equ CODE16, ASM_PFX(_16Code) - .
-.equ DATA16, ASM_PFX(_16Data) - .
-.equ DATA32, ASM_PFX(_32Data) - .
+.set CODE16, ASM_PFX(_16Code) - .
+.set DATA16, ASM_PFX(_16Data) - .
+.set DATA32, ASM_PFX(_32Data) - .
ASM_PFX(NullSeg): .quad 0
ASM_PFX(_16Code):
@@ -220,7 +232,7 @@ ASM_PFX(_32Data):
.byte 0xcf # 16-bit segment, 4GB limit
.byte 0
-.equ GDT_SIZE, . - ASM_PFX(NullSeg)
+.set GDT_SIZE, . - ASM_PFX(NullSeg)
#------------------------------------------------------------------------------
# IA32_REGISTER_SET *
@@ -233,6 +245,9 @@ ASM_PFX(_32Data):
.globl ASM_PFX(InternalAsmThunk16)
ASM_PFX(InternalAsmThunk16):
+#ifdef __APPLE__
+ int $3
+#else
pushq %rbp
pushq %rbx
pushq %rsi
@@ -304,5 +319,5 @@ L_RetFromRealMode:
popq %rsi
popq %rbx
popq %rbp
-
+#endif
ret
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
index 35417810f..a1c232dea 100644
--- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
+++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/DxeReportStatusCodeLib/ReportStatusCodeLib.c
@@ -296,11 +296,16 @@ GlueReportStatusCodeExtractDebugInfo (
*ErrorLevel = DebugInfo->ErrorLevel;
+#ifdef __APPLE__
+ // This is non portable C code you can't assume VA_LIST is pointer
+ return FALSE;
+#else
//
// The first 12 * UINTN bytes of the string are really an
// argument stack to support varargs on the Format string.
//
*Marker = (VA_LIST) (DebugInfo + 1);
+#endif
*Format = (CHAR8 *)(((UINT64 *)*Marker) + 12);
return TRUE;
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c
index 05c42cdd5..29207e0f5 100644
--- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c
+++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/PeiReportStatusCodeLib/ReportStatusCodeLib.c
@@ -248,7 +248,12 @@ GlueReportStatusCodeExtractDebugInfo (
// The first 12 * UINTN bytes of the string are really an
// argument stack to support varargs on the Format string.
//
+#ifdef __APPLE__
+ // This is non portable C code you can't assume VA_LIST is pointer
+ return FALSE;
+#else
*Marker = (VA_LIST) (DebugInfo + 1);
+#endif
*Format = (CHAR8 *)(((UINT64 *)*Marker) + 12);
return TRUE;
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/SmmRuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/SmmRuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c
index fa919c768..ef16d4010 100644
--- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/SmmRuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c
+++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/SmmRuntimeDxeReportStatusCodeLib/ReportStatusCodeLib.c
@@ -280,7 +280,12 @@ GlueReportStatusCodeExtractDebugInfo (
// The first 12 * UINTN bytes of the string are really an
// argument stack to support varargs on the Format string.
//
+#ifdef __APPLE__
+ // This is non portable C code you can't assume VA_LIST is pointer
+ return FALSE;
+#else
*Marker = (VA_LIST) (DebugInfo + 1);
+#endif
*Format = (CHAR8 *)(((UINT64 *)*Marker) + 12);
return TRUE;
diff --git a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c
index 023eda0b0..ce56fcf36 100644
--- a/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c
+++ b/EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/ReportStatusCode.c
@@ -332,9 +332,10 @@ Returns:
// The first 12 * UINTN bytes of the string are really an
// arguement stack to support varargs on the Format string.
//
-#ifdef EFIARM
+#if (defined (EFIARM) || defined(__APPLE__))
// It is not legal C code to case VA_LIST to a pointer. VA_LIST can
// be a structure.
+ return FALSE;
#else
*Marker = (VA_LIST) (DebugInfo + 1);
*Format = (CHAR8 *)(((UINT64 *)*Marker) + 12);
diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Print/Print.c b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Print/Print.c
index a1aaaba09..b854cbe34 100644
--- a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Print/Print.c
+++ b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Print/Print.c
@@ -58,14 +58,6 @@ Abstract:
#include "PeiLib.h"
#include "Print.h"
-STATIC
-CHAR8 *
-GetFlagsAndWidth (
- IN CHAR8 *Format,
- OUT UINTN *Flags,
- OUT UINTN *Width,
- IN OUT VA_LIST *Marker
- );
STATIC
UINTN
@@ -195,7 +187,8 @@ Returns:
UINTN BufferLeft;
UINT64 Value;
EFI_GUID *TmpGUID;
-
+ BOOLEAN Done;
+
//
// Process the format string. Stop if Buffer is over run.
//
@@ -218,8 +211,50 @@ Returns:
//
// Now it's time to parse what follows after %
- //
- Format = GetFlagsAndWidth (Format, &Flags, &Width, &Marker);
+ //
+ Flags = 0;
+ Width = 0;
+ for (Done = FALSE; !Done; ) {
+ Format++;
+
+ switch (*Format) {
+
+ case '-': Flags |= LEFT_JUSTIFY; break;
+ case '+': Flags |= PREFIX_SIGN; break;
+ case ' ': Flags |= PREFIX_BLANK; break;
+ case ',': Flags |= COMMA_TYPE; break;
+ case 'L':
+ case 'l': Flags |= LONG_TYPE; break;
+
+ case '*':
+ Width = VA_ARG (Marker, UINTN);
+ break;
+
+ case '0':
+ Flags |= PREFIX_ZERO;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ Count = 0;
+ do {
+ Count = (Count * 10) + *Format - '0';
+ Format++;
+ } while ((*Format >= '0') && (*Format <= '9'));
+ Format--;
+ Width = Count;
+ break;
+
+ default:
+ Done = TRUE;
+ }
+ }
+
switch (*Format) {
case 'p':
//
@@ -367,87 +402,6 @@ Returns:
-STATIC
-CHAR8 *
-GetFlagsAndWidth (
- IN CHAR8 *Format,
- OUT UINTN *Flags,
- OUT UINTN *Width,
- IN OUT VA_LIST *Marker
- )
-/*++
-
-Routine Description:
-
- AvSPrint worker function that parses flag and width information from the
- Format string and returns the next index into the Format string that needs
- to be parsed. See file headed for details of Flag and Width.
-
-Arguments:
-
- Format - Current location in the AvSPrint format string.
-
- Flags - Returns flags
-
- Width - Returns width of element
-
- Marker - Vararg list that may be paritally consumed and returned.
-
-Returns:
-
- Pointer indexed into the Format string for all the information parsed
- by this routine.
-
---*/
-{
- UINTN Count;
- BOOLEAN Done;
-
- *Flags = 0;
- *Width = 0;
- for (Done = FALSE; !Done; ) {
- Format++;
-
- switch (*Format) {
-
- case '-': *Flags |= LEFT_JUSTIFY; break;
- case '+': *Flags |= PREFIX_SIGN; break;
- case ' ': *Flags |= PREFIX_BLANK; break;
- case ',': *Flags |= COMMA_TYPE; break;
- case 'L':
- case 'l': *Flags |= LONG_TYPE; break;
-
- case '*':
- *Width = VA_ARG (*Marker, UINTN);
- break;
-
- case '0':
- *Flags |= PREFIX_ZERO;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- Count = 0;
- do {
- Count = (Count * 10) + *Format - '0';
- Format++;
- } while ((*Format >= '0') && (*Format <= '9'));
- Format--;
- *Width = Count;
- break;
-
- default:
- Done = TRUE;
- }
- }
- return Format;
-}
-
static CHAR8 mHexStr[] = { '0','1','2','3','4','5','6','7',
'8','9','A','B','C','D','E','F' };
diff --git a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/X64/ProcessorAsms.S b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/X64/ProcessorAsms.S
index 2d464488c..6987b4191 100644
--- a/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/X64/ProcessorAsms.S
+++ b/EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/X64/ProcessorAsms.S
@@ -59,8 +59,8 @@ ASM_PFX(SwitchStacks):
#SwitchStacks ENDP
-.equ EFI_SUCCESS, 0
-.equ EFI_WARN_RETURN_FROM_LONG_JUMP, 5
+.set EFI_SUCCESS, 0
+.set EFI_WARN_RETURN_FROM_LONG_JUMP, 5
#
#Routine Description:
@@ -99,19 +99,19 @@ ASM_PFX(TransferControlSetJump):
mov %r13,0x40(%rdx)
mov %r14,0x48(%rdx)
mov %r15,0x50(%rdx)
- #; save non-volatile fp registers
- stmxcsr 0x60(%rdx)
- lea 0x68(%rdx), %rax
- movdqu %xmm6, (%rax)
- movdqu %xmm7, 0x10(%rax)
- movdqu %xmm8, 0x20(%rax)
- movdqu %xmm9, 0x30(%rax)
- movdqu %xmm10, 0x40(%rax)
- movdqu %xmm11, 0x50(%rax)
- movdqu %xmm12, 0x60(%rax)
- movdqu %xmm13, 0x70(%rax)
- movdqu %xmm14, 0x80(%rax)
- movdqu %xmm15, 0x90(%rax)
+ #; save non-volatile fp registers
+ stmxcsr 0x60(%rdx)
+ lea 0x68(%rdx), %rax
+ movdqu %xmm6, (%rax)
+ movdqu %xmm7, 0x10(%rax)
+ movdqu %xmm8, 0x20(%rax)
+ movdqu %xmm9, 0x30(%rax)
+ movdqu %xmm10, 0x40(%rax)
+ movdqu %xmm11, 0x50(%rax)
+ movdqu %xmm12, 0x60(%rax)
+ movdqu %xmm13, 0x70(%rax)
+ movdqu %xmm14, 0x80(%rax)
+ movdqu %xmm15, 0x90(%rax)
mov (%rsp),%rax
mov %rax,0x58(%rdx)
mov $0x0,%rax
@@ -129,19 +129,19 @@ ASM_PFX(TransferControlSetJump):
#
ASM_PFX(TransferControlLongJump):
# set return from SetJump to EFI_WARN_RETURN_FROM_LONG_JUMP
- #; load non-volatile fp registers
- ldmxcsr 0x60(%rdx)
- lea 0x68(%rdx), %rax
- movdqu (%rax), %xmm6
- movdqu 0x10(%rax), %xmm7
- movdqu 0x20(%rax), %xmm8
- movdqu 0x30(%rax), %xmm9
- movdqu 0x40(%rax), %xmm10
- movdqu 0x50(%rax), %xmm11
- movdqu 0x60(%rax), %xmm12
- movdqu 0x70(%rax), %xmm13
- movdqu 0x80(%rax), %xmm14
- movdqu 0x90(%rax), %xmm15
+ #; load non-volatile fp registers
+ ldmxcsr 0x60(%rdx)
+ lea 0x68(%rdx), %rax
+ movdqu (%rax), %xmm6
+ movdqu 0x10(%rax), %xmm7
+ movdqu 0x20(%rax), %xmm8
+ movdqu 0x30(%rax), %xmm9
+ movdqu 0x40(%rax), %xmm10
+ movdqu 0x50(%rax), %xmm11
+ movdqu 0x60(%rax), %xmm12
+ movdqu 0x70(%rax), %xmm13
+ movdqu 0x80(%rax), %xmm14
+ movdqu 0x90(%rax), %xmm15
mov $0x5,%rax
mov (%rdx),%rbx
mov 0x8(%rdx),%rsp
diff --git a/EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.S b/EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.S
index 10f3a34c1..7328ab764 100644
--- a/EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.S
+++ b/EdkCompatibilityPkg/Foundation/Library/Thunk16/X64/Thunk16.S
@@ -20,7 +20,7 @@
#*****************************************************************************
#include <EfiBind.h>
-
+#ifndef __APPLE__
.data
@@ -240,3 +240,5 @@ FarCallRet:
_16Idtr:
.word 0x3ff #FWORD (1 SHL 10) - 1
.byte 0x00
+
+#endif