diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-02-27 04:06:10 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-02-27 04:06:10 -0500 |
commit | 6fb83029db161141d68cf019760a893d03d0682b (patch) | |
tree | 6f149c23cedc9b2a5f72b5b90ab8426b39afbb7c /arch/s390 | |
parent | 281b3714e91162b66add1cfac404cf7b81e3e2f2 (diff) | |
parent | e01292b1fd68ff2abe234d584b06e64344d2c1de (diff) |
Merge branch 'tracing/core' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing into tracing/core
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/Kconfig | 1 | ||||
-rw-r--r-- | arch/s390/include/asm/ptrace.h | 13 | ||||
-rw-r--r-- | arch/s390/include/asm/syscall.h | 7 | ||||
-rw-r--r-- | arch/s390/kernel/ftrace.c | 10 | ||||
-rw-r--r-- | arch/s390/kernel/ptrace.c | 58 |
5 files changed, 78 insertions, 11 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index c80235206c01..2590ce20157d 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -87,6 +87,7 @@ config S390 | |||
87 | select HAVE_SYSCALL_TRACEPOINTS | 87 | select HAVE_SYSCALL_TRACEPOINTS |
88 | select HAVE_DYNAMIC_FTRACE | 88 | select HAVE_DYNAMIC_FTRACE |
89 | select HAVE_FUNCTION_GRAPH_TRACER | 89 | select HAVE_FUNCTION_GRAPH_TRACER |
90 | select HAVE_REGS_AND_STACK_ACCESS_API | ||
90 | select HAVE_DEFAULT_NO_SPIN_MUTEXES | 91 | select HAVE_DEFAULT_NO_SPIN_MUTEXES |
91 | select HAVE_OPROFILE | 92 | select HAVE_OPROFILE |
92 | select HAVE_KPROBES | 93 | select HAVE_KPROBES |
diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h index 95dcf183a28d..dd2d913afcae 100644 --- a/arch/s390/include/asm/ptrace.h +++ b/arch/s390/include/asm/ptrace.h | |||
@@ -492,13 +492,24 @@ struct user_regs_struct | |||
492 | struct task_struct; | 492 | struct task_struct; |
493 | extern void user_enable_single_step(struct task_struct *); | 493 | extern void user_enable_single_step(struct task_struct *); |
494 | extern void user_disable_single_step(struct task_struct *); | 494 | extern void user_disable_single_step(struct task_struct *); |
495 | extern void show_regs(struct pt_regs * regs); | ||
495 | 496 | ||
496 | #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) | 497 | #define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) != 0) |
497 | #define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) | 498 | #define instruction_pointer(regs) ((regs)->psw.addr & PSW_ADDR_INSN) |
498 | #define user_stack_pointer(regs)((regs)->gprs[15]) | 499 | #define user_stack_pointer(regs)((regs)->gprs[15]) |
499 | #define regs_return_value(regs)((regs)->gprs[2]) | 500 | #define regs_return_value(regs)((regs)->gprs[2]) |
500 | #define profile_pc(regs) instruction_pointer(regs) | 501 | #define profile_pc(regs) instruction_pointer(regs) |
501 | extern void show_regs(struct pt_regs * regs); | 502 | |
503 | int regs_query_register_offset(const char *name); | ||
504 | const char *regs_query_register_name(unsigned int offset); | ||
505 | unsigned long regs_get_register(struct pt_regs *regs, unsigned int offset); | ||
506 | unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n); | ||
507 | |||
508 | static inline unsigned long kernel_stack_pointer(struct pt_regs *regs) | ||
509 | { | ||
510 | return regs->gprs[15] & PSW_ADDR_INSN; | ||
511 | } | ||
512 | |||
502 | #endif /* __KERNEL__ */ | 513 | #endif /* __KERNEL__ */ |
503 | #endif /* __ASSEMBLY__ */ | 514 | #endif /* __ASSEMBLY__ */ |
504 | 515 | ||
diff --git a/arch/s390/include/asm/syscall.h b/arch/s390/include/asm/syscall.h index e0a73d3eb837..8429686951f9 100644 --- a/arch/s390/include/asm/syscall.h +++ b/arch/s390/include/asm/syscall.h | |||
@@ -15,6 +15,13 @@ | |||
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <asm/ptrace.h> | 16 | #include <asm/ptrace.h> |
17 | 17 | ||
18 | /* | ||
19 | * The syscall table always contains 32 bit pointers since we know that the | ||
20 | * address of the function to be called is (way) below 4GB. So the "int" | ||
21 | * type here is what we want [need] for both 32 bit and 64 bit systems. | ||
22 | */ | ||
23 | extern const unsigned int sys_call_table[]; | ||
24 | |||
18 | static inline long syscall_get_nr(struct task_struct *task, | 25 | static inline long syscall_get_nr(struct task_struct *task, |
19 | struct pt_regs *regs) | 26 | struct pt_regs *regs) |
20 | { | 27 | { |
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c index 5a82bc68193e..9e69449e77ad 100644 --- a/arch/s390/kernel/ftrace.c +++ b/arch/s390/kernel/ftrace.c | |||
@@ -200,13 +200,3 @@ out: | |||
200 | return parent; | 200 | return parent; |
201 | } | 201 | } |
202 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | 202 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
203 | |||
204 | #ifdef CONFIG_FTRACE_SYSCALLS | ||
205 | |||
206 | extern unsigned int sys_call_table[]; | ||
207 | |||
208 | unsigned long __init arch_syscall_addr(int nr) | ||
209 | { | ||
210 | return (unsigned long)sys_call_table[nr]; | ||
211 | } | ||
212 | #endif | ||
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 7cf464234419..33fdc5a79764 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
@@ -992,3 +992,61 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task) | |||
992 | #endif | 992 | #endif |
993 | return &user_s390_view; | 993 | return &user_s390_view; |
994 | } | 994 | } |
995 | |||
996 | static const char *gpr_names[NUM_GPRS] = { | ||
997 | "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", | ||
998 | "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", | ||
999 | }; | ||
1000 | |||
1001 | unsigned long regs_get_register(struct pt_regs *regs, unsigned int offset) | ||
1002 | { | ||
1003 | if (offset >= NUM_GPRS) | ||
1004 | return 0; | ||
1005 | return regs->gprs[offset]; | ||
1006 | } | ||
1007 | |||
1008 | int regs_query_register_offset(const char *name) | ||
1009 | { | ||
1010 | unsigned long offset; | ||
1011 | |||
1012 | if (!name || *name != 'r') | ||
1013 | return -EINVAL; | ||
1014 | if (strict_strtoul(name + 1, 10, &offset)) | ||
1015 | return -EINVAL; | ||
1016 | if (offset >= NUM_GPRS) | ||
1017 | return -EINVAL; | ||
1018 | return offset; | ||
1019 | } | ||
1020 | |||
1021 | const char *regs_query_register_name(unsigned int offset) | ||
1022 | { | ||
1023 | if (offset >= NUM_GPRS) | ||
1024 | return NULL; | ||
1025 | return gpr_names[offset]; | ||
1026 | } | ||
1027 | |||
1028 | static int regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr) | ||
1029 | { | ||
1030 | unsigned long ksp = kernel_stack_pointer(regs); | ||
1031 | |||
1032 | return (addr & ~(THREAD_SIZE - 1)) == (ksp & ~(THREAD_SIZE - 1)); | ||
1033 | } | ||
1034 | |||
1035 | /** | ||
1036 | * regs_get_kernel_stack_nth() - get Nth entry of the stack | ||
1037 | * @regs:pt_regs which contains kernel stack pointer. | ||
1038 | * @n:stack entry number. | ||
1039 | * | ||
1040 | * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which | ||
1041 | * is specifined by @regs. If the @n th entry is NOT in the kernel stack, | ||
1042 | * this returns 0. | ||
1043 | */ | ||
1044 | unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n) | ||
1045 | { | ||
1046 | unsigned long addr; | ||
1047 | |||
1048 | addr = kernel_stack_pointer(regs) + n * sizeof(long); | ||
1049 | if (!regs_within_kernel_stack(regs, addr)) | ||
1050 | return 0; | ||
1051 | return *(unsigned long *)addr; | ||
1052 | } | ||