summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-02-25 23:16:21 +0100
committerThomas Gleixner <tglx@linutronix.de>2020-05-05 11:27:58 +0200
commit08731dacb88a5cb30950acb2ca143a1e48d53236 (patch)
tree3ff4f4e93208a273bdbb383fbbb6b7bc2d43ca62
parent2cb2549a9ebfe189bb492dead84e0bc7af588155 (diff)
x86/entry: Provide IDTENTRY_ERRORCODE
Same as IDTENTRY but the C entry point has an error code argument. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/include/asm/idtentry.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/x86/include/asm/idtentry.h b/arch/x86/include/asm/idtentry.h
index 765d550e44e9..74c85d8b2408 100644
--- a/arch/x86/include/asm/idtentry.h
+++ b/arch/x86/include/asm/idtentry.h
@@ -57,6 +57,49 @@ __visible noinstr void func(struct pt_regs *regs) \
\
static __always_inline void __##func(struct pt_regs *regs)
+/**
+ * DECLARE_IDTENTRY_ERRORCODE - Declare functions for simple IDT entry points
+ * Error code pushed by hardware
+ * @vector: Vector number (ignored for C)
+ * @func: Function name of the entry point
+ *
+ * Declares three functions:
+ * - The ASM entry point: asm_##func
+ * - The XEN PV trap entry point: xen_##func (maybe unused)
+ * - The C handler called from the ASM entry point
+ *
+ * Same as DECLARE_IDTENTRY, but has an extra error_code argument for the
+ * C-handler.
+ */
+#define DECLARE_IDTENTRY_ERRORCODE(vector, func) \
+ asmlinkage void asm_##func(void); \
+ asmlinkage void xen_asm_##func(void); \
+ __visible void func(struct pt_regs *regs, unsigned long error_code)
+
+/**
+ * DEFINE_IDTENTRY_ERRORCODE - Emit code for simple IDT entry points
+ * Error code pushed by hardware
+ * @func: Function name of the entry point
+ *
+ * Same as DEFINE_IDTENTRY, but has an extra error_code argument
+ */
+#define DEFINE_IDTENTRY_ERRORCODE(func) \
+static __always_inline void __##func(struct pt_regs *regs, \
+ unsigned long error_code); \
+ \
+__visible noinstr void func(struct pt_regs *regs, \
+ unsigned long error_code) \
+{ \
+ idtentry_enter(regs); \
+ instr_begin(); \
+ __##func (regs, error_code); \
+ instr_end(); \
+ idtentry_exit(regs); \
+} \
+ \
+static __always_inline void __##func(struct pt_regs *regs, \
+ unsigned long error_code)
+
#else /* !__ASSEMBLY__ */
/*
@@ -65,6 +108,9 @@ static __always_inline void __##func(struct pt_regs *regs)
#define DECLARE_IDTENTRY(vector, func) \
idtentry vector asm_##func func has_error_code=0 sane=1
+#define DECLARE_IDTENTRY_ERRORCODE(vector, func) \
+ idtentry vector asm_##func func has_error_code=1 sane=1
+
#endif /* __ASSEMBLY__ */
/*