Commit c9a34c3f authored by Peter Zijlstra's avatar Peter Zijlstra

x86/kvm: Remove .fixup usage

KVM instruction emulation has a gnarly hack where the .fixup does a
return, however there's already a ret right after the 10b label, so
mark that as 11 and have the exception clear %esi to remove the
.fixup.
Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20211110101325.722157053@infradead.org
parent 5fc77b91
...@@ -46,5 +46,6 @@ ...@@ -46,5 +46,6 @@
#define EX_TYPE_IMM_REG 17 /* reg := (long)imm */ #define EX_TYPE_IMM_REG 17 /* reg := (long)imm */
#define EX_TYPE_EFAULT_REG (EX_TYPE_IMM_REG | EX_DATA_IMM(-EFAULT)) #define EX_TYPE_EFAULT_REG (EX_TYPE_IMM_REG | EX_DATA_IMM(-EFAULT))
#define EX_TYPE_ZERO_REG (EX_TYPE_IMM_REG | EX_DATA_IMM(0)) #define EX_TYPE_ZERO_REG (EX_TYPE_IMM_REG | EX_DATA_IMM(0))
#define EX_TYPE_ONE_REG (EX_TYPE_IMM_REG | EX_DATA_IMM(1))
#endif #endif
...@@ -315,7 +315,7 @@ static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop); ...@@ -315,7 +315,7 @@ static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop);
__FOP_FUNC(#name) __FOP_FUNC(#name)
#define __FOP_RET(name) \ #define __FOP_RET(name) \
ASM_RET \ "11: " ASM_RET \
".size " name ", .-" name "\n\t" ".size " name ", .-" name "\n\t"
#define FOP_RET(name) \ #define FOP_RET(name) \
...@@ -344,7 +344,7 @@ static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop); ...@@ -344,7 +344,7 @@ static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop);
__FOP_RET(#op "_" #dst) __FOP_RET(#op "_" #dst)
#define FOP1EEX(op, dst) \ #define FOP1EEX(op, dst) \
FOP1E(op, dst) _ASM_EXTABLE(10b, kvm_fastop_exception) FOP1E(op, dst) _ASM_EXTABLE_TYPE_REG(10b, 11b, EX_TYPE_ZERO_REG, %%esi)
#define FASTOP1(op) \ #define FASTOP1(op) \
FOP_START(op) \ FOP_START(op) \
...@@ -434,10 +434,6 @@ static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop); ...@@ -434,10 +434,6 @@ static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop);
#op " %al \n\t" \ #op " %al \n\t" \
__FOP_RET(#op) __FOP_RET(#op)
asm(".pushsection .fixup, \"ax\"\n"
"kvm_fastop_exception: xor %esi, %esi; " ASM_RET
".popsection");
FOP_START(setcc) FOP_START(setcc)
FOP_SETCC(seto) FOP_SETCC(seto)
FOP_SETCC(setno) FOP_SETCC(setno)
...@@ -473,12 +469,8 @@ FOP_END; ...@@ -473,12 +469,8 @@ FOP_END;
\ \
asm volatile("1:" insn "\n" \ asm volatile("1:" insn "\n" \
"2:\n" \ "2:\n" \
".pushsection .fixup, \"ax\"\n" \ _ASM_EXTABLE_TYPE_REG(1b, 2b, EX_TYPE_ONE_REG, %[_fault]) \
"3: movl $1, %[_fault]\n" \ : [_fault] "+r"(_fault) inoutclob ); \
" jmp 2b\n" \
".popsection\n" \
_ASM_EXTABLE(1b, 3b) \
: [_fault] "+qm"(_fault) inoutclob ); \
\ \
_fault ? X86EMUL_UNHANDLEABLE : X86EMUL_CONTINUE; \ _fault ? X86EMUL_UNHANDLEABLE : X86EMUL_CONTINUE; \
}) })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment