Macpaul Lin | 00f892f | 2011-10-11 22:33:15 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 Andes Technology Corporation |
| 3 | * Copyright (C) 2010 Shawn Lin (nobuhiro@andestech.com) |
| 4 | * Copyright (C) 2011 Macpaul Lin (macpaul@andestech.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | #ifndef __ASM_NDS_PTRACE_H |
| 11 | #define __ASM_NDS_PTRACE_H |
| 12 | |
| 13 | #define USR_MODE 0x00 |
| 14 | #define SU_MODE 0x01 |
| 15 | #define HV_MODE 0x10 |
| 16 | #define MODE_MASK (0x03<<3) |
| 17 | #define GIE_BIT 0x01 |
| 18 | |
| 19 | #ifndef __ASSEMBLY__ |
| 20 | |
| 21 | /* this struct defines the way the registers are stored on the |
| 22 | stack during a system call. */ |
| 23 | |
| 24 | #define NDS32_REG long |
| 25 | |
| 26 | struct pt_regs { |
| 27 | NDS32_REG ir0; |
| 28 | NDS32_REG ipsw; |
| 29 | NDS32_REG ipc; |
| 30 | NDS32_REG sp; |
| 31 | NDS32_REG orig_r0; |
| 32 | NDS32_REG pipsw; |
| 33 | NDS32_REG pipc; |
| 34 | NDS32_REG pp0; |
| 35 | NDS32_REG pp1; |
| 36 | NDS32_REG d0hi; |
| 37 | NDS32_REG d0lo; |
| 38 | NDS32_REG d1hi; |
| 39 | NDS32_REG d1lo; |
| 40 | NDS32_REG r[26]; /* r0 - r25 */ |
Macpaul Lin | b0c4fae | 2012-03-11 16:30:18 +0800 | [diff] [blame] | 41 | NDS32_REG p0; /* r26 - used by OS */ |
| 42 | NDS32_REG p1; /* r27 - used by OS */ |
Macpaul Lin | 00f892f | 2011-10-11 22:33:15 +0000 | [diff] [blame] | 43 | NDS32_REG fp; /* r28 */ |
| 44 | NDS32_REG gp; /* r29 */ |
| 45 | NDS32_REG lp; /* r30 */ |
| 46 | NDS32_REG fucop_ctl; |
| 47 | NDS32_REG osp; |
| 48 | }; |
| 49 | |
| 50 | #define processor_mode(regs) \ |
| 51 | (((regs)->ipsw & MODE_MASK) >> 3) |
| 52 | |
| 53 | #define interrupts_enabled(regs) \ |
| 54 | ((regs)->ipsw & GIE_BIT) |
| 55 | |
| 56 | /* |
| 57 | * Offsets used by 'ptrace' system call interface. |
| 58 | * These can't be changed without breaking binary compatibility |
| 59 | * with MkLinux, etc. |
| 60 | */ |
| 61 | #define PT_R0 0 |
| 62 | #define PT_R1 1 |
| 63 | #define PT_R2 2 |
| 64 | #define PT_R3 3 |
| 65 | #define PT_R4 4 |
| 66 | #define PT_R5 5 |
| 67 | #define PT_R6 6 |
| 68 | #define PT_R7 7 |
| 69 | #define PT_R8 8 |
| 70 | #define PT_R9 9 |
| 71 | #define PT_R10 10 |
| 72 | #define PT_R11 11 |
| 73 | #define PT_R12 12 |
| 74 | #define PT_R13 13 |
| 75 | #define PT_R14 14 |
| 76 | #define PT_R15 15 |
| 77 | #define PT_R16 16 |
| 78 | #define PT_R17 17 |
| 79 | #define PT_R18 18 |
| 80 | #define PT_R19 19 |
| 81 | #define PT_R20 20 |
| 82 | #define PT_R21 21 |
| 83 | #define PT_R22 22 |
| 84 | #define PT_R23 23 |
| 85 | #define PT_R24 24 |
| 86 | #define PT_R25 25 |
| 87 | |
| 88 | #endif /* __ASSEMBLY__ */ |
| 89 | |
| 90 | #endif /* __ASM_NDS_PTRACE_H */ |