aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/entry/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/entry/common.c')
-rw-r--r--arch/x86/entry/common.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index 19f650d729f5..8e5498be76bd 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -295,6 +295,34 @@ __visible void do_syscall_64(unsigned long nr, struct pt_regs *regs)
syscall_return_slowpath(regs);
}
+
+#ifdef CONFIG_TRACE_IRQFLAGS
+extern void trace_hardirqs_on_caller(unsigned long caller_addr);
+__visible void trace_hardirqs_on_caller_cr2(unsigned long caller_addr)
+{
+ unsigned long address = read_cr2(); /* Get the faulting address */
+ enum ctx_state prev_state;
+
+ prev_state = exception_enter();
+ trace_hardirqs_on_caller(caller_addr);
+ if (address != read_cr2())
+ write_cr2(address);
+ exception_exit(prev_state);
+}
+
+extern void trace_hardirqs_off_caller(unsigned long caller_addr);
+__visible void trace_hardirqs_off_caller_cr2(unsigned long caller_addr)
+{
+ unsigned long address = read_cr2(); /* Get the faulting address */
+ enum ctx_state prev_state;
+
+ prev_state = exception_enter();
+ trace_hardirqs_off_caller(caller_addr);
+ if (address != read_cr2())
+ write_cr2(address);
+ exception_exit(prev_state);
+}
+#endif
#endif
#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)