@@ -92,13 +92,20 @@ typedef struct __attribute__((packed)) {
u16 iomap_base;
} tss64_t;
-#define ASM_TRY(catch) \
- "movl $0, %%gs:4 \n\t" \
- ".pushsection .data.ex \n\t" \
+#define __ASM_TRY(prefix, catch) \
+ "movl $0, %%gs:4\n\t" \
+ ".pushsection .data.ex\n\t" \
__ASM_SEL(.long, .quad) " 1111f, " catch "\n\t" \
".popsection \n\t" \
+ prefix "\n\t" \
"1111:"
+#define ASM_TRY(catch) __ASM_TRY("", catch)
+
+/* 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)
+
/*
* selector 32-bit 64-bit
* 0x00 NULL descriptor NULL descriptor
@@ -18,7 +18,6 @@
static int exceptions;
/* Forced emulation prefix, used to invoke the emulator unconditionally. */
-#define KVM_FEP "ud2; .byte 'k', 'v', 'm';"
#define KVM_FEP_LENGTH 5
static int fep_available = 1;
@@ -33,7 +33,6 @@
#define N 1000000
-#define KVM_FEP "ud2; .byte 'k', 'v', 'm';"
// These values match the number of instructions and branches in the
// assembly block in check_emulated_instr().
#define EXPECTED_INSTR 17