147 lines
3.7 KiB
Diff
147 lines
3.7 KiB
Diff
|
From 1e745dbd820ca0f35a078a381480b308a750c624 Mon Sep 17 00:00:00 2001
|
||
|
From: Nigel Croxon <nigel.croxon@hpe.com>
|
||
|
Date: Wed, 23 Sep 2015 10:03:31 -0400
|
||
|
Subject: [PATCH 03/10] From: Pete Batard <pete@akeo.ie> Subject: [PATCH] Fix
|
||
|
MSVC breakage due to GNU align extensions in setjmp
|
||
|
|
||
|
* __attribute__((__aligned__(x))), which is used in setjmp, is GNU only => use a macro instead
|
||
|
|
||
|
Signed-off-by: Pete Batard <pete@akeo.ie>
|
||
|
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
|
||
|
---
|
||
|
inc/aarch64/efisetjmp_arch.h | 4 +++-
|
||
|
inc/arm/efisetjmp_arch.h | 4 +++-
|
||
|
inc/efisetjmp.h | 6 ++++++
|
||
|
inc/ia32/efisetjmp_arch.h | 6 +++---
|
||
|
inc/ia64/efisetjmp_arch.h | 4 +++-
|
||
|
inc/x86_64/efisetjmp_arch.h | 4 +++-
|
||
|
6 files changed, 21 insertions(+), 7 deletions(-)
|
||
|
|
||
|
diff --git a/inc/aarch64/efisetjmp_arch.h b/inc/aarch64/efisetjmp_arch.h
|
||
|
index bce9b73..abd7a0e 100644
|
||
|
--- a/inc/aarch64/efisetjmp_arch.h
|
||
|
+++ b/inc/aarch64/efisetjmp_arch.h
|
||
|
@@ -1,6 +1,8 @@
|
||
|
#ifndef GNU_EFI_AARCH64_SETJMP_H
|
||
|
#define GNU_EFI_AARCH64_SETJMP_H
|
||
|
|
||
|
+#define JMPBUF_ALIGN 8
|
||
|
+
|
||
|
typedef struct {
|
||
|
/* GP regs */
|
||
|
UINT64 X19;
|
||
|
@@ -26,6 +28,6 @@ typedef struct {
|
||
|
UINT64 D13;
|
||
|
UINT64 D14;
|
||
|
UINT64 D15;
|
||
|
-} __attribute__((__aligned__(8))) jmp_buf;
|
||
|
+} ALIGN(JMPBUF_ALIGN) jmp_buf;
|
||
|
|
||
|
#endif /* GNU_EFI_AARCH64_SETJMP_H */
|
||
|
diff --git a/inc/arm/efisetjmp_arch.h b/inc/arm/efisetjmp_arch.h
|
||
|
index 0faf2e2..3a09ea5 100644
|
||
|
--- a/inc/arm/efisetjmp_arch.h
|
||
|
+++ b/inc/arm/efisetjmp_arch.h
|
||
|
@@ -1,6 +1,8 @@
|
||
|
#ifndef GNU_EFI_ARM_SETJMP_H
|
||
|
#define GNU_EFI_ARM_SETJMP_H
|
||
|
|
||
|
+#define JMPBUF_ALIGN 4
|
||
|
+
|
||
|
typedef struct {
|
||
|
UINT32 R3; // A copy of R13
|
||
|
UINT32 R4;
|
||
|
@@ -14,6 +16,6 @@ typedef struct {
|
||
|
UINT32 R12;
|
||
|
UINT32 R13;
|
||
|
UINT32 R14;
|
||
|
-} __attribute__((__aligned__(4))) jmp_buf;
|
||
|
+} ALIGN(JMPBUF_ALIGN) jmp_buf;
|
||
|
|
||
|
#endif /* GNU_EFI_ARM_SETJMP_H */
|
||
|
diff --git a/inc/efisetjmp.h b/inc/efisetjmp.h
|
||
|
index da8d050..9cb6cec 100644
|
||
|
--- a/inc/efisetjmp.h
|
||
|
+++ b/inc/efisetjmp.h
|
||
|
@@ -1,6 +1,12 @@
|
||
|
#ifndef GNU_EFI_SETJMP_H
|
||
|
#define GNU_EFI_SETJMP_H
|
||
|
|
||
|
+#ifdef _MSC_EXTENSIONS
|
||
|
+#define ALIGN(x) __declspec(align(x))
|
||
|
+#else
|
||
|
+#define ALIGN(x) __attribute__((__aligned__(x)))
|
||
|
+#endif
|
||
|
+
|
||
|
#include "efisetjmp_arch.h"
|
||
|
|
||
|
extern UINTN setjmp(jmp_buf *env);
|
||
|
diff --git a/inc/ia32/efisetjmp_arch.h b/inc/ia32/efisetjmp_arch.h
|
||
|
index ca2e075..17184e7 100644
|
||
|
--- a/inc/ia32/efisetjmp_arch.h
|
||
|
+++ b/inc/ia32/efisetjmp_arch.h
|
||
|
@@ -1,6 +1,8 @@
|
||
|
#ifndef GNU_EFI_IA32_SETJMP_H
|
||
|
#define GNU_EFI_IA32_SETJMP_H
|
||
|
|
||
|
+#define JMPBUF_ALIGN 4
|
||
|
+
|
||
|
typedef struct {
|
||
|
UINT32 Ebx;
|
||
|
UINT32 Esi;
|
||
|
@@ -8,8 +10,6 @@ typedef struct {
|
||
|
UINT32 Ebp;
|
||
|
UINT32 Esp;
|
||
|
UINT32 Eip;
|
||
|
-} __attribute__((__aligned__(4))) jmp_buf;
|
||
|
-
|
||
|
-#define JMPBUF_ALIGN 4
|
||
|
+} ALIGN(JMPBUF_ALIGN) jmp_buf;
|
||
|
|
||
|
#endif /* GNU_EFI_IA32_SETJMP_H */
|
||
|
diff --git a/inc/ia64/efisetjmp_arch.h b/inc/ia64/efisetjmp_arch.h
|
||
|
index dadbe64..3afa044 100644
|
||
|
--- a/inc/ia64/efisetjmp_arch.h
|
||
|
+++ b/inc/ia64/efisetjmp_arch.h
|
||
|
@@ -1,6 +1,8 @@
|
||
|
#ifndef GNU_EFI_IA64_SETJMP_H
|
||
|
#define GNU_EFI_IA64_SETJMP_H
|
||
|
|
||
|
+#define JMPBUF_ALIGN 0x10
|
||
|
+
|
||
|
typedef struct {
|
||
|
UINT64 F2[2];
|
||
|
UINT64 F3[2];
|
||
|
@@ -40,6 +42,6 @@ typedef struct {
|
||
|
UINT64 Predicates;
|
||
|
UINT64 LoopCount;
|
||
|
UINT64 FPSR;
|
||
|
-} __attribute__((__aligned__(0x10))) jmp_buf;
|
||
|
+} ALIGN(JMPBUF_ALIGN) jmp_buf;
|
||
|
|
||
|
#endif /* GNU_EFI_IA64_SETJMP_H */
|
||
|
diff --git a/inc/x86_64/efisetjmp_arch.h b/inc/x86_64/efisetjmp_arch.h
|
||
|
index ce4e393..a489993 100644
|
||
|
--- a/inc/x86_64/efisetjmp_arch.h
|
||
|
+++ b/inc/x86_64/efisetjmp_arch.h
|
||
|
@@ -1,6 +1,8 @@
|
||
|
#ifndef GNU_EFI_X86_64_SETJMP_H
|
||
|
#define GNU_EFI_X86_64_SETJMP_H
|
||
|
|
||
|
+#define JMPBUF_ALIGN 8
|
||
|
+
|
||
|
typedef struct {
|
||
|
UINT64 Rbx;
|
||
|
UINT64 Rsp;
|
||
|
@@ -15,6 +17,6 @@ typedef struct {
|
||
|
UINT64 Rip;
|
||
|
UINT64 MxCsr;
|
||
|
UINT8 XmmBuffer[160]; // XMM6 - XMM15
|
||
|
-} __attribute__((__aligned__(8))) jmp_buf;
|
||
|
+} ALIGN(JMPBUF_ALIGN) jmp_buf;
|
||
|
|
||
|
#endif /* GNU_EFI_X86_64_SETJMP_H */
|
||
|
--
|
||
|
2.5.0
|
||
|
|