1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/arch/unicore32/include/asm/ptrace.h
5 * Code specific to PKUnity SoC and UniCore ISA
7 * Copyright (C) 2001-2010 GUAN Xue-tao
9 #ifndef __UNICORE_PTRACE_H__
10 #define __UNICORE_PTRACE_H__
12 #include <uapi/asm/ptrace.h>
16 #define user_mode(regs) \
17 (processor_mode(regs) == USER_MODE)
19 #define processor_mode(regs) \
20 ((regs)->UCreg_asr & MODE_MASK)
22 #define interrupts_enabled(regs) \
23 (!((regs)->UCreg_asr & PSR_I_BIT))
25 #define fast_interrupts_enabled(regs) \
26 (!((regs)->UCreg_asr & PSR_R_BIT))
28 /* Are the current registers suitable for user mode?
29 * (used to maintain security in signal handlers)
31 static inline int valid_user_regs(struct pt_regs
*regs
)
33 unsigned long mode
= regs
->UCreg_asr
& MODE_MASK
;
36 * Always clear the R (REAL) bits
38 regs
->UCreg_asr
&= ~(PSR_R_BIT
);
40 if ((regs
->UCreg_asr
& PSR_I_BIT
) == 0) {
41 if (mode
== USER_MODE
)
46 * Force ASR to something logical...
48 regs
->UCreg_asr
&= PSR_f
| USER_MODE
;
53 #define instruction_pointer(regs) ((regs)->UCreg_pc)
54 #define user_stack_pointer(regs) ((regs)->UCreg_sp)
55 #define profile_pc(regs) instruction_pointer(regs)
57 #endif /* __ASSEMBLY__ */