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 * Kernel stack 17 * 18 * +-----------------------+ -------- STACK_SIZE 19 * | register file | | 20 * +-----------------------+ | 21 * | struct pt_regs | | 22 * +-----------------------+ | ------ PT_REGS_OFFSET 23 * double : 16 bytes spill area : | ^ 24 * excetion :- - - - - - - - - - - -: | | 25 * frame : struct pt_regs : | | 26 * :- - - - - - - - - - - -: | | 27 * | | | | 28 * | memory stack | | | 29 * | | | | 30 * ~ ~ ~ ~ 31 * ~ ~ ~ ~ 32 * | | | | 33 * | | | | 34 * +-----------------------+ | | --- STACK_BIAS 35 * | struct task_struct | | | ^ 36 * current --> +-----------------------+ | | | 37 * | struct thread_info | | | | 38 * +-----------------------+ -------- 39 */ 40 41 #define KERNEL_STACK_SIZE (2 * PAGE_SIZE) 42 43 /* Offsets for exception_handlers[] (3 x 64-entries x 4-byte tables). */ 44 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 54 55 #ifndef __ASSEMBLY__ 56 57 #include <asm/coprocessor.h> 58 59 /* 60 * This struct defines the way the registers are stored on the 61 * kernel stack during a system call or other kernel entry. 62 */ 63 struct pt_regs { 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 */ 81 82 /* Additional configurable registers that are used by the compiler. */ 83 xtregs_opt_t xtregs_opt; 84 85 /* Make sure the areg field is 16 bytes aligned. */ 86 int align[0] __attribute__ ((aligned(16))); 87 88 /* current register frame. 89 * Note: The ESF for kernel exceptions ends after 16 registers! 90 */ 91 unsigned long areg[16]; 92 }; 93 94 #include <variant/core.h> 95 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], \ 102 (regs)->areg[1])) 103 104 # ifndef CONFIG_SMP 105 # define profile_pc(regs) instruction_pointer(regs) 106 # else 107 # define profile_pc(regs) \ 108 ({ \ 109 in_lock_functions(instruction_pointer(regs)) ? \ 110 return_pointer(regs) : instruction_pointer(regs); \ 111 }) 112 # endif 113 114 #define user_stack_pointer(regs) ((regs)->areg[1]) 115 116 #else /* __ASSEMBLY__ */ 117 118 # include <asm/asm-offsets.h> 119 #define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE) 120 121 #endif /* !__ASSEMBLY__ */ 122 123 #endif /* _XTENSA_PTRACE_H */ 124