summaryrefslogtreecommitdiff
path: root/EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2016-07-17 12:11:32 +0200
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2016-07-21 13:32:09 +0200
commit0676c285ba518ae81ca7f06278d4cc4958660864 (patch)
tree0b5a1a1146889fe2f4a5da82f2cc7d6a75efc034 /EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h
parent48d5f9a551a93acb45f272dda879b0ab5a504e36 (diff)
downloadedk2-platforms-0676c285ba518ae81ca7f06278d4cc4958660864.tar.xz
EdkCompatibilityPkg: Enable new MS VA intrinsics for GNUC x86 64bits build
Align EdkCompatibilityPkg with this change from MdePkg Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Tested-By: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h')
-rw-r--r--EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h b/EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h
index 94b93ea4d1..cd32553105 100644
--- a/EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h
+++ b/EdkCompatibilityPkg/Foundation/Include/EfiStdArg.h
@@ -93,6 +93,30 @@ Abstract:
#define VA_COPY(Dest, Start) __va_copy (Dest, Start)
#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS)
+
+#if defined(MDE_CPU_X64) && !defined(NO_MSABI_VA_FUNCS)
+//
+// X64 only. Use MS ABI version of GCC built-in macros for variable argument lists.
+//
+///
+/// Both GCC and LLVM 3.8 for X64 support new variable argument intrinsics for Microsoft ABI
+///
+
+///
+/// Variable used to traverse the list of arguments. This type can vary by
+/// implementation and could be an array or structure.
+///
+typedef __builtin_ms_va_list VA_LIST;
+
+#define VA_START(Marker, Parameter) __builtin_ms_va_start (Marker, Parameter)
+
+#define VA_ARG(Marker, TYPE) ((sizeof (TYPE) < sizeof (UINTN)) ? (TYPE)(__builtin_va_arg (Marker, UINTN)) : (TYPE)(__builtin_va_arg (Marker, TYPE)))
+
+#define VA_END(Marker) __builtin_ms_va_end (Marker)
+
+#define VA_COPY(Dest, Start) __builtin_ms_va_copy (Dest, Start)
+
+#else
//
// Use GCC built-in macros for variable argument lists.
//
@@ -111,6 +135,8 @@ typedef __builtin_va_list VA_LIST;
#define VA_COPY(Dest, Start) __builtin_va_copy (Dest, Start)
+#endif
+
#else
#ifndef VA_START