blob: a07fa90314d2f773212fa7f82a6049e6d194a21d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_M32R_PTRACE_H
2#define _ASM_M32R_PTRACE_H
3
4/*
5 * linux/include/asm-m32r/ptrace.h
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 * M32R version:
12 * Copyright (C) 2001-2002, 2004 Hirokazu Takata <takata at linux-m32r.org>
13 */
14
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */
16
17/* 0 - 13 are integer registers (general purpose registers). */
18#define PT_R4 0
19#define PT_R5 1
20#define PT_R6 2
21#define PT_REGS 3
22#define PT_R0 4
23#define PT_R1 5
24#define PT_R2 6
25#define PT_R3 7
26#define PT_R7 8
27#define PT_R8 9
28#define PT_R9 10
29#define PT_R10 11
30#define PT_R11 12
31#define PT_R12 13
32#define PT_SYSCNR 14
33#define PT_R13 PT_FP
34#define PT_R14 PT_LR
35#define PT_R15 PT_SP
36
37/* processor status and miscellaneous context registers. */
38#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
39#define PT_ACC0H 15
40#define PT_ACC0L 16
41#define PT_ACC1H 17
42#define PT_ACC1L 18
43#define PT_ACCH PT_ACC0H
44#define PT_ACCL PT_ACC0L
Hirokazu Takata8e8ff022006-04-18 22:21:20 -070045#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
46#define PT_ACCH 15
47#define PT_ACCL 16
48#define PT_DUMMY_ACC1H 17
49#define PT_DUMMY_ACC1L 18
50#else
51#error unknown isa conifiguration
52#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070053#define PT_PSW 19
54#define PT_BPC 20
55#define PT_BBPSW 21
56#define PT_BBPC 22
57#define PT_SPU 23
58#define PT_FP 24
59#define PT_LR 25
60#define PT_SPI 26
61#define PT_ORIGR0 27
Linus Torvalds1da177e2005-04-16 15:20:36 -070062
63/* virtual pt_reg entry for gdb */
64#define PT_PC 30
65#define PT_CBR 31
66#define PT_EVB 32
67
68
69/* Control registers. */
70#define SPR_CR0 PT_PSW
71#define SPR_CR1 PT_CBR /* read only */
72#define SPR_CR2 PT_SPI
73#define SPR_CR3 PT_SPU
74#define SPR_CR4
75#define SPR_CR5 PT_EVB /* part of M32R/E, M32R/I core only */
76#define SPR_CR6 PT_BPC
77#define SPR_CR7
78#define SPR_CR8 PT_BBPSW
79#define SPR_CR9
80#define SPR_CR10
81#define SPR_CR11
82#define SPR_CR12
83#define SPR_CR13 PT_WR
84#define SPR_CR14 PT_BBPC
85#define SPR_CR15
86
87/* this struct defines the way the registers are stored on the
88 stack during a system call. */
89struct pt_regs {
90 /* Saved main processor registers. */
91 unsigned long r4;
92 unsigned long r5;
93 unsigned long r6;
94 struct pt_regs *pt_regs;
95 unsigned long r0;
96 unsigned long r1;
97 unsigned long r2;
98 unsigned long r3;
99 unsigned long r7;
100 unsigned long r8;
101 unsigned long r9;
102 unsigned long r10;
103 unsigned long r11;
104 unsigned long r12;
105 long syscall_nr;
106
107 /* Saved main processor status and miscellaneous context registers. */
108#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
109 unsigned long acc0h;
110 unsigned long acc0l;
111 unsigned long acc1h;
112 unsigned long acc1l;
113#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
114 unsigned long acch;
115 unsigned long accl;
Hirokazu Takata8e8ff022006-04-18 22:21:20 -0700116 unsigned long dummy_acc1h;
117 unsigned long dummy_acc1l;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118#else
119#error unknown isa configuration
120#endif
121 unsigned long psw;
122 unsigned long bpc; /* saved PC for TRAP syscalls */
123 unsigned long bbpsw;
124 unsigned long bbpc;
125 unsigned long spu; /* saved user stack */
126 unsigned long fp;
127 unsigned long lr; /* saved PC for JL syscalls */
128 unsigned long spi; /* saved kernel stack */
129 unsigned long orig_r0;
130};
131
132/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
133#define PTRACE_GETREGS 12
134#define PTRACE_SETREGS 13
135
136#define PTRACE_OLDSETOPTIONS 21
137
138/* options set using PTRACE_SETOPTIONS */
139#define PTRACE_O_TRACESYSGOOD 0x00000001
140
141#ifdef __KERNEL__
Christoph Hellwig481bed42005-11-07 00:59:47 -0800142
143#define __ARCH_SYS_PTRACE 1
144
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145#if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2)
146#define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0)
147#elif defined(CONFIG_ISA_M32R)
148#define user_mode(regs) ((M32R_PSW_BSM & (regs)->psw) != 0)
149#else
150#error unknown isa configuration
151#endif
152
153#define instruction_pointer(regs) ((regs)->bpc)
154#define profile_pc(regs) instruction_pointer(regs)
155
156extern void show_regs(struct pt_regs *);
157
158extern void withdraw_debug_trap(struct pt_regs *regs);
159
Al Viro6c3559fc2006-01-12 01:05:52 -0800160#define task_pt_regs(task) \
161 ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1)
162
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163#endif /* __KERNEL */
164
165#endif /* _ASM_M32R_PTRACE_H */