Skip to content

Commit 0bf019e

Browse files
committed
x86/ptrace: Provide pt_regs helper for entry/exit
As a preparatory step for moving the syscall and interrupt entry/exit handling into generic code, provide a pt_regs helper which retrieves the interrupt state from pt_regs. This is required to check whether interrupts are reenabled by return from interrupt/exception. Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Kees Cook <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent a377ac1 commit 0bf019e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/x86/include/asm/ptrace.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ static inline void user_stack_pointer_set(struct pt_regs *regs,
209209
regs->sp = val;
210210
}
211211

212+
static __always_inline bool regs_irqs_disabled(struct pt_regs *regs)
213+
{
214+
return !(regs->flags & X86_EFLAGS_IF);
215+
}
216+
212217
/* Query offset/name of register from its name/offset */
213218
extern int regs_query_register_offset(const char *name);
214219
extern const char *regs_query_register_name(unsigned int offset);

0 commit comments

Comments
 (0)