diff options
-rw-r--r-- | runtime/ChangeLog | 9 | ||||
-rw-r--r-- | runtime/syscall.h | 48 | ||||
-rw-r--r-- | runtime/uprobes/uprobes_s390.h | 12 |
3 files changed, 69 insertions, 0 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog index e4ea3330..af067ed3 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,12 @@ +2008-11-04 David Smith <dsmith@redhat.com> + + PR 5274. + * syscall.h: Added s390 task_finder support. + + From Jim Keniston, PR 5274. + * uprobes/uprobes_s390.h (arch_get_cur_sp): New function. + (arch_predict_sp_at_ret): Ditto. + 2008-11-04 Frank Ch. Eigler <fche@elastic.org> From Masami Hiramatsu <mhiramat@redhat.com>, PR 6028. diff --git a/runtime/syscall.h b/runtime/syscall.h index 24fc7b1c..ae451070 100644 --- a/runtime/syscall.h +++ b/runtime/syscall.h @@ -75,6 +75,14 @@ #define MREMAP_SYSCALL_NO(tsk) 1156 #endif +#if defined(__s390__) || defined(__s390x__) +#define MMAP_SYSCALL_NO(tsk) 90 +#define MMAP2_SYSCALL_NO(tsk) 192 +#define MPROTECT_SYSCALL_NO(tsk) 125 +#define MUNMAP_SYSCALL_NO(tsk) 91 +#define MREMAP_SYSCALL_NO(tsk) 163 +#endif + #if !defined(MMAP_SYSCALL_NO) || !defined(MMAP2_SYSCALL_NO) \ || !defined(MPROTECT_SYSCALL_NO) || !defined(MUNMAP_SYSCALL_NO) \ || !defined(MREMAP_SYSCALL_NO) @@ -111,6 +119,15 @@ __stp_user_syscall_nr(struct pt_regs *regs) } #endif +#if defined(__s390__) || defined(__s390x__) +static inline unsigned long +__stp_user_syscall_nr(struct pt_regs *regs) +{ + // might need to be 'orig_gpr2' + return regs->gprs[2]; +} +#endif + #if defined(__i386__) || defined(__x86_64__) static inline long * __stp_user_syscall_return_value(struct task_struct *task, struct pt_regs *regs) @@ -153,6 +170,14 @@ __stp_user_syscall_return_value(struct task_struct *task, struct pt_regs *regs) } #endif +#if defined(__s390__) || defined(__s390x__) +static inline long * +__stp_user_syscall_return_value(struct task_struct *task, struct pt_regs *regs) +{ + return ®s->gprs[2]; +} +#endif + #if defined(__i386__) || defined(__x86_64__) static inline long * __stp_user_syscall_arg(struct task_struct *task, struct pt_regs *regs, @@ -251,4 +276,27 @@ ____stp_user_syscall_arg(struct task_struct *task, struct pt_regs *regs, } #endif +#if defined(__s390__) || defined(__s390x__) +static inline long * +__stp_user_syscall_arg(struct task_struct *task, struct pt_regs *regs, + unsigned int n) +{ + /* If we were returning a value, we could check for TIF_31BIT + * here and cast the value with '(u32)' to make sure it got + * down to 32bits. But, since we're returning an address, + * there isn't much we can do. */ + switch (n) { + case 0: return ®s->orig_gpr2; + case 1: return ®s->gprs[3]; + case 2: return ®s->gprs[4]; + case 3: return ®s->gprs[5]; + case 4: return ®s->gprs[6]; + case 5: return ®s->args[0]; + default: + _stp_error("syscall arg > 5"); + return NULL; + } +} +#endif + #endif /* _SYSCALL_H_ */ diff --git a/runtime/uprobes/uprobes_s390.h b/runtime/uprobes/uprobes_s390.h index 5c711275..47587dab 100644 --- a/runtime/uprobes/uprobes_s390.h +++ b/runtime/uprobes/uprobes_s390.h @@ -85,5 +85,17 @@ static inline void arch_restore_uret_addr(unsigned long ret_addr, static unsigned long arch_hijack_uret_addr(unsigned long trampoline_addr, struct pt_regs *regs, struct uprobe_task *utask); +static inline unsigned long arch_get_cur_sp(struct pt_regs *regs) +{ + return regs->gprs[15]; +} + +/* The stack pointer is the same upon return as it is upon function entry. */ +static inline unsigned long arch_predict_sp_at_ret(struct pt_regs *regs, + struct task_struct *tsk) +{ + return regs->gprs[15]; +} + #endif /* CONFIG_URETPROBES */ #endif /* _ASM_UPROBES_H */ |