Greg Ungerer | 230d186 | 2009-03-16 22:07:39 +1000 | [diff] [blame] | 1 | #ifndef _M68K_PTRACE_H |
| 2 | #define _M68K_PTRACE_H |
| 3 | |
| 4 | #define PT_D1 0 |
| 5 | #define PT_D2 1 |
| 6 | #define PT_D3 2 |
| 7 | #define PT_D4 3 |
| 8 | #define PT_D5 4 |
| 9 | #define PT_D6 5 |
| 10 | #define PT_D7 6 |
| 11 | #define PT_A0 7 |
| 12 | #define PT_A1 8 |
| 13 | #define PT_A2 9 |
| 14 | #define PT_A3 10 |
| 15 | #define PT_A4 11 |
| 16 | #define PT_A5 12 |
| 17 | #define PT_A6 13 |
| 18 | #define PT_D0 14 |
| 19 | #define PT_USP 15 |
| 20 | #define PT_ORIG_D0 16 |
| 21 | #define PT_SR 17 |
| 22 | #define PT_PC 18 |
| 23 | |
| 24 | #ifndef __ASSEMBLY__ |
| 25 | |
| 26 | /* this struct defines the way the registers are stored on the |
| 27 | stack during a system call. */ |
| 28 | |
| 29 | struct pt_regs { |
| 30 | long d1; |
| 31 | long d2; |
| 32 | long d3; |
| 33 | long d4; |
| 34 | long d5; |
| 35 | long a0; |
| 36 | long a1; |
| 37 | long a2; |
| 38 | long d0; |
| 39 | long orig_d0; |
| 40 | long stkadj; |
| 41 | #ifdef CONFIG_COLDFIRE |
| 42 | unsigned format : 4; /* frame format specifier */ |
| 43 | unsigned vector : 12; /* vector offset */ |
| 44 | unsigned short sr; |
| 45 | unsigned long pc; |
Sam Ravnborg | 4914802 | 2009-01-16 21:58:10 +1000 | [diff] [blame] | 46 | #else |
Greg Ungerer | 230d186 | 2009-03-16 22:07:39 +1000 | [diff] [blame] | 47 | unsigned short sr; |
| 48 | unsigned long pc; |
| 49 | unsigned format : 4; /* frame format specifier */ |
| 50 | unsigned vector : 12; /* vector offset */ |
Sam Ravnborg | 4914802 | 2009-01-16 21:58:10 +1000 | [diff] [blame] | 51 | #endif |
Greg Ungerer | 230d186 | 2009-03-16 22:07:39 +1000 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | /* |
| 55 | * This is the extended stack used by signal handlers and the context |
| 56 | * switcher: it's pushed after the normal "struct pt_regs". |
| 57 | */ |
| 58 | struct switch_stack { |
| 59 | unsigned long d6; |
| 60 | unsigned long d7; |
| 61 | unsigned long a3; |
| 62 | unsigned long a4; |
| 63 | unsigned long a5; |
| 64 | unsigned long a6; |
| 65 | unsigned long retpc; |
| 66 | }; |
| 67 | |
| 68 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ |
| 69 | #define PTRACE_GETREGS 12 |
| 70 | #define PTRACE_SETREGS 13 |
| 71 | #define PTRACE_GETFPREGS 14 |
| 72 | #define PTRACE_SETFPREGS 15 |
| 73 | |
Maxim Kuvyrkov | 9674cdc | 2009-12-07 00:24:27 -0800 | [diff] [blame] | 74 | #define PTRACE_GET_THREAD_AREA 25 |
| 75 | |
Andreas Schwab | faa47b4 | 2009-05-10 21:14:52 +0200 | [diff] [blame] | 76 | #define PTRACE_SINGLEBLOCK 33 /* resume execution until next branch */ |
| 77 | |
Greg Ungerer | 230d186 | 2009-03-16 22:07:39 +1000 | [diff] [blame] | 78 | #ifdef __KERNEL__ |
| 79 | |
| 80 | #ifndef PS_S |
| 81 | #define PS_S (0x2000) |
| 82 | #define PS_M (0x1000) |
| 83 | #endif |
| 84 | |
| 85 | #define user_mode(regs) (!((regs)->sr & PS_S)) |
| 86 | #define instruction_pointer(regs) ((regs)->pc) |
| 87 | #define profile_pc(regs) instruction_pointer(regs) |
Al Viro | d878d6d | 2012-09-16 12:06:34 -0400 | [diff] [blame] | 88 | #define current_pt_regs() \ |
| 89 | (struct pt_regs *)((char *)current_thread_info() + THREAD_SIZE) - 1 |
Andreas Schwab | faa47b4 | 2009-05-10 21:14:52 +0200 | [diff] [blame] | 90 | |
Andreas Schwab | faa47b4 | 2009-05-10 21:14:52 +0200 | [diff] [blame] | 91 | #define arch_has_single_step() (1) |
Andreas Schwab | faa47b4 | 2009-05-10 21:14:52 +0200 | [diff] [blame] | 92 | |
Greg Ungerer | f60a557 | 2009-07-07 15:54:54 +1000 | [diff] [blame] | 93 | #ifdef CONFIG_MMU |
Andreas Schwab | faa47b4 | 2009-05-10 21:14:52 +0200 | [diff] [blame] | 94 | #define arch_has_block_step() (1) |
Andreas Schwab | faa47b4 | 2009-05-10 21:14:52 +0200 | [diff] [blame] | 95 | #endif |
| 96 | |
Greg Ungerer | 230d186 | 2009-03-16 22:07:39 +1000 | [diff] [blame] | 97 | #endif /* __KERNEL__ */ |
| 98 | #endif /* __ASSEMBLY__ */ |
| 99 | #endif /* _M68K_PTRACE_H */ |