aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-06-14 03:02:47 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-06-14 03:02:47 -0400
commitda28c597996a964a195529595c37f7aacd6dad09 (patch)
treefc16249697efb5bc9bb1863fb02c40b902b2dd7c
parenteaaaeef392cb245e415c31d480ed2d5a466fd88f (diff)
sh: split out ptrace header for _32/_64 variants.
asm/ptrace.h is getting a bit messy, with the _32/_64-specific changes being fairly insular. This splits out the header accordingly. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/include/asm/Kbuild2
-rw-r--r--arch/sh/include/asm/ptrace.h110
-rw-r--r--arch/sh/include/asm/ptrace_32.h83
-rw-r--r--arch/sh/include/asm/ptrace_64.h20
4 files changed, 117 insertions, 98 deletions
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 46cb93477bcb..b4d3462f1dc3 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -8,3 +8,5 @@ unifdef-y += unistd_32.h
8unifdef-y += unistd_64.h 8unifdef-y += unistd_64.h
9unifdef-y += posix_types_32.h 9unifdef-y += posix_types_32.h
10unifdef-y += posix_types_64.h 10unifdef-y += posix_types_64.h
11unifdef-y += ptrace_32.h
12unifdef-y += ptrace_64.h
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
index 33b3f37dcdbb..f6edc10aa0d3 100644
--- a/arch/sh/include/asm/ptrace.h
+++ b/arch/sh/include/asm/ptrace.h
@@ -1,104 +1,9 @@
1#ifndef __ASM_SH_PTRACE_H 1#ifndef __ASM_SH_PTRACE_H
2#define __ASM_SH_PTRACE_H 2#define __ASM_SH_PTRACE_H
3 3
4#include <linux/stringify.h>
5
6/* 4/*
7 * Copyright (C) 1999, 2000 Niibe Yutaka 5 * Copyright (C) 1999, 2000 Niibe Yutaka
8 *
9 */
10#if defined(__SH5__)
11struct pt_regs {
12 unsigned long long pc;
13 unsigned long long sr;
14 long long syscall_nr;
15 unsigned long long regs[63];
16 unsigned long long tregs[8];
17 unsigned long long pad[2];
18};
19
20#define MAX_REG_OFFSET offsetof(struct pt_regs, tregs[7])
21#define regs_return_value(regs) ((regs)->regs[3])
22
23#define TREGS_OFFSET_NAME(num) \
24 {.name = __stringify(tr##num), .offset = offsetof(struct pt_regs, tregs[num])}
25
26#else
27/*
28 * GCC defines register number like this:
29 * -----------------------------
30 * 0 - 15 are integer registers
31 * 17 - 22 are control/special registers
32 * 24 - 39 fp registers
33 * 40 - 47 xd registers
34 * 48 - fpscr register
35 * -----------------------------
36 *
37 * We follows above, except:
38 * 16 --- program counter (PC)
39 * 22 --- syscall #
40 * 23 --- floating point communication register
41 */
42#define REG_REG0 0
43#define REG_REG15 15
44
45#define REG_PC 16
46
47#define REG_PR 17
48#define REG_SR 18
49#define REG_GBR 19
50#define REG_MACH 20
51#define REG_MACL 21
52
53#define REG_SYSCALL 22
54
55#define REG_FPREG0 23
56#define REG_FPREG15 38
57#define REG_XFREG0 39
58#define REG_XFREG15 54
59
60#define REG_FPSCR 55
61#define REG_FPUL 56
62
63/*
64 * This struct defines the way the registers are stored on the
65 * kernel stack during a system call or other kernel entry.
66 */
67struct pt_regs {
68 unsigned long regs[16];
69 unsigned long pc;
70 unsigned long pr;
71 unsigned long sr;
72 unsigned long gbr;
73 unsigned long mach;
74 unsigned long macl;
75 long tra;
76};
77
78#define MAX_REG_OFFSET offsetof(struct pt_regs, tra)
79#define regs_return_value(regs) ((regs)->regs[0])
80
81/*
82 * This struct defines the way the DSP registers are stored on the
83 * kernel stack during a system call or other kernel entry.
84 */ 6 */
85struct pt_dspregs {
86 unsigned long a1;
87 unsigned long a0g;
88 unsigned long a1g;
89 unsigned long m0;
90 unsigned long m1;
91 unsigned long a0;
92 unsigned long x0;
93 unsigned long x1;
94 unsigned long y0;
95 unsigned long y1;
96 unsigned long dsr;
97 unsigned long rs;
98 unsigned long re;
99 unsigned long mod;
100};
101#endif
102 7
103#define PTRACE_GETREGS 12 /* General registers */ 8#define PTRACE_GETREGS 12 /* General registers */
104#define PTRACE_SETREGS 13 9#define PTRACE_SETREGS 13
@@ -119,7 +24,17 @@ struct pt_dspregs {
119#define PT_DATA_ADDR 248 /* &(struct user)->start_data */ 24#define PT_DATA_ADDR 248 /* &(struct user)->start_data */
120#define PT_TEXT_LEN 252 25#define PT_TEXT_LEN 252
121 26
27#if defined(__SH5__) || defined(CONFIG_CPU_SH5)
28#include "ptrace_64.h"
29#else
30#include "ptrace_32.h"
31#endif
32
122#ifdef __KERNEL__ 33#ifdef __KERNEL__
34
35#include <linux/stringify.h>
36#include <linux/stddef.h>
37#include <linux/thread_info.h>
123#include <asm/addrspace.h> 38#include <asm/addrspace.h>
124#include <asm/page.h> 39#include <asm/page.h>
125#include <asm/system.h> 40#include <asm/system.h>
@@ -136,9 +51,6 @@ extern void show_regs(struct pt_regs *);
136/* 51/*
137 * kprobe-based event tracer support 52 * kprobe-based event tracer support
138 */ 53 */
139#include <linux/stddef.h>
140#include <linux/thread_info.h>
141
142struct pt_regs_offset { 54struct pt_regs_offset {
143 const char *name; 55 const char *name;
144 int offset; 56 int offset;
@@ -147,6 +59,8 @@ struct pt_regs_offset {
147#define REG_OFFSET_NAME(r) {.name = #r, .offset = offsetof(struct pt_regs, r)} 59#define REG_OFFSET_NAME(r) {.name = #r, .offset = offsetof(struct pt_regs, r)}
148#define REGS_OFFSET_NAME(num) \ 60#define REGS_OFFSET_NAME(num) \
149 {.name = __stringify(r##num), .offset = offsetof(struct pt_regs, regs[num])} 61 {.name = __stringify(r##num), .offset = offsetof(struct pt_regs, regs[num])}
62#define TREGS_OFFSET_NAME(num) \
63 {.name = __stringify(tr##num), .offset = offsetof(struct pt_regs, tregs[num])}
150#define REG_OFFSET_END {.name = NULL, .offset = 0} 64#define REG_OFFSET_END {.name = NULL, .offset = 0}
151 65
152/* Query offset/name of register from its name/offset */ 66/* Query offset/name of register from its name/offset */
diff --git a/arch/sh/include/asm/ptrace_32.h b/arch/sh/include/asm/ptrace_32.h
new file mode 100644
index 000000000000..35d9e257558c
--- /dev/null
+++ b/arch/sh/include/asm/ptrace_32.h
@@ -0,0 +1,83 @@
1#ifndef __ASM_SH_PTRACE_32_H
2#define __ASM_SH_PTRACE_32_H
3
4/*
5 * GCC defines register number like this:
6 * -----------------------------
7 * 0 - 15 are integer registers
8 * 17 - 22 are control/special registers
9 * 24 - 39 fp registers
10 * 40 - 47 xd registers
11 * 48 - fpscr register
12 * -----------------------------
13 *
14 * We follows above, except:
15 * 16 --- program counter (PC)
16 * 22 --- syscall #
17 * 23 --- floating point communication register
18 */
19#define REG_REG0 0
20#define REG_REG15 15
21
22#define REG_PC 16
23
24#define REG_PR 17
25#define REG_SR 18
26#define REG_GBR 19
27#define REG_MACH 20
28#define REG_MACL 21
29
30#define REG_SYSCALL 22
31
32#define REG_FPREG0 23
33#define REG_FPREG15 38
34#define REG_XFREG0 39
35#define REG_XFREG15 54
36
37#define REG_FPSCR 55
38#define REG_FPUL 56
39
40/*
41 * This struct defines the way the registers are stored on the
42 * kernel stack during a system call or other kernel entry.
43 */
44struct pt_regs {
45 unsigned long regs[16];
46 unsigned long pc;
47 unsigned long pr;
48 unsigned long sr;
49 unsigned long gbr;
50 unsigned long mach;
51 unsigned long macl;
52 long tra;
53};
54
55/*
56 * This struct defines the way the DSP registers are stored on the
57 * kernel stack during a system call or other kernel entry.
58 */
59struct pt_dspregs {
60 unsigned long a1;
61 unsigned long a0g;
62 unsigned long a1g;
63 unsigned long m0;
64 unsigned long m1;
65 unsigned long a0;
66 unsigned long x0;
67 unsigned long x1;
68 unsigned long y0;
69 unsigned long y1;
70 unsigned long dsr;
71 unsigned long rs;
72 unsigned long re;
73 unsigned long mod;
74};
75
76#ifdef __KERNEL__
77
78#define MAX_REG_OFFSET offsetof(struct pt_regs, tra)
79#define regs_return_value(regs) ((regs)->regs[0])
80
81#endif /* __KERNEL__ */
82
83#endif /* __ASM_SH_PTRACE_32_H */
diff --git a/arch/sh/include/asm/ptrace_64.h b/arch/sh/include/asm/ptrace_64.h
new file mode 100644
index 000000000000..d43c1cb0bbe7
--- /dev/null
+++ b/arch/sh/include/asm/ptrace_64.h
@@ -0,0 +1,20 @@
1#ifndef __ASM_SH_PTRACE_64_H
2#define __ASM_SH_PTRACE_64_H
3
4struct pt_regs {
5 unsigned long long pc;
6 unsigned long long sr;
7 long long syscall_nr;
8 unsigned long long regs[63];
9 unsigned long long tregs[8];
10 unsigned long long pad[2];
11};
12
13#ifdef __KERNEL__
14
15#define MAX_REG_OFFSET offsetof(struct pt_regs, tregs[7])
16#define regs_return_value(regs) ((regs)->regs[3])
17
18#endif /* __KERNEL__ */
19
20#endif /* __ASM_SH_PTRACE_64_H */