diff options
author | Peter Zijlstra <peterz@infradead.org> | 2021-11-10 11:01:20 +0100 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2021-12-11 09:09:49 +0100 |
commit | 5ce8e39f55521c762f0e6d1bba9597284b1f2e69 (patch) | |
tree | e7986c4b43cd54721e3d3f461a6c4b5ff8867499 /arch/x86/mm | |
parent | fedb24cda1ca5407e1965b261e349ea85d6c03dc (diff) |
x86/sgx: Remove .fixup usage
Create EX_TYPE_FAULT_SGX which does as EX_TYPE_FAULT does, except adds
this extra bit that SGX really fancies having.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20211110101325.961246679@infradead.org
Diffstat (limited to 'arch/x86/mm')
-rw-r--r-- | arch/x86/mm/extable.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c index 717cd35fe41c..c869f43e8a2e 100644 --- a/arch/x86/mm/extable.c +++ b/arch/x86/mm/extable.c @@ -10,6 +10,7 @@ #include <asm/traps.h> #include <asm/kdebug.h> #include <asm/insn-eval.h> +#include <asm/sgx.h> static inline unsigned long *pt_regs_nr(struct pt_regs *regs, int nr) { @@ -47,6 +48,13 @@ static bool ex_handler_fault(const struct exception_table_entry *fixup, return ex_handler_default(fixup, regs); } +static bool ex_handler_sgx(const struct exception_table_entry *fixup, + struct pt_regs *regs, int trapnr) +{ + regs->ax = trapnr | SGX_ENCLS_FAULT_FLAG; + return ex_handler_default(fixup, regs); +} + /* * Handler for when we fail to restore a task's FPU state. We should never get * here because the FPU state of a task using the FPU (task->thread.fpu.state) @@ -207,6 +215,8 @@ int fixup_exception(struct pt_regs *regs, int trapnr, unsigned long error_code, return ex_handler_pop_zero(e, regs); case EX_TYPE_IMM_REG: return ex_handler_imm_reg(e, regs, reg, imm); + case EX_TYPE_FAULT_SGX: + return ex_handler_sgx(e, regs, trapnr); } BUG(); } |