1 /* 2 * Copyright (C) 1998-2004 Hewlett-Packard Co 3 * David Mosberger-Tang <davidm@hpl.hp.com> 4 * Stephane Eranian <eranian@hpl.hp.com> 5 * Copyright (C) 2003 Intel Co 6 * Suresh Siddha <suresh.b.siddha@intel.com> 7 * Fenghua Yu <fenghua.yu@intel.com> 8 * Arun Sharma <arun.sharma@intel.com> 9 * 10 * 12/07/98 S. Eranian added pt_regs & switch_stack 11 * 12/21/98 D. Mosberger updated to match latest code 12 * 6/17/99 D. Mosberger added second unat member to "struct switch_stack" 13 * 14 */ 15 #ifndef _UAPI_ASM_IA64_PTRACE_H 16 #define _UAPI_ASM_IA64_PTRACE_H 17 18 /* 19 * When a user process is blocked, its state looks as follows: 20 * 21 * +----------------------+ ------- IA64_STK_OFFSET 22 * | | ^ 23 * | struct pt_regs | | 24 * | | | 25 * +----------------------+ | 26 * | | | 27 * | memory stack | | 28 * | (growing downwards) | | 29 * //.....................// | 30 * | 31 * //.....................// | 32 * | | | 33 * +----------------------+ | 34 * | struct switch_stack | | 35 * | | | 36 * +----------------------+ | 37 * | | | 38 * //.....................// | 39 * | 40 * //.....................// | 41 * | | | 42 * | register stack | | 43 * | (growing upwards) | | 44 * | | | 45 * +----------------------+ | --- IA64_RBS_OFFSET 46 * | struct thread_info | | ^ 47 * +----------------------+ | | 48 * | | | | 49 * | struct task_struct | | | 50 * current -> | | | | 51 * +----------------------+ ------- 52 * 53 * Note that ar.ec is not saved explicitly in pt_reg or switch_stack. 54 * This is because ar.ec is saved as part of ar.pfs. 55 */ 56 57 58 #include <asm/fpu.h> 59 60 61 #ifndef __ASSEMBLY__ 62 63 /* 64 * This struct defines the way the registers are saved on system 65 * calls. 66 * 67 * We don't save all floating point register because the kernel 68 * is compiled to use only a very small subset, so the other are 69 * untouched. 70 * 71 * THIS STRUCTURE MUST BE A MULTIPLE 16-BYTE IN SIZE 72 * (because the memory stack pointer MUST ALWAYS be aligned this way) 73 * 74 */ 75 struct pt_regs { 76 /* The following registers are saved by SAVE_MIN: */ 77 unsigned long b6; /* scratch */ 78 unsigned long b7; /* scratch */ 79 80 unsigned long ar_csd; /* used by cmp8xchg16 (scratch) */ 81 unsigned long ar_ssd; /* reserved for future use (scratch) */ 82 83 unsigned long r8; /* scratch (return value register 0) */ 84 unsigned long r9; /* scratch (return value register 1) */ 85 unsigned long r10; /* scratch (return value register 2) */ 86 unsigned long r11; /* scratch (return value register 3) */ 87 88 unsigned long cr_ipsr; /* interrupted task's psr */ 89 unsigned long cr_iip; /* interrupted task's instruction pointer */ 90 /* 91 * interrupted task's function state; if bit 63 is cleared, it 92 * contains syscall's ar.pfs.pfm: 93 */ 94 unsigned long cr_ifs; 95 96 unsigned long ar_unat; /* interrupted task's NaT register (preserved) */ 97 unsigned long ar_pfs; /* prev function state */ 98 unsigned long ar_rsc; /* RSE configuration */ 99 /* The following two are valid only if cr_ipsr.cpl > 0 || ti->flags & _TIF_MCA_INIT */ 100 unsigned long ar_rnat; /* RSE NaT */ 101 unsigned long ar_bspstore; /* RSE bspstore */ 102 103 unsigned long pr; /* 64 predicate registers (1 bit each) */ 104 unsigned long b0; /* return pointer (bp) */ 105 unsigned long loadrs; /* size of dirty partition << 16 */ 106 107 unsigned long r1; /* the gp pointer */ 108 unsigned long r12; /* interrupted task's memory stack pointer */ 109 unsigned long r13; /* thread pointer */ 110 111 unsigned long ar_fpsr; /* floating point status (preserved) */ 112 unsigned long r15; /* scratch */ 113 114 /* The remaining registers are NOT saved for system calls. */ 115 116 unsigned long r14; /* scratch */ 117 unsigned long r2; /* scratch */ 118 unsigned long r3; /* scratch */ 119 120 /* The following registers are saved by SAVE_REST: */ 121 unsigned long r16; /* scratch */ 122 unsigned long r17; /* scratch */ 123 unsigned long r18; /* scratch */ 124 unsigned long r19; /* scratch */ 125 unsigned long r20; /* scratch */ 126 unsigned long r21; /* scratch */ 127 unsigned long r22; /* scratch */ 128 unsigned long r23; /* scratch */ 129 unsigned long r24; /* scratch */ 130 unsigned long r25; /* scratch */ 131 unsigned long r26; /* scratch */ 132 unsigned long r27; /* scratch */ 133 unsigned long r28; /* scratch */ 134 unsigned long r29; /* scratch */ 135 unsigned long r30; /* scratch */ 136 unsigned long r31; /* scratch */ 137 138 unsigned long ar_ccv; /* compare/exchange value (scratch) */ 139 140 /* 141 * Floating point registers that the kernel considers scratch: 142 */ 143 struct ia64_fpreg f6; /* scratch */ 144 struct ia64_fpreg f7; /* scratch */ 145 struct ia64_fpreg f8; /* scratch */ 146 struct ia64_fpreg f9; /* scratch */ 147 struct ia64_fpreg f10; /* scratch */ 148 struct ia64_fpreg f11; /* scratch */ 149 }; 150 151 /* 152 * This structure contains the addition registers that need to 153 * preserved across a context switch. This generally consists of 154 * "preserved" registers. 155 */ 156 struct switch_stack { 157 unsigned long caller_unat; /* user NaT collection register (preserved) */ 158 unsigned long ar_fpsr; /* floating-point status register */ 159 160 struct ia64_fpreg f2; /* preserved */ 161 struct ia64_fpreg f3; /* preserved */ 162 struct ia64_fpreg f4; /* preserved */ 163 struct ia64_fpreg f5; /* preserved */ 164 165 struct ia64_fpreg f12; /* scratch, but untouched by kernel */ 166 struct ia64_fpreg f13; /* scratch, but untouched by kernel */ 167 struct ia64_fpreg f14; /* scratch, but untouched by kernel */ 168 struct ia64_fpreg f15; /* scratch, but untouched by kernel */ 169 struct ia64_fpreg f16; /* preserved */ 170 struct ia64_fpreg f17; /* preserved */ 171 struct ia64_fpreg f18; /* preserved */ 172 struct ia64_fpreg f19; /* preserved */ 173 struct ia64_fpreg f20; /* preserved */ 174 struct ia64_fpreg f21; /* preserved */ 175 struct ia64_fpreg f22; /* preserved */ 176 struct ia64_fpreg f23; /* preserved */ 177 struct ia64_fpreg f24; /* preserved */ 178 struct ia64_fpreg f25; /* preserved */ 179 struct ia64_fpreg f26; /* preserved */ 180 struct ia64_fpreg f27; /* preserved */ 181 struct ia64_fpreg f28; /* preserved */ 182 struct ia64_fpreg f29; /* preserved */ 183 struct ia64_fpreg f30; /* preserved */ 184 struct ia64_fpreg f31; /* preserved */ 185 186 unsigned long r4; /* preserved */ 187 unsigned long r5; /* preserved */ 188 unsigned long r6; /* preserved */ 189 unsigned long r7; /* preserved */ 190 191 unsigned long b0; /* so we can force a direct return in copy_thread */ 192 unsigned long b1; 193 unsigned long b2; 194 unsigned long b3; 195 unsigned long b4; 196 unsigned long b5; 197 198 unsigned long ar_pfs; /* previous function state */ 199 unsigned long ar_lc; /* loop counter (preserved) */ 200 unsigned long ar_unat; /* NaT bits for r4-r7 */ 201 unsigned long ar_rnat; /* RSE NaT collection register */ 202 unsigned long ar_bspstore; /* RSE dirty base (preserved) */ 203 unsigned long pr; /* 64 predicate registers (1 bit each) */ 204 }; 205 206 207 /* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */ 208 struct pt_all_user_regs { 209 unsigned long nat; 210 unsigned long cr_iip; 211 unsigned long cfm; 212 unsigned long cr_ipsr; 213 unsigned long pr; 214 215 unsigned long gr[32]; 216 unsigned long br[8]; 217 unsigned long ar[128]; 218 struct ia64_fpreg fr[128]; 219 }; 220 221 #endif /* !__ASSEMBLY__ */ 222 223 /* indices to application-registers array in pt_all_user_regs */ 224 #define PT_AUR_RSC 16 225 #define PT_AUR_BSP 17 226 #define PT_AUR_BSPSTORE 18 227 #define PT_AUR_RNAT 19 228 #define PT_AUR_CCV 32 229 #define PT_AUR_UNAT 36 230 #define PT_AUR_FPSR 40 231 #define PT_AUR_PFS 64 232 #define PT_AUR_LC 65 233 #define PT_AUR_EC 66 234 235 /* 236 * The numbers chosen here are somewhat arbitrary but absolutely MUST 237 * not overlap with any of the number assigned in <linux/ptrace.h>. 238 */ 239 #define PTRACE_SINGLEBLOCK 12 /* resume execution until next branch */ 240 #define PTRACE_OLD_GETSIGINFO 13 /* (replaced by PTRACE_GETSIGINFO in <linux/ptrace.h>) */ 241 #define PTRACE_OLD_SETSIGINFO 14 /* (replaced by PTRACE_SETSIGINFO in <linux/ptrace.h>) */ 242 #define PTRACE_GETREGS 18 /* get all registers (pt_all_user_regs) in one shot */ 243 #define PTRACE_SETREGS 19 /* set all registers (pt_all_user_regs) in one shot */ 244 245 #define PTRACE_OLDSETOPTIONS 21 246 247 #endif /* _UAPI_ASM_IA64_PTRACE_H */ 248