aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/include
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2008-09-18 03:50:26 -0400
committerTony Luck <tony.luck@intel.com>2008-10-06 13:45:29 -0400
commit680973edf122fd95735ecfc077cf79645d2e5081 (patch)
tree8023bf84c6e856f616215082d05bb91ec8e1b620 /arch/ia64/include
parent9690ad031290d86979b284bd6243313f58271bcc (diff)
[IA64] utrace Convert compat ptrace to use compat_sys_ptrace
Convert IA64 32-bit ptrace to use compat_sys_ptrace. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/include')
-rw-r--r--arch/ia64/include/asm/ptrace.h2
-rw-r--r--arch/ia64/include/asm/syscall.h89
2 files changed, 82 insertions, 9 deletions
diff --git a/arch/ia64/include/asm/ptrace.h b/arch/ia64/include/asm/ptrace.h
index 14055c636adf..6417c1ecb44e 100644
--- a/arch/ia64/include/asm/ptrace.h
+++ b/arch/ia64/include/asm/ptrace.h
@@ -325,6 +325,8 @@ static inline unsigned long user_stack_pointer(struct pt_regs *regs)
325 #define arch_has_block_step() (1) 325 #define arch_has_block_step() (1)
326 extern void user_enable_block_step(struct task_struct *); 326 extern void user_enable_block_step(struct task_struct *);
327 327
328#define __ARCH_WANT_COMPAT_SYS_PTRACE
329
328#endif /* !__KERNEL__ */ 330#endif /* !__KERNEL__ */
329 331
330/* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */ 332/* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */
diff --git a/arch/ia64/include/asm/syscall.h b/arch/ia64/include/asm/syscall.h
index 3fd4fa6c48dd..2f758a42f94b 100644
--- a/arch/ia64/include/asm/syscall.h
+++ b/arch/ia64/include/asm/syscall.h
@@ -19,24 +19,35 @@
19static inline long syscall_get_nr(struct task_struct *task, 19static inline long syscall_get_nr(struct task_struct *task,
20 struct pt_regs *regs) 20 struct pt_regs *regs)
21{ 21{
22 BUG_ON(IS_IA32_PROCESS(regs));
23
24 if ((long)regs->cr_ifs < 0) /* Not a syscall */ 22 if ((long)regs->cr_ifs < 0) /* Not a syscall */
25 return -1; 23 return -1;
24
25#ifdef CONFIG_IA32_SUPPORT
26 if (IS_IA32_PROCESS(regs))
27 return regs->r1;
28#endif
29
26 return regs->r15; 30 return regs->r15;
27} 31}
28 32
29static inline void syscall_rollback(struct task_struct *task, 33static inline void syscall_rollback(struct task_struct *task,
30 struct pt_regs *regs) 34 struct pt_regs *regs)
31{ 35{
32 BUG_ON(IS_IA32_PROCESS(regs)); 36#ifdef CONFIG_IA32_SUPPORT
37 if (IS_IA32_PROCESS(regs))
38 regs->r8 = regs->r1;
39#endif
40
33 /* do nothing */ 41 /* do nothing */
34} 42}
35 43
36static inline long syscall_get_error(struct task_struct *task, 44static inline long syscall_get_error(struct task_struct *task,
37 struct pt_regs *regs) 45 struct pt_regs *regs)
38{ 46{
39 BUG_ON(IS_IA32_PROCESS(regs)); 47#ifdef CONFIG_IA32_SUPPORT
48 if (IS_IA32_PROCESS(regs))
49 return regs->r8;
50#endif
40 51
41 return regs->r10 == -1 ? regs->r8:0; 52 return regs->r10 == -1 ? regs->r8:0;
42} 53}
@@ -44,8 +55,6 @@ static inline long syscall_get_error(struct task_struct *task,
44static inline long syscall_get_return_value(struct task_struct *task, 55static inline long syscall_get_return_value(struct task_struct *task,
45 struct pt_regs *regs) 56 struct pt_regs *regs)
46{ 57{
47 BUG_ON(IS_IA32_PROCESS(regs));
48
49 return regs->r8; 58 return regs->r8;
50} 59}
51 60
@@ -53,7 +62,12 @@ static inline void syscall_set_return_value(struct task_struct *task,
53 struct pt_regs *regs, 62 struct pt_regs *regs,
54 int error, long val) 63 int error, long val)
55{ 64{
56 BUG_ON(IS_IA32_PROCESS(regs)); 65#ifdef CONFIG_IA32_SUPPORT
66 if (IS_IA32_PROCESS(regs)) {
67 regs->r8 = (long) error ? error : val;
68 return;
69 }
70#endif
57 71
58 if (error) { 72 if (error) {
59 /* error < 0, but ia64 uses > 0 return value */ 73 /* error < 0, but ia64 uses > 0 return value */
@@ -73,9 +87,39 @@ static inline void syscall_get_arguments(struct task_struct *task,
73 unsigned int i, unsigned int n, 87 unsigned int i, unsigned int n,
74 unsigned long *args) 88 unsigned long *args)
75{ 89{
76 BUG_ON(IS_IA32_PROCESS(regs));
77 BUG_ON(i + n > 6); 90 BUG_ON(i + n > 6);
78 91
92#ifdef CONFIG_IA32_SUPPORT
93 if (IS_IA32_PROCESS(regs)) {
94 switch (i + n) {
95 case 6:
96 if (!n--) break;
97 *args++ = regs->r13;
98 case 5:
99 if (!n--) break;
100 *args++ = regs->r15;
101 case 4:
102 if (!n--) break;
103 *args++ = regs->r14;
104 case 3:
105 if (!n--) break;
106 *args++ = regs->r10;
107 case 2:
108 if (!n--) break;
109 *args++ = regs->r9;
110 case 1:
111 if (!n--) break;
112 *args++ = regs->r11;
113 case 0:
114 if (!n--) break;
115 default:
116 BUG();
117 break;
118 }
119
120 return;
121 }
122#endif
79 ia64_syscall_get_set_arguments(task, regs, i, n, args, 0); 123 ia64_syscall_get_set_arguments(task, regs, i, n, args, 0);
80} 124}
81 125
@@ -84,9 +128,36 @@ static inline void syscall_set_arguments(struct task_struct *task,
84 unsigned int i, unsigned int n, 128 unsigned int i, unsigned int n,
85 unsigned long *args) 129 unsigned long *args)
86{ 130{
87 BUG_ON(IS_IA32_PROCESS(regs));
88 BUG_ON(i + n > 6); 131 BUG_ON(i + n > 6);
89 132
133#ifdef CONFIG_IA32_SUPPORT
134 if (IS_IA32_PROCESS(regs)) {
135 switch (i + n) {
136 case 6:
137 if (!n--) break;
138 regs->r13 = *args++;
139 case 5:
140 if (!n--) break;
141 regs->r15 = *args++;
142 case 4:
143 if (!n--) break;
144 regs->r14 = *args++;
145 case 3:
146 if (!n--) break;
147 regs->r10 = *args++;
148 case 2:
149 if (!n--) break;
150 regs->r9 = *args++;
151 case 1:
152 if (!n--) break;
153 regs->r11 = *args++;
154 case 0:
155 if (!n--) break;
156 }
157
158 return;
159 }
160#endif
90 ia64_syscall_get_set_arguments(task, regs, i, n, args, 1); 161 ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
91} 162}
92#endif /* _ASM_SYSCALL_H */ 163#endif /* _ASM_SYSCALL_H */