aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/entry_64.S3
-rw-r--r--arch/powerpc/kernel/head_32.S5
-rw-r--r--arch/powerpc/kernel/process.c28
-rw-r--r--arch/powerpc/xmon/xmon.c13
4 files changed, 17 insertions, 32 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 148a3547c9aa..13019845536b 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -29,6 +29,7 @@
29#include <asm/cputable.h> 29#include <asm/cputable.h>
30#include <asm/firmware.h> 30#include <asm/firmware.h>
31#include <asm/bug.h> 31#include <asm/bug.h>
32#include <asm/ptrace.h>
32 33
33/* 34/*
34 * System calls. 35 * System calls.
@@ -39,7 +40,7 @@
39 40
40/* This value is used to mark exception frames on the stack. */ 41/* This value is used to mark exception frames on the stack. */
41exception_marker: 42exception_marker:
42 .tc ID_72656773_68657265[TC],0x7265677368657265 43 .tc ID_EXC_MARKER[TC],STACK_FRAME_REGS_MARKER
43 44
44 .section ".text" 45 .section ".text"
45 .align 7 46 .align 7
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index c16d1354b19d..785af9b56591 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -30,6 +30,7 @@
30#include <asm/thread_info.h> 30#include <asm/thread_info.h>
31#include <asm/ppc_asm.h> 31#include <asm/ppc_asm.h>
32#include <asm/asm-offsets.h> 32#include <asm/asm-offsets.h>
33#include <asm/ptrace.h>
33 34
34/* 601 only have IBAT; cr0.eq is set on 601 when using this macro */ 35/* 601 only have IBAT; cr0.eq is set on 601 when using this macro */
35#define LOAD_BAT(n, reg, RA, RB) \ 36#define LOAD_BAT(n, reg, RA, RB) \
@@ -268,8 +269,8 @@ __secondary_hold_acknowledge:
268 li r10,MSR_KERNEL & ~(MSR_IR|MSR_DR); /* can take exceptions */ \ 269 li r10,MSR_KERNEL & ~(MSR_IR|MSR_DR); /* can take exceptions */ \
269 MTMSRD(r10); /* (except for mach check in rtas) */ \ 270 MTMSRD(r10); /* (except for mach check in rtas) */ \
270 stw r0,GPR0(r11); \ 271 stw r0,GPR0(r11); \
271 lis r10,0x7265; /* put exception frame marker */ \ 272 lis r10,STACK_FRAME_REGS_MARKER@ha; /* exception frame marker */ \
272 addi r10,r10,0x6773; \ 273 addi r10,r10,STACK_FRAME_REGS_MARKER@l; \
273 stw r10,8(r11); \ 274 stw r10,8(r11); \
274 SAVE_4GPRS(3, r11); \ 275 SAVE_4GPRS(3, r11); \
275 SAVE_2GPRS(7, r11) 276 SAVE_2GPRS(7, r11)
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
931EXPORT_SYMBOL(validate_sp); 917EXPORT_SYMBOL(validate_sp);
932 918
933unsigned long get_wchan(struct task_struct *p) 919unsigned 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);
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 00fd7647f807..52c74780f403 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1243,15 +1243,12 @@ static void get_function_bounds(unsigned long pc, unsigned long *startp,
1243 1243
1244static int xmon_depth_to_print = 64; 1244static int xmon_depth_to_print = 64;
1245 1245
1246#ifdef CONFIG_PPC64 1246#define LRSAVE_OFFSET (STACK_FRAME_LR_SAVE * sizeof(unsigned long))
1247#define LRSAVE_OFFSET 0x10 1247#define MARKER_OFFSET (STACK_FRAME_MARKER * sizeof(unsigned long))
1248#define REG_FRAME_MARKER 0x7265677368657265ul /* "regshere" */ 1248
1249#define MARKER_OFFSET 0x60 1249#ifdef __powerpc64__
1250#define REGS_OFFSET 0x70 1250#define REGS_OFFSET 0x70
1251#else 1251#else
1252#define LRSAVE_OFFSET 4
1253#define REG_FRAME_MARKER 0x72656773
1254#define MARKER_OFFSET 8
1255#define REGS_OFFSET 16 1252#define REGS_OFFSET 16
1256#endif 1253#endif
1257 1254
@@ -1317,7 +1314,7 @@ static void xmon_show_stack(unsigned long sp, unsigned long lr,
1317 /* Look for "regshere" marker to see if this is 1314 /* Look for "regshere" marker to see if this is
1318 an exception frame. */ 1315 an exception frame. */
1319 if (mread(sp + MARKER_OFFSET, &marker, sizeof(unsigned long)) 1316 if (mread(sp + MARKER_OFFSET, &marker, sizeof(unsigned long))
1320 && marker == REG_FRAME_MARKER) { 1317 && marker == STACK_FRAME_REGS_MARKER) {
1321 if (mread(sp + REGS_OFFSET, &regs, sizeof(regs)) 1318 if (mread(sp + REGS_OFFSET, &regs, sizeof(regs))
1322 != sizeof(regs)) { 1319 != sizeof(regs)) {
1323 printf("Couldn't read registers at %lx\n", 1320 printf("Couldn't read registers at %lx\n",