1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 #ifndef _CRIS_ARCH_PTRACE_H 3 #define _CRIS_ARCH_PTRACE_H 4 5 /* Frame types */ 6 7 #define CRIS_FRAME_NORMAL 0 /* normal frame without SBFS stacking */ 8 #define CRIS_FRAME_BUSFAULT 1 /* frame stacked using SBFS, need RBF return 9 path */ 10 11 /* Register numbers in the ptrace system call interface */ 12 13 #define PT_FRAMETYPE 0 14 #define PT_ORIG_R10 1 15 #define PT_R13 2 16 #define PT_R12 3 17 #define PT_R11 4 18 #define PT_R10 5 19 #define PT_R9 6 20 #define PT_R8 7 21 #define PT_R7 8 22 #define PT_R6 9 23 #define PT_R5 10 24 #define PT_R4 11 25 #define PT_R3 12 26 #define PT_R2 13 27 #define PT_R1 14 28 #define PT_R0 15 29 #define PT_MOF 16 30 #define PT_DCCR 17 31 #define PT_SRP 18 32 #define PT_IRP 19 /* This is actually the debugged process' PC */ 33 #define PT_CSRINSTR 20 /* CPU Status record remnants - 34 valid if frametype == busfault */ 35 #define PT_CSRADDR 21 36 #define PT_CSRDATA 22 37 #define PT_USP 23 /* special case - USP is not in the pt_regs */ 38 #define PT_MAX 23 39 40 /* Condition code bit numbers. The same numbers apply to CCR of course, 41 but we use DCCR everywhere else, so let's try and be consistent. */ 42 #define C_DCCR_BITNR 0 43 #define V_DCCR_BITNR 1 44 #define Z_DCCR_BITNR 2 45 #define N_DCCR_BITNR 3 46 #define X_DCCR_BITNR 4 47 #define I_DCCR_BITNR 5 48 #define B_DCCR_BITNR 6 49 #define M_DCCR_BITNR 7 50 #define U_DCCR_BITNR 8 51 #define P_DCCR_BITNR 9 52 #define F_DCCR_BITNR 10 53 54 /* pt_regs not only specifices the format in the user-struct during 55 * ptrace but is also the frame format used in the kernel prologue/epilogues 56 * themselves 57 */ 58 59 struct pt_regs { 60 unsigned long frametype; /* type of stackframe */ 61 unsigned long orig_r10; 62 /* pushed by movem r13, [sp] in SAVE_ALL, movem pushes backwards */ 63 unsigned long r13; 64 unsigned long r12; 65 unsigned long r11; 66 unsigned long r10; 67 unsigned long r9; 68 unsigned long r8; 69 unsigned long r7; 70 unsigned long r6; 71 unsigned long r5; 72 unsigned long r4; 73 unsigned long r3; 74 unsigned long r2; 75 unsigned long r1; 76 unsigned long r0; 77 unsigned long mof; 78 unsigned long dccr; 79 unsigned long srp; 80 unsigned long irp; /* This is actually the debugged process' PC */ 81 unsigned long csrinstr; 82 unsigned long csraddr; 83 unsigned long csrdata; 84 }; 85 86 /* switch_stack is the extra stuff pushed onto the stack in _resume (entry.S) 87 * when doing a context-switch. it is used (apart from in resume) when a new 88 * thread is made and we need to make _resume (which is starting it for the 89 * first time) realise what is going on. 90 * 91 * Actually, the use is very close to the thread struct (TSS) in that both the 92 * switch_stack and the TSS are used to keep thread stuff when switching in 93 * _resume. 94 */ 95 96 struct switch_stack { 97 unsigned long r9; 98 unsigned long r8; 99 unsigned long r7; 100 unsigned long r6; 101 unsigned long r5; 102 unsigned long r4; 103 unsigned long r3; 104 unsigned long r2; 105 unsigned long r1; 106 unsigned long r0; 107 unsigned long return_ip; /* ip that _resume will return to */ 108 }; 109 110 #ifdef __KERNEL__ 111 112 /* bit 8 is user-mode flag */ 113 #define user_mode(regs) (((regs)->dccr & 0x100) != 0) 114 #define instruction_pointer(regs) ((regs)->irp) 115 #define profile_pc(regs) instruction_pointer(regs) 116 117 #endif /* __KERNEL__ */ 118 119 #endif 120