diff options
author | Shaohua Li <shaohua.li@intel.com> | 2008-09-18 03:49:14 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2008-10-06 13:41:37 -0400 |
commit | cfb361f13c8136de78c406745abc4e4456e6d480 (patch) | |
tree | 3edb03ec94ee1f5d45f1e7299c461d397bdcbd5e /arch/ia64/kernel/ptrace.c | |
parent | fec6ed1d1f9b78a6acb4a3eb2c46c812ac2e96f0 (diff) |
[IA64] utrace syscall.h support for ia64
Add asm/syscall.h for IA64. Utrace requires this.
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/kernel/ptrace.c')
-rw-r--r-- | arch/ia64/kernel/ptrace.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c index 2a9943b5947f..12b1e9f0b7ae 100644 --- a/arch/ia64/kernel/ptrace.c +++ b/arch/ia64/kernel/ptrace.c | |||
@@ -2199,3 +2199,68 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *tsk) | |||
2199 | #endif | 2199 | #endif |
2200 | return &user_ia64_view; | 2200 | return &user_ia64_view; |
2201 | } | 2201 | } |
2202 | |||
2203 | struct syscall_get_set_args { | ||
2204 | unsigned int i; | ||
2205 | unsigned int n; | ||
2206 | unsigned long *args; | ||
2207 | struct pt_regs *regs; | ||
2208 | int rw; | ||
2209 | }; | ||
2210 | |||
2211 | static void syscall_get_set_args_cb(struct unw_frame_info *info, void *data) | ||
2212 | { | ||
2213 | struct syscall_get_set_args *args = data; | ||
2214 | struct pt_regs *pt = args->regs; | ||
2215 | unsigned long *krbs, cfm, ndirty; | ||
2216 | int i, count; | ||
2217 | |||
2218 | if (unw_unwind_to_user(info) < 0) | ||
2219 | return; | ||
2220 | |||
2221 | cfm = pt->cr_ifs; | ||
2222 | krbs = (unsigned long *)info->task + IA64_RBS_OFFSET/8; | ||
2223 | ndirty = ia64_rse_num_regs(krbs, krbs + (pt->loadrs >> 19)); | ||
2224 | |||
2225 | count = 0; | ||
2226 | if (in_syscall(pt)) | ||
2227 | count = min_t(int, args->n, cfm & 0x7f); | ||
2228 | |||
2229 | for (i = 0; i < count; i++) { | ||
2230 | if (args->rw) | ||
2231 | *ia64_rse_skip_regs(krbs, ndirty + i + args->i) = | ||
2232 | args->args[i]; | ||
2233 | else | ||
2234 | args->args[i] = *ia64_rse_skip_regs(krbs, | ||
2235 | ndirty + i + args->i); | ||
2236 | } | ||
2237 | |||
2238 | if (!args->rw) { | ||
2239 | while (i < args->n) { | ||
2240 | args->args[i] = 0; | ||
2241 | i++; | ||
2242 | } | ||
2243 | } | ||
2244 | } | ||
2245 | |||
2246 | void ia64_syscall_get_set_arguments(struct task_struct *task, | ||
2247 | struct pt_regs *regs, unsigned int i, unsigned int n, | ||
2248 | unsigned long *args, int rw) | ||
2249 | { | ||
2250 | struct syscall_get_set_args data = { | ||
2251 | .i = i, | ||
2252 | .n = n, | ||
2253 | .args = args, | ||
2254 | .regs = regs, | ||
2255 | .rw = rw, | ||
2256 | }; | ||
2257 | |||
2258 | if (task == current) | ||
2259 | unw_init_running(syscall_get_set_args_cb, &data); | ||
2260 | else { | ||
2261 | struct unw_frame_info ufi; | ||
2262 | memset(&ufi, 0, sizeof(ufi)); | ||
2263 | unw_init_from_blocked_task(&ufi, task); | ||
2264 | syscall_get_set_args_cb(&ufi, &data); | ||
2265 | } | ||
2266 | } | ||