blob: 4336083ea8632b019456d23e8837477d8e14fade [file] [log] [blame]
Macpaul Lin0b9b59a2011-10-11 22:33:15 +00001/*
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
26struct 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 */
41 NDS32_REG fp; /* r28 */
42 NDS32_REG gp; /* r29 */
43 NDS32_REG lp; /* r30 */
44 NDS32_REG fucop_ctl;
45 NDS32_REG osp;
46};
47
48#define processor_mode(regs) \
49 (((regs)->ipsw & MODE_MASK) >> 3)
50
51#define interrupts_enabled(regs) \
52 ((regs)->ipsw & GIE_BIT)
53
54/*
55 * Offsets used by 'ptrace' system call interface.
56 * These can't be changed without breaking binary compatibility
57 * with MkLinux, etc.
58 */
59#define PT_R0 0
60#define PT_R1 1
61#define PT_R2 2
62#define PT_R3 3
63#define PT_R4 4
64#define PT_R5 5
65#define PT_R6 6
66#define PT_R7 7
67#define PT_R8 8
68#define PT_R9 9
69#define PT_R10 10
70#define PT_R11 11
71#define PT_R12 12
72#define PT_R13 13
73#define PT_R14 14
74#define PT_R15 15
75#define PT_R16 16
76#define PT_R17 17
77#define PT_R18 18
78#define PT_R19 19
79#define PT_R20 20
80#define PT_R21 21
81#define PT_R22 22
82#define PT_R23 23
83#define PT_R24 24
84#define PT_R25 25
85
86#endif /* __ASSEMBLY__ */
87
88#endif /* __ASM_NDS_PTRACE_H */