xref: /linux/arch/xtensa/include/asm/ptrace.h (revision b889fcf63cb62e7fdb7816565e28f44dbe4a76a5)
1 /*
2  * include/asm-xtensa/ptrace.h
3  *
4  * This file is subject to the terms and conditions of the GNU General Public
5  * License.  See the file "COPYING" in the main directory of this archive
6  * for more details.
7  *
8  * Copyright (C) 2001 - 2005 Tensilica Inc.
9  */
10 #ifndef _XTENSA_PTRACE_H
11 #define _XTENSA_PTRACE_H
12 
13 #include <uapi/asm/ptrace.h>
14 
15 
16 #ifndef __ASSEMBLY__
17 
18 #include <asm/coprocessor.h>
19 
20 /*
21  * This struct defines the way the registers are stored on the
22  * kernel stack during a system call or other kernel entry.
23  */
24 struct pt_regs {
25 	unsigned long pc;		/*   4 */
26 	unsigned long ps;		/*   8 */
27 	unsigned long depc;		/*  12 */
28 	unsigned long exccause;		/*  16 */
29 	unsigned long excvaddr;		/*  20 */
30 	unsigned long debugcause;	/*  24 */
31 	unsigned long wmask;		/*  28 */
32 	unsigned long lbeg;		/*  32 */
33 	unsigned long lend;		/*  36 */
34 	unsigned long lcount;		/*  40 */
35 	unsigned long sar;		/*  44 */
36 	unsigned long windowbase;	/*  48 */
37 	unsigned long windowstart;	/*  52 */
38 	unsigned long syscall;		/*  56 */
39 	unsigned long icountlevel;	/*  60 */
40 	unsigned long scompare1;	/*  64 */
41 
42 	/* Additional configurable registers that are used by the compiler. */
43 	xtregs_opt_t xtregs_opt;
44 
45 	/* Make sure the areg field is 16 bytes aligned. */
46 	int align[0] __attribute__ ((aligned(16)));
47 
48 	/* current register frame.
49 	 * Note: The ESF for kernel exceptions ends after 16 registers!
50 	 */
51 	unsigned long areg[16];		/* 128 (64) */
52 };
53 
54 #include <variant/core.h>
55 
56 # define arch_has_single_step()	(1)
57 # define task_pt_regs(tsk) ((struct pt_regs*) \
58 	(task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
59 # define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
60 # define instruction_pointer(regs) ((regs)->pc)
61 
62 # ifndef CONFIG_SMP
63 #  define profile_pc(regs) instruction_pointer(regs)
64 # endif
65 
66 #else	/* __ASSEMBLY__ */
67 
68 # include <asm/asm-offsets.h>
69 #define PT_REGS_OFFSET	  (KERNEL_STACK_SIZE - PT_USER_SIZE)
70 
71 #endif	/* !__ASSEMBLY__ */
72 
73 #endif	/* _XTENSA_PTRACE_H */
74