@@ -81,21 +81,25 @@ typedef struct __attribute__((packed)) {
} tss64_t;
#ifdef __x86_64
-#define ASM_TRY(catch) \
+#define __ASM_TRY(prefix, catch) \
"movl $0, %%gs:4 \n\t" \
".pushsection .data.ex \n\t" \
".quad 1111f, " catch "\n\t" \
".popsection \n\t" \
+ prefix \
"1111:"
#else
-#define ASM_TRY(catch) \
+#define __ASM_TRY(prefix, catch) \
"movl $0, %%gs:4 \n\t" \
".pushsection .data.ex \n\t" \
".long 1111f, " catch "\n\t" \
".popsection \n\t" \
+ prefix \
"1111:"
#endif
+#define ASM_TRY(catch) __ASM_TRY("", catch)
+
/*
* selector 32-bit 64-bit
* 0x00 NULL descriptor NULL descriptor
@@ -19,6 +19,7 @@ static int exceptions;
/* Forced emulation prefix, used to invoke the emulator unconditionally. */
#define KVM_FEP "ud2; .byte 'k', 'v', 'm';"
+#define ASM_TRY_FEP(catch) __ASM_TRY(KVM_FEP, catch)
struct regs {
u64 rax, rbx, rcx, rdx;