@@ -3,6 +3,10 @@
#include "processor.h"
#include <setjmp.h>
+void __set_exception_jmpbuf(jmp_buf *addr);
+#define set_exception_jmpbuf(jmpbuf) \
+ (setjmp(jmpbuf) ? : (__set_exception_jmpbuf(&(jmpbuf)), 0))
+
#ifndef __x86_64__
__attribute__((regparm(1)))
#endif
@@ -1,8 +1,6 @@
#ifndef _X86_DESC_H_
#define _X86_DESC_H_
-#include <setjmp.h>
-
void setup_idt(void);
void setup_alt_stack(void);
@@ -226,9 +224,6 @@ void unhandled_exception(struct ex_regs *regs, bool cpu);
bool test_for_exception(unsigned int ex, void (*trigger_func)(void *data),
void *data);
-void __set_exception_jmpbuf(jmp_buf *addr);
-#define set_exception_jmpbuf(jmpbuf) \
- (setjmp(jmpbuf) ? : (__set_exception_jmpbuf(&(jmpbuf)), 0))
static inline void *get_idt_addr(idt_entry_t *entry)
{
@@ -38,6 +38,7 @@
#include "msr.h"
#include "smp.h"
#include "apic.h"
+#include "setjmp.h"
u64 *bsp_vmxon_region;
struct vmcs *vmcs_root;
Previous desc.h includes setjmp.h, and this causes duplicate definition when compiling with UEFI header efi.h. This is because setjmp() function is defined both in KVM-Unit-Tests and UEFI. When including both desc.h and efi.h, the setjmp() is found in both headers and causes this error. The easy solution is to move setjmp.h from desc.h to desc.c, so including desc.h does not bring in setjmp.h, so that we can include both desc.h and efi.h in lib/x86/setup.c. This commit also includes setjmp.h in x86/vmx.c, because this test case previously assumed setjmp.h is included by desc.h and did not include setjmp.h explicitly. This commit does not change any test case behavior. Signed-off-by: Zixuan Wang <zixuanwang@google.com> --- lib/x86/desc.c | 4 ++++ lib/x86/desc.h | 5 ----- x86/vmx.c | 1 + 3 files changed, 5 insertions(+), 5 deletions(-)