2 * linux/arch/unicore32/include/asm/ptrace.h
4 * Code specific to PKUnity SoC and UniCore ISA
6 * Copyright (C) 2001-2010 GUAN Xue-tao
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 #ifndef __UNICORE_PTRACE_H__
13 #define __UNICORE_PTRACE_H__
15 #include <uapi/asm/ptrace.h>
19 #define user_mode(regs) \
20 (processor_mode(regs) == USER_MODE)
22 #define processor_mode(regs) \
23 ((regs)->UCreg_asr & MODE_MASK)
25 #define interrupts_enabled(regs) \
26 (!((regs)->UCreg_asr & PSR_I_BIT))
28 #define fast_interrupts_enabled(regs) \
29 (!((regs)->UCreg_asr & PSR_R_BIT))
31 /* Are the current registers suitable for user mode?
32 * (used to maintain security in signal handlers)
34 static inline int valid_user_regs(struct pt_regs
*regs
)
36 unsigned long mode
= regs
->UCreg_asr
& MODE_MASK
;
39 * Always clear the R (REAL) bits
41 regs
->UCreg_asr
&= ~(PSR_R_BIT
);
43 if ((regs
->UCreg_asr
& PSR_I_BIT
) == 0) {
44 if (mode
== USER_MODE
)
49 * Force ASR to something logical...
51 regs
->UCreg_asr
&= PSR_f
| USER_MODE
;
56 #define instruction_pointer(regs) ((regs)->UCreg_pc)
57 #define user_stack_pointer(regs) ((regs)->UCreg_sp)
58 #define profile_pc(regs) instruction_pointer(regs)
60 #endif /* __ASSEMBLY__ */