2 * include/asm-xtensa/ptrace.h
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
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
10 #ifndef _XTENSA_PTRACE_H
11 #define _XTENSA_PTRACE_H
13 #include <uapi/asm/ptrace.h>
18 * +-----------------------+ -------- STACK_SIZE
20 * +-----------------------+ |
21 * | struct pt_regs | |
22 * +-----------------------+ | ------ PT_REGS_OFFSET
23 * double : 16 bytes spill area : | ^
24 * excetion :- - - - - - - - - - - -: | |
25 * frame : struct pt_regs : | |
26 * :- - - - - - - - - - - -: | |
28 * | memory stack | | |
34 * +-----------------------+ | | --- STACK_BIAS
35 * | struct task_struct | | | ^
36 * current --> +-----------------------+ | | |
37 * | struct thread_info | | | |
38 * +-----------------------+ --------
41 #define KERNEL_STACK_SIZE (2 * PAGE_SIZE)
43 /* Offsets for exception_handlers[] (3 x 64-entries x 4-byte tables). */
45 #define EXC_TABLE_KSTK 0x004 /* Kernel Stack */
46 #define EXC_TABLE_DOUBLE_SAVE 0x008 /* Double exception save area for a0 */
47 #define EXC_TABLE_FIXUP 0x00c /* Fixup handler */
48 #define EXC_TABLE_PARAM 0x010 /* For passing a parameter to fixup */
49 #define EXC_TABLE_SYSCALL_SAVE 0x014 /* For fast syscall handler */
50 #define EXC_TABLE_FAST_USER 0x100 /* Fast user exception handler */
51 #define EXC_TABLE_FAST_KERNEL 0x200 /* Fast kernel exception handler */
52 #define EXC_TABLE_DEFAULT 0x300 /* Default C-Handler */
53 #define EXC_TABLE_SIZE 0x400
57 #include <asm/coprocessor.h>
60 * This struct defines the way the registers are stored on the
61 * kernel stack during a system call or other kernel entry.
64 unsigned long pc
; /* 4 */
65 unsigned long ps
; /* 8 */
66 unsigned long depc
; /* 12 */
67 unsigned long exccause
; /* 16 */
68 unsigned long excvaddr
; /* 20 */
69 unsigned long debugcause
; /* 24 */
70 unsigned long wmask
; /* 28 */
71 unsigned long lbeg
; /* 32 */
72 unsigned long lend
; /* 36 */
73 unsigned long lcount
; /* 40 */
74 unsigned long sar
; /* 44 */
75 unsigned long windowbase
; /* 48 */
76 unsigned long windowstart
; /* 52 */
77 unsigned long syscall
; /* 56 */
78 unsigned long icountlevel
; /* 60 */
79 unsigned long scompare1
; /* 64 */
80 unsigned long threadptr
; /* 68 */
82 /* Additional configurable registers that are used by the compiler. */
83 xtregs_opt_t xtregs_opt
;
85 /* Make sure the areg field is 16 bytes aligned. */
86 int align
[0] __attribute__ ((aligned(16)));
88 /* current register frame.
89 * Note: The ESF for kernel exceptions ends after 16 registers!
91 unsigned long areg
[16];
94 #include <variant/core.h>
96 # define arch_has_single_step() (1)
97 # define task_pt_regs(tsk) ((struct pt_regs*) \
98 (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
99 # define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
100 # define instruction_pointer(regs) ((regs)->pc)
101 # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
105 # define profile_pc(regs) instruction_pointer(regs)
107 # define profile_pc(regs) \
109 in_lock_functions(instruction_pointer(regs)) ? \
110 return_pointer(regs) : instruction_pointer(regs); \
114 #define user_stack_pointer(regs) ((regs)->areg[1])
116 #else /* __ASSEMBLY__ */
118 # include <asm/asm-offsets.h>
119 #define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE)
121 #endif /* !__ASSEMBLY__ */
123 #endif /* _XTENSA_PTRACE_H */