Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 1 | #ifndef _ASM_SCORE_PTRACE_H |
| 2 | #define _ASM_SCORE_PTRACE_H |
| 3 | |
Chen Liqin | 0402c91 | 2009-06-19 13:53:49 +0800 | [diff] [blame] | 4 | #define PTRACE_GETREGS 12 |
| 5 | #define PTRACE_SETREGS 13 |
| 6 | |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 7 | #define PC 32 |
| 8 | #define CONDITION 33 |
| 9 | #define ECR 34 |
| 10 | #define EMA 35 |
| 11 | #define CEH 36 |
| 12 | #define CEL 37 |
| 13 | #define COUNTER 38 |
| 14 | #define LDCR 39 |
| 15 | #define STCR 40 |
| 16 | #define PSR 41 |
| 17 | |
| 18 | #define SINGLESTEP16_INSN 0x7006 |
| 19 | #define SINGLESTEP32_INSN 0x840C8000 |
| 20 | #define BREAKPOINT16_INSN 0x7002 /* work on SPG300 */ |
| 21 | #define BREAKPOINT32_INSN 0x84048000 /* work on SPG300 */ |
| 22 | |
| 23 | /* Define instruction mask */ |
| 24 | #define INSN32_MASK 0x80008000 |
| 25 | |
| 26 | #define J32 0x88008000 /* 1_00010_0000000000_1_000000000000000 */ |
| 27 | #define J32M 0xFC008000 /* 1_11111_0000000000_1_000000000000000 */ |
| 28 | |
| 29 | #define B32 0x90008000 /* 1_00100_0000000000_1_000000000000000 */ |
| 30 | #define B32M 0xFC008000 |
| 31 | #define BL32 0x90008001 /* 1_00100_0000000000_1_000000000000001 */ |
| 32 | #define BL32M B32 |
| 33 | #define BR32 0x80008008 /* 1_00000_0000000000_1_00000000_000100_0 */ |
| 34 | #define BR32M 0xFFE0807E |
| 35 | #define BRL32 0x80008009 /* 1_00000_0000000000_1_00000000_000100_1 */ |
| 36 | #define BRL32M BR32M |
| 37 | |
| 38 | #define B32_SET (J32 | B32 | BL32 | BR32 | BRL32) |
| 39 | |
| 40 | #define J16 0x3000 /* 0_011_....... */ |
| 41 | #define J16M 0xF000 |
| 42 | #define B16 0x4000 /* 0_100_....... */ |
| 43 | #define B16M 0xF000 |
| 44 | #define BR16 0x0004 /* 0_000.......0100 */ |
| 45 | #define BR16M 0xF00F |
| 46 | #define B16_SET (J16 | B16 | BR16) |
| 47 | |
| 48 | |
| 49 | /* |
| 50 | * This struct defines the way the registers are stored on the stack during a |
| 51 | * system call/exception. As usual the registers k0/k1 aren't being saved. |
| 52 | */ |
| 53 | struct pt_regs { |
Chen Liqin | ffa818b | 2009-08-30 12:30:16 +0800 | [diff] [blame] | 54 | unsigned long pad0[6]; /* stack arguments */ |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 55 | unsigned long orig_r4; |
| 56 | unsigned long orig_r7; |
Chen Liqin | ffa818b | 2009-08-30 12:30:16 +0800 | [diff] [blame] | 57 | long is_syscall; |
| 58 | |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 59 | unsigned long regs[32]; |
| 60 | |
| 61 | unsigned long cel; |
| 62 | unsigned long ceh; |
| 63 | |
| 64 | unsigned long sr0; /* cnt */ |
| 65 | unsigned long sr1; /* lcr */ |
| 66 | unsigned long sr2; /* scr */ |
| 67 | |
| 68 | unsigned long cp0_epc; |
| 69 | unsigned long cp0_ema; |
| 70 | unsigned long cp0_psr; |
| 71 | unsigned long cp0_ecr; |
| 72 | unsigned long cp0_condition; |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | #ifdef __KERNEL__ |
| 76 | |
Chen Liqin | ffa818b | 2009-08-30 12:30:16 +0800 | [diff] [blame] | 77 | struct task_struct; |
| 78 | |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 79 | /* |
| 80 | * Does the process account for user or for system time? |
| 81 | */ |
| 82 | #define user_mode(regs) ((regs->cp0_psr & 8) == 8) |
| 83 | |
Chen Liqin | 0402c91 | 2009-06-19 13:53:49 +0800 | [diff] [blame] | 84 | #define instruction_pointer(regs) ((unsigned long)(regs)->cp0_epc) |
| 85 | #define profile_pc(regs) instruction_pointer(regs) |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 86 | |
Chen Liqin | 0402c91 | 2009-06-19 13:53:49 +0800 | [diff] [blame] | 87 | extern void do_syscall_trace(struct pt_regs *regs, int entryexit); |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 88 | extern int read_tsk_long(struct task_struct *, unsigned long, unsigned long *); |
Chen Liqin | 0402c91 | 2009-06-19 13:53:49 +0800 | [diff] [blame] | 89 | extern int read_tsk_short(struct task_struct *, unsigned long, |
| 90 | unsigned short *); |
| 91 | |
| 92 | #define arch_has_single_step() (1) |
Christoph Hellwig | dacbe41 | 2010-03-10 15:22:46 -0800 | [diff] [blame] | 93 | |
Chen Liqin | 0402c91 | 2009-06-19 13:53:49 +0800 | [diff] [blame] | 94 | #endif /* __KERNEL__ */ |
Chen Liqin | 6bc9a39 | 2009-06-12 22:01:00 +0800 | [diff] [blame] | 95 | |
| 96 | #endif /* _ASM_SCORE_PTRACE_H */ |