diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2008-04-17 00:34:59 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-04-18 01:37:18 -0400 |
commit | ec2b36b9f23cfbbe94d89724b796b44fd57d5221 (patch) | |
tree | e0768000b44ffecf44882cd1d13c8b27f34fe91f /arch/powerpc/kernel/process.c | |
parent | f4ac7b5eb79ef15819c966b1f6b84bf443949123 (diff) |
[POWERPC] Move stackframe definitions to common header
This moves various definitions used all over the place to parse stack
frames to ptrace.h so only one definition is needed.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/process.c')
-rw-r--r-- | arch/powerpc/kernel/process.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index a27910207c7e..703100d5e458 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -914,20 +914,6 @@ int validate_sp(unsigned long sp, struct task_struct *p, | |||
914 | return valid_irq_stack(sp, p, nbytes); | 914 | return valid_irq_stack(sp, p, nbytes); |
915 | } | 915 | } |
916 | 916 | ||
917 | #ifdef CONFIG_PPC64 | ||
918 | #define MIN_STACK_FRAME 112 /* same as STACK_FRAME_OVERHEAD, in fact */ | ||
919 | #define FRAME_LR_SAVE 2 | ||
920 | #define INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD + 288) | ||
921 | #define REGS_MARKER 0x7265677368657265ul | ||
922 | #define FRAME_MARKER 12 | ||
923 | #else | ||
924 | #define MIN_STACK_FRAME 16 | ||
925 | #define FRAME_LR_SAVE 1 | ||
926 | #define INT_FRAME_SIZE (sizeof(struct pt_regs) + STACK_FRAME_OVERHEAD) | ||
927 | #define REGS_MARKER 0x72656773ul | ||
928 | #define FRAME_MARKER 2 | ||
929 | #endif | ||
930 | |||
931 | EXPORT_SYMBOL(validate_sp); | 917 | EXPORT_SYMBOL(validate_sp); |
932 | 918 | ||
933 | unsigned long get_wchan(struct task_struct *p) | 919 | unsigned long get_wchan(struct task_struct *p) |
@@ -939,15 +925,15 @@ unsigned long get_wchan(struct task_struct *p) | |||
939 | return 0; | 925 | return 0; |
940 | 926 | ||
941 | sp = p->thread.ksp; | 927 | sp = p->thread.ksp; |
942 | if (!validate_sp(sp, p, MIN_STACK_FRAME)) | 928 | if (!validate_sp(sp, p, STACK_FRAME_OVERHEAD)) |
943 | return 0; | 929 | return 0; |
944 | 930 | ||
945 | do { | 931 | do { |
946 | sp = *(unsigned long *)sp; | 932 | sp = *(unsigned long *)sp; |
947 | if (!validate_sp(sp, p, MIN_STACK_FRAME)) | 933 | if (!validate_sp(sp, p, STACK_FRAME_OVERHEAD)) |
948 | return 0; | 934 | return 0; |
949 | if (count > 0) { | 935 | if (count > 0) { |
950 | ip = ((unsigned long *)sp)[FRAME_LR_SAVE]; | 936 | ip = ((unsigned long *)sp)[STACK_FRAME_LR_SAVE]; |
951 | if (!in_sched_functions(ip)) | 937 | if (!in_sched_functions(ip)) |
952 | return ip; | 938 | return ip; |
953 | } | 939 | } |
@@ -976,12 +962,12 @@ void show_stack(struct task_struct *tsk, unsigned long *stack) | |||
976 | lr = 0; | 962 | lr = 0; |
977 | printk("Call Trace:\n"); | 963 | printk("Call Trace:\n"); |
978 | do { | 964 | do { |
979 | if (!validate_sp(sp, tsk, MIN_STACK_FRAME)) | 965 | if (!validate_sp(sp, tsk, STACK_FRAME_OVERHEAD)) |
980 | return; | 966 | return; |
981 | 967 | ||
982 | stack = (unsigned long *) sp; | 968 | stack = (unsigned long *) sp; |
983 | newsp = stack[0]; | 969 | newsp = stack[0]; |
984 | ip = stack[FRAME_LR_SAVE]; | 970 | ip = stack[STACK_FRAME_LR_SAVE]; |
985 | if (!firstframe || ip != lr) { | 971 | if (!firstframe || ip != lr) { |
986 | printk("["REG"] ["REG"] ", sp, ip); | 972 | printk("["REG"] ["REG"] ", sp, ip); |
987 | print_symbol("%s", ip); | 973 | print_symbol("%s", ip); |
@@ -995,8 +981,8 @@ void show_stack(struct task_struct *tsk, unsigned long *stack) | |||
995 | * See if this is an exception frame. | 981 | * See if this is an exception frame. |
996 | * We look for the "regshere" marker in the current frame. | 982 | * We look for the "regshere" marker in the current frame. |
997 | */ | 983 | */ |
998 | if (validate_sp(sp, tsk, INT_FRAME_SIZE) | 984 | if (validate_sp(sp, tsk, STACK_INT_FRAME_SIZE) |
999 | && stack[FRAME_MARKER] == REGS_MARKER) { | 985 | && stack[STACK_FRAME_MARKER] == STACK_FRAME_REGS_MARKER) { |
1000 | struct pt_regs *regs = (struct pt_regs *) | 986 | struct pt_regs *regs = (struct pt_regs *) |
1001 | (sp + STACK_FRAME_OVERHEAD); | 987 | (sp + STACK_FRAME_OVERHEAD); |
1002 | printk("--- Exception: %lx", regs->trap); | 988 | printk("--- Exception: %lx", regs->trap); |