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