aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-07-10 07:44:55 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-10 16:24:22 -0400
commit84e8cd6dbc00b4979e8d1c15c80d91987aeb3417 (patch)
tree5df8103b5e6d414bc39e165655ae8bd5341abd76 /arch/frv
parent6d8c4e3b0150ff537902477ed62f8a8e9e70007b (diff)
[PATCH] FRV: Introduce asm-offsets for FRV arch
Introduce the use of asm-offsets into the FRV architecture. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/frv')
-rw-r--r--arch/frv/kernel/asm-offsets.c116
-rw-r--r--arch/frv/kernel/break.S34
-rw-r--r--arch/frv/kernel/debug-stub.c13
-rw-r--r--arch/frv/kernel/entry.S1
-rw-r--r--arch/frv/kernel/gdb-stub.c159
-rw-r--r--arch/frv/kernel/head.S1
-rw-r--r--arch/frv/kernel/process.c3
-rw-r--r--arch/frv/kernel/switch_to.S3
-rw-r--r--arch/frv/kernel/traps.c25
9 files changed, 248 insertions, 107 deletions
diff --git a/arch/frv/kernel/asm-offsets.c b/arch/frv/kernel/asm-offsets.c
index 9e263112a6e2..fbb19fc1af40 100644
--- a/arch/frv/kernel/asm-offsets.c
+++ b/arch/frv/kernel/asm-offsets.c
@@ -1 +1,115 @@
1/* Dummy asm-offsets.c file. Required by kbuild and ready to be used - hint! */ 1/*
2 * Generate definitions needed by assembly language modules.
3 * This code generates raw asm output which is post-processed
4 * to extract and format the required data.
5 */
6
7#include <linux/sched.h>
8#include <linux/signal.h>
9#include <linux/personality.h>
10#include <asm/registers.h>
11#include <asm/ucontext.h>
12#include <asm/processor.h>
13#include <asm/thread_info.h>
14#include <asm/gdb-stub.h>
15
16#define DEFINE(sym, val) \
17 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
18
19#define DEF_PTREG(sym, reg) \
20 asm volatile("\n->" #sym " %0 offsetof(struct pt_regs, " #reg ")" \
21 : : "i" (offsetof(struct pt_regs, reg)))
22
23#define DEF_IREG(sym, reg) \
24 asm volatile("\n->" #sym " %0 offsetof(struct user_context, " #reg ")" \
25 : : "i" (offsetof(struct user_context, reg)))
26
27#define DEF_FREG(sym, reg) \
28 asm volatile("\n->" #sym " %0 offsetof(struct user_context, " #reg ")" \
29 : : "i" (offsetof(struct user_context, reg)))
30
31#define DEF_0REG(sym, reg) \
32 asm volatile("\n->" #sym " %0 offsetof(struct frv_frame0, " #reg ")" \
33 : : "i" (offsetof(struct frv_frame0, reg)))
34
35#define BLANK() asm volatile("\n->" : : )
36
37#define OFFSET(sym, str, mem) \
38 DEFINE(sym, offsetof(struct str, mem));
39
40void foo(void)
41{
42 /* offsets into the thread_info structure */
43 OFFSET(TI_TASK, thread_info, task);
44 OFFSET(TI_EXEC_DOMAIN, thread_info, exec_domain);
45 OFFSET(TI_FLAGS, thread_info, flags);
46 OFFSET(TI_STATUS, thread_info, status);
47 OFFSET(TI_CPU, thread_info, cpu);
48 OFFSET(TI_PREEMPT_COUNT, thread_info, preempt_count);
49 OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit);
50 OFFSET(TI_RESTART_BLOCK, thread_info, restart_block);
51 BLANK();
52
53 /* offsets into register file storage */
54 DEF_PTREG(REG_PSR, psr);
55 DEF_PTREG(REG_ISR, isr);
56 DEF_PTREG(REG_CCR, ccr);
57 DEF_PTREG(REG_CCCR, cccr);
58 DEF_PTREG(REG_LR, lr);
59 DEF_PTREG(REG_LCR, lcr);
60 DEF_PTREG(REG_PC, pc);
61 DEF_PTREG(REG__STATUS, __status);
62 DEF_PTREG(REG_SYSCALLNO, syscallno);
63 DEF_PTREG(REG_ORIG_GR8, orig_gr8);
64 DEF_PTREG(REG_GNER0, gner0);
65 DEF_PTREG(REG_GNER1, gner1);
66 DEF_PTREG(REG_IACC0, iacc0);
67 DEF_PTREG(REG_TBR, tbr);
68 DEF_PTREG(REG_GR0, tbr);
69 DEFINE(REG__END, sizeof(struct pt_regs));
70 BLANK();
71
72 DEF_0REG(REG_DCR, debug.dcr);
73 DEF_0REG(REG_IBAR0, debug.ibar[0]);
74 DEF_0REG(REG_DBAR0, debug.dbar[0]);
75 DEF_0REG(REG_DBDR00, debug.dbdr[0][0]);
76 DEF_0REG(REG_DBMR00, debug.dbmr[0][0]);
77 BLANK();
78
79 DEF_IREG(__INT_GR0, i.gr[0]);
80 DEF_FREG(__USER_FPMEDIA, f);
81 DEF_FREG(__FPMEDIA_FR0, f.fr[0]);
82 DEF_FREG(__FPMEDIA_FNER0, f.fner[0]);
83 DEF_FREG(__FPMEDIA_MSR0, f.msr[0]);
84 DEF_FREG(__FPMEDIA_ACC0, f.acc[0]);
85 DEF_FREG(__FPMEDIA_ACCG0, f.accg[0]);
86 DEF_FREG(__FPMEDIA_FSR0, f.fsr[0]);
87 BLANK();
88
89 DEFINE(NR_PT_REGS, sizeof(struct pt_regs) / 4);
90 DEFINE(NR_USER_INT_REGS, sizeof(struct user_int_regs) / 4);
91 DEFINE(NR_USER_FPMEDIA_REGS, sizeof(struct user_fpmedia_regs) / 4);
92 DEFINE(NR_USER_CONTEXT, sizeof(struct user_context) / 4);
93 DEFINE(FRV_FRAME0_SIZE, sizeof(struct frv_frame0));
94 BLANK();
95
96 /* offsets into thread_struct */
97 OFFSET(__THREAD_FRAME, thread_struct, frame);
98 OFFSET(__THREAD_CURR, thread_struct, curr);
99 OFFSET(__THREAD_SP, thread_struct, sp);
100 OFFSET(__THREAD_FP, thread_struct, fp);
101 OFFSET(__THREAD_LR, thread_struct, lr);
102 OFFSET(__THREAD_PC, thread_struct, pc);
103 OFFSET(__THREAD_GR16, thread_struct, gr[0]);
104 OFFSET(__THREAD_SCHED_LR, thread_struct, sched_lr);
105 OFFSET(__THREAD_FRAME0, thread_struct, frame0);
106 OFFSET(__THREAD_USER, thread_struct, user);
107 BLANK();
108
109 /* offsets into frv_debug_status */
110 OFFSET(DEBUG_BPSR, frv_debug_status, bpsr);
111 OFFSET(DEBUG_DCR, frv_debug_status, dcr);
112 OFFSET(DEBUG_BRR, frv_debug_status, brr);
113 OFFSET(DEBUG_NMAR, frv_debug_status, nmar);
114 BLANK();
115}
diff --git a/arch/frv/kernel/break.S b/arch/frv/kernel/break.S
index ea161f0ca427..dac4a5f68c2e 100644
--- a/arch/frv/kernel/break.S
+++ b/arch/frv/kernel/break.S
@@ -9,11 +9,11 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11
12#include <linux/sys.h>
13#include <linux/linkage.h> 12#include <linux/linkage.h>
14#include <asm/setup.h> 13#include <asm/setup.h>
15#include <asm/segment.h> 14#include <asm/segment.h>
16#include <asm/ptrace.h> 15#include <asm/ptrace.h>
16#include <asm/thread_info.h>
17#include <asm/spr-regs.h> 17#include <asm/spr-regs.h>
18 18
19#include <asm/errno.h> 19#include <asm/errno.h>
@@ -23,13 +23,11 @@
23# 23#
24 .section .bss.stack 24 .section .bss.stack
25 .globl __break_user_context 25 .globl __break_user_context
26 .balign 8192 26 .balign THREAD_SIZE
27__break_stack: 27__break_stack:
28 .space (8192 - (USER_CONTEXT_SIZE + REG__DEBUG_XTRA)) & ~7 28 .space THREAD_SIZE - FRV_FRAME0_SIZE
29__break_stack_tos: 29__break_frame_0:
30 .space REG__DEBUG_XTRA 30 .space FRV_FRAME0_SIZE
31__break_user_context:
32 .space USER_CONTEXT_SIZE
33 31
34# 32#
35# miscellaneous variables 33# miscellaneous variables
@@ -74,8 +72,8 @@ __entry_break:
74#endif 72#endif
75 LEDS 0x1001,gr31 73 LEDS 0x1001,gr31
76 74
77 sethi.p %hi(__break_user_context),gr31 75 sethi.p %hi(__break_frame_0),gr31
78 setlo %lo(__break_user_context),gr31 76 setlo %lo(__break_frame_0),gr31
79 77
80 stdi gr2,@(gr31,#REG_GR(2)) 78 stdi gr2,@(gr31,#REG_GR(2))
81 movsg ccr,gr3 79 movsg ccr,gr3
@@ -585,8 +583,8 @@ __break_continue:
585 # set up the kernel stack pointer 583 # set up the kernel stack pointer
586 sti sp,@(gr31,#REG_SP) 584 sti sp,@(gr31,#REG_SP)
587 585
588 sethi.p %hi(__break_stack_tos),sp 586 sethi.p %hi(__break_frame_0),sp
589 setlo %lo(__break_stack_tos),sp 587 setlo %lo(__break_frame_0),sp
590 588
591 # finish building the exception frame 589 # finish building the exception frame
592 stdi gr4 ,@(gr31,#REG_GR(4)) 590 stdi gr4 ,@(gr31,#REG_GR(4))
@@ -651,9 +649,12 @@ __break_continue:
651 movsg nmar,gr5 649 movsg nmar,gr5
652 movsg dcr,gr6 650 movsg dcr,gr6
653 651
654 stdi gr4 ,@(gr31,#REG_BRR) 652 sethi.p %hi(__debug_status),gr7
655 sti gr19,@(gr31,#REG_BPSR) 653 setlo %lo(__debug_status),gr7
656 sti.p gr6 ,@(gr31,#REG_DCR) 654
655 stdi gr4 ,@(gr7,#DEBUG_BRR)
656 sti gr19,@(gr7,#DEBUG_BPSR)
657 sti.p gr6 ,@(gr7,#DEBUG_DCR)
657 658
658 # trap exceptions during break handling and disable h/w breakpoints/watchpoints 659 # trap exceptions during break handling and disable h/w breakpoints/watchpoints
659 sethi %hi(DCR_EBE),gr5 660 sethi %hi(DCR_EBE),gr5
@@ -698,7 +699,10 @@ __break_continue:
698 lddi @(gr31,#REG_PSR) ,gr22 699 lddi @(gr31,#REG_PSR) ,gr22
699 ldi @(gr31,#REG_PC) ,gr21 700 ldi @(gr31,#REG_PC) ,gr21
700 ldi @(gr31,#REG_TBR) ,gr20 701 ldi @(gr31,#REG_TBR) ,gr20
701 ldi.p @(gr31,#REG_DCR) ,gr6 702
703 sethi.p %hi(__debug_status),gr6
704 setlo %lo(__debug_status),gr6
705 ldi.p @(gr6,#DEBUG_DCR) ,gr6
702 706
703 andi gr22,#PSR_S,gr19 /* rebuild BPSR */ 707 andi gr22,#PSR_S,gr19 /* rebuild BPSR */
704 andi.p gr22,#PSR_ET,gr5 708 andi.p gr22,#PSR_ET,gr5
diff --git a/arch/frv/kernel/debug-stub.c b/arch/frv/kernel/debug-stub.c
index 4761cc4b4a90..2f6c60c921e0 100644
--- a/arch/frv/kernel/debug-stub.c
+++ b/arch/frv/kernel/debug-stub.c
@@ -39,10 +39,9 @@ do { \
39 gdbstub_do_rx(); \ 39 gdbstub_do_rx(); \
40} while(!FLOWCTL_QUERY(LINE)) 40} while(!FLOWCTL_QUERY(LINE))
41 41
42static void __init debug_stub_init(void); 42struct frv_debug_status __debug_status;
43 43
44extern asmlinkage void __break_hijack_kernel_event(void); 44static void __init debug_stub_init(void);
45extern asmlinkage void __break_hijack_kernel_event_breaks_here(void);
46 45
47/*****************************************************************************/ 46/*****************************************************************************/
48/* 47/*
@@ -67,7 +66,7 @@ asmlinkage void debug_stub(void)
67 __set_HSR(0, hsr0 & ~HSR0_ETMD); 66 __set_HSR(0, hsr0 & ~HSR0_ETMD);
68 67
69 /* disable single stepping */ 68 /* disable single stepping */
70 __debug_regs->dcr &= ~DCR_SE; 69 __debug_status.dcr &= ~DCR_SE;
71 70
72 /* kernel mode can propose an exception be handled in debug mode by jumping to a special 71 /* kernel mode can propose an exception be handled in debug mode by jumping to a special
73 * location */ 72 * location */
@@ -76,8 +75,8 @@ asmlinkage void debug_stub(void)
76 * the top kernel context */ 75 * the top kernel context */
77 *__debug_frame = *__frame; 76 *__debug_frame = *__frame;
78 __frame = __debug_frame->next_frame; 77 __frame = __debug_frame->next_frame;
79 __debug_regs->brr = (__debug_frame->tbr & TBR_TT) << 12; 78 __debug_status.brr = (__debug_frame->tbr & TBR_TT) << 12;
80 __debug_regs->brr |= BRR_EB; 79 __debug_status.brr |= BRR_EB;
81 } 80 }
82 81
83 if (__debug_frame->pc == (unsigned long) __debug_bug_trap + 4) { 82 if (__debug_frame->pc == (unsigned long) __debug_bug_trap + 4) {
@@ -124,7 +123,7 @@ static void __init debug_stub_init(void)
124 __debug_frame->pc = (unsigned long) start_kernel; 123 __debug_frame->pc = (unsigned long) start_kernel;
125 124
126 /* enable the debug events we want to trap */ 125 /* enable the debug events we want to trap */
127 __debug_regs->dcr = DCR_EBE; 126 __debug_status.dcr = DCR_EBE;
128 127
129#ifdef CONFIG_GDBSTUB 128#ifdef CONFIG_GDBSTUB
130 gdbstub_init(); 129 gdbstub_init();
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index 2a1ff1ff8692..940ac306e9a0 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -27,7 +27,6 @@
27 * 27 *
28 */ 28 */
29 29
30#include <linux/sys.h>
31#include <linux/linkage.h> 30#include <linux/linkage.h>
32#include <asm/thread_info.h> 31#include <asm/thread_info.h>
33#include <asm/setup.h> 32#include <asm/setup.h>
diff --git a/arch/frv/kernel/gdb-stub.c b/arch/frv/kernel/gdb-stub.c
index 508601fad079..9550f37fb62c 100644
--- a/arch/frv/kernel/gdb-stub.c
+++ b/arch/frv/kernel/gdb-stub.c
@@ -124,6 +124,7 @@
124#include <linux/slab.h> 124#include <linux/slab.h>
125#include <linux/nmi.h> 125#include <linux/nmi.h>
126 126
127#include <asm/asm-offsets.h>
127#include <asm/pgtable.h> 128#include <asm/pgtable.h>
128#include <asm/system.h> 129#include <asm/system.h>
129#include <asm/gdb-stub.h> 130#include <asm/gdb-stub.h>
@@ -136,7 +137,6 @@ extern void debug_to_serial(const char *p, int n);
136extern void gdbstub_console_write(struct console *co, const char *p, unsigned n); 137extern void gdbstub_console_write(struct console *co, const char *p, unsigned n);
137 138
138extern volatile uint32_t __break_error_detect[3]; /* ESFR1, ESR15, EAR15 */ 139extern volatile uint32_t __break_error_detect[3]; /* ESFR1, ESR15, EAR15 */
139extern struct user_context __break_user_context;
140 140
141struct __debug_amr { 141struct __debug_amr {
142 unsigned long L, P; 142 unsigned long L, P;
@@ -926,6 +926,7 @@ static int gdbstub_set_breakpoint(unsigned long type, unsigned long addr, unsign
926 if (!(__debug_regs->dcr & DCR_IBE0)) { 926 if (!(__debug_regs->dcr & DCR_IBE0)) {
927 //gdbstub_printk("set h/w break 0: %08lx\n", addr); 927 //gdbstub_printk("set h/w break 0: %08lx\n", addr);
928 __debug_regs->dcr |= DCR_IBE0; 928 __debug_regs->dcr |= DCR_IBE0;
929 __debug_regs->ibar[0] = addr;
929 asm volatile("movgs %0,ibar0" : : "r"(addr)); 930 asm volatile("movgs %0,ibar0" : : "r"(addr));
930 return 0; 931 return 0;
931 } 932 }
@@ -933,6 +934,7 @@ static int gdbstub_set_breakpoint(unsigned long type, unsigned long addr, unsign
933 if (!(__debug_regs->dcr & DCR_IBE1)) { 934 if (!(__debug_regs->dcr & DCR_IBE1)) {
934 //gdbstub_printk("set h/w break 1: %08lx\n", addr); 935 //gdbstub_printk("set h/w break 1: %08lx\n", addr);
935 __debug_regs->dcr |= DCR_IBE1; 936 __debug_regs->dcr |= DCR_IBE1;
937 __debug_regs->ibar[1] = addr;
936 asm volatile("movgs %0,ibar1" : : "r"(addr)); 938 asm volatile("movgs %0,ibar1" : : "r"(addr));
937 return 0; 939 return 0;
938 } 940 }
@@ -940,6 +942,7 @@ static int gdbstub_set_breakpoint(unsigned long type, unsigned long addr, unsign
940 if (!(__debug_regs->dcr & DCR_IBE2)) { 942 if (!(__debug_regs->dcr & DCR_IBE2)) {
941 //gdbstub_printk("set h/w break 2: %08lx\n", addr); 943 //gdbstub_printk("set h/w break 2: %08lx\n", addr);
942 __debug_regs->dcr |= DCR_IBE2; 944 __debug_regs->dcr |= DCR_IBE2;
945 __debug_regs->ibar[2] = addr;
943 asm volatile("movgs %0,ibar2" : : "r"(addr)); 946 asm volatile("movgs %0,ibar2" : : "r"(addr));
944 return 0; 947 return 0;
945 } 948 }
@@ -947,6 +950,7 @@ static int gdbstub_set_breakpoint(unsigned long type, unsigned long addr, unsign
947 if (!(__debug_regs->dcr & DCR_IBE3)) { 950 if (!(__debug_regs->dcr & DCR_IBE3)) {
948 //gdbstub_printk("set h/w break 3: %08lx\n", addr); 951 //gdbstub_printk("set h/w break 3: %08lx\n", addr);
949 __debug_regs->dcr |= DCR_IBE3; 952 __debug_regs->dcr |= DCR_IBE3;
953 __debug_regs->ibar[3] = addr;
950 asm volatile("movgs %0,ibar3" : : "r"(addr)); 954 asm volatile("movgs %0,ibar3" : : "r"(addr));
951 return 0; 955 return 0;
952 } 956 }
@@ -971,7 +975,14 @@ static int gdbstub_set_breakpoint(unsigned long type, unsigned long addr, unsign
971 if (!(__debug_regs->dcr & (DCR_DRBE0|DCR_DWBE0))) { 975 if (!(__debug_regs->dcr & (DCR_DRBE0|DCR_DWBE0))) {
972 //gdbstub_printk("set h/w watchpoint 0 type %ld: %08lx\n", type, addr); 976 //gdbstub_printk("set h/w watchpoint 0 type %ld: %08lx\n", type, addr);
973 tmp = type==2 ? DCR_DWBE0 : type==3 ? DCR_DRBE0 : DCR_DRBE0|DCR_DWBE0; 977 tmp = type==2 ? DCR_DWBE0 : type==3 ? DCR_DRBE0 : DCR_DRBE0|DCR_DWBE0;
978
974 __debug_regs->dcr |= tmp; 979 __debug_regs->dcr |= tmp;
980 __debug_regs->dbar[0] = addr;
981 __debug_regs->dbmr[0][0] = dbmr.mask0;
982 __debug_regs->dbmr[0][1] = dbmr.mask1;
983 __debug_regs->dbdr[0][0] = 0;
984 __debug_regs->dbdr[0][1] = 0;
985
975 asm volatile(" movgs %0,dbar0 \n" 986 asm volatile(" movgs %0,dbar0 \n"
976 " movgs %1,dbmr00 \n" 987 " movgs %1,dbmr00 \n"
977 " movgs %2,dbmr01 \n" 988 " movgs %2,dbmr01 \n"
@@ -984,7 +995,14 @@ static int gdbstub_set_breakpoint(unsigned long type, unsigned long addr, unsign
984 if (!(__debug_regs->dcr & (DCR_DRBE1|DCR_DWBE1))) { 995 if (!(__debug_regs->dcr & (DCR_DRBE1|DCR_DWBE1))) {
985 //gdbstub_printk("set h/w watchpoint 1 type %ld: %08lx\n", type, addr); 996 //gdbstub_printk("set h/w watchpoint 1 type %ld: %08lx\n", type, addr);
986 tmp = type==2 ? DCR_DWBE1 : type==3 ? DCR_DRBE1 : DCR_DRBE1|DCR_DWBE1; 997 tmp = type==2 ? DCR_DWBE1 : type==3 ? DCR_DRBE1 : DCR_DRBE1|DCR_DWBE1;
998
987 __debug_regs->dcr |= tmp; 999 __debug_regs->dcr |= tmp;
1000 __debug_regs->dbar[1] = addr;
1001 __debug_regs->dbmr[1][0] = dbmr.mask0;
1002 __debug_regs->dbmr[1][1] = dbmr.mask1;
1003 __debug_regs->dbdr[1][0] = 0;
1004 __debug_regs->dbdr[1][1] = 0;
1005
988 asm volatile(" movgs %0,dbar1 \n" 1006 asm volatile(" movgs %0,dbar1 \n"
989 " movgs %1,dbmr10 \n" 1007 " movgs %1,dbmr10 \n"
990 " movgs %2,dbmr11 \n" 1008 " movgs %2,dbmr11 \n"
@@ -1047,6 +1065,7 @@ int gdbstub_clear_breakpoint(unsigned long type, unsigned long addr, unsigned lo
1047 if (__debug_regs->dcr & DCR_IBE0 && __get_ibar(0) == addr) { 1065 if (__debug_regs->dcr & DCR_IBE0 && __get_ibar(0) == addr) {
1048 //gdbstub_printk("clear h/w break 0: %08lx\n", addr); 1066 //gdbstub_printk("clear h/w break 0: %08lx\n", addr);
1049 __debug_regs->dcr &= ~DCR_IBE0; 1067 __debug_regs->dcr &= ~DCR_IBE0;
1068 __debug_regs->ibar[0] = 0;
1050 asm volatile("movgs gr0,ibar0"); 1069 asm volatile("movgs gr0,ibar0");
1051 return 0; 1070 return 0;
1052 } 1071 }
@@ -1054,6 +1073,7 @@ int gdbstub_clear_breakpoint(unsigned long type, unsigned long addr, unsigned lo
1054 if (__debug_regs->dcr & DCR_IBE1 && __get_ibar(1) == addr) { 1073 if (__debug_regs->dcr & DCR_IBE1 && __get_ibar(1) == addr) {
1055 //gdbstub_printk("clear h/w break 1: %08lx\n", addr); 1074 //gdbstub_printk("clear h/w break 1: %08lx\n", addr);
1056 __debug_regs->dcr &= ~DCR_IBE1; 1075 __debug_regs->dcr &= ~DCR_IBE1;
1076 __debug_regs->ibar[1] = 0;
1057 asm volatile("movgs gr0,ibar1"); 1077 asm volatile("movgs gr0,ibar1");
1058 return 0; 1078 return 0;
1059 } 1079 }
@@ -1061,6 +1081,7 @@ int gdbstub_clear_breakpoint(unsigned long type, unsigned long addr, unsigned lo
1061 if (__debug_regs->dcr & DCR_IBE2 && __get_ibar(2) == addr) { 1081 if (__debug_regs->dcr & DCR_IBE2 && __get_ibar(2) == addr) {
1062 //gdbstub_printk("clear h/w break 2: %08lx\n", addr); 1082 //gdbstub_printk("clear h/w break 2: %08lx\n", addr);
1063 __debug_regs->dcr &= ~DCR_IBE2; 1083 __debug_regs->dcr &= ~DCR_IBE2;
1084 __debug_regs->ibar[2] = 0;
1064 asm volatile("movgs gr0,ibar2"); 1085 asm volatile("movgs gr0,ibar2");
1065 return 0; 1086 return 0;
1066 } 1087 }
@@ -1068,6 +1089,7 @@ int gdbstub_clear_breakpoint(unsigned long type, unsigned long addr, unsigned lo
1068 if (__debug_regs->dcr & DCR_IBE3 && __get_ibar(3) == addr) { 1089 if (__debug_regs->dcr & DCR_IBE3 && __get_ibar(3) == addr) {
1069 //gdbstub_printk("clear h/w break 3: %08lx\n", addr); 1090 //gdbstub_printk("clear h/w break 3: %08lx\n", addr);
1070 __debug_regs->dcr &= ~DCR_IBE3; 1091 __debug_regs->dcr &= ~DCR_IBE3;
1092 __debug_regs->ibar[3] = 0;
1071 asm volatile("movgs gr0,ibar3"); 1093 asm volatile("movgs gr0,ibar3");
1072 return 0; 1094 return 0;
1073 } 1095 }
@@ -1104,6 +1126,12 @@ int gdbstub_clear_breakpoint(unsigned long type, unsigned long addr, unsigned lo
1104 1126
1105 //gdbstub_printk("clear h/w watchpoint 0 type %ld: %08lx\n", type, addr); 1127 //gdbstub_printk("clear h/w watchpoint 0 type %ld: %08lx\n", type, addr);
1106 __debug_regs->dcr &= ~(DCR_DRBE0|DCR_DWBE0); 1128 __debug_regs->dcr &= ~(DCR_DRBE0|DCR_DWBE0);
1129 __debug_regs->dbar[0] = 0;
1130 __debug_regs->dbmr[0][0] = 0;
1131 __debug_regs->dbmr[0][1] = 0;
1132 __debug_regs->dbdr[0][0] = 0;
1133 __debug_regs->dbdr[0][1] = 0;
1134
1107 asm volatile(" movgs gr0,dbar0 \n" 1135 asm volatile(" movgs gr0,dbar0 \n"
1108 " movgs gr0,dbmr00 \n" 1136 " movgs gr0,dbmr00 \n"
1109 " movgs gr0,dbmr01 \n" 1137 " movgs gr0,dbmr01 \n"
@@ -1123,6 +1151,12 @@ int gdbstub_clear_breakpoint(unsigned long type, unsigned long addr, unsigned lo
1123 1151
1124 //gdbstub_printk("clear h/w watchpoint 1 type %ld: %08lx\n", type, addr); 1152 //gdbstub_printk("clear h/w watchpoint 1 type %ld: %08lx\n", type, addr);
1125 __debug_regs->dcr &= ~(DCR_DRBE1|DCR_DWBE1); 1153 __debug_regs->dcr &= ~(DCR_DRBE1|DCR_DWBE1);
1154 __debug_regs->dbar[1] = 0;
1155 __debug_regs->dbmr[1][0] = 0;
1156 __debug_regs->dbmr[1][1] = 0;
1157 __debug_regs->dbdr[1][0] = 0;
1158 __debug_regs->dbdr[1][1] = 0;
1159
1126 asm volatile(" movgs gr0,dbar1 \n" 1160 asm volatile(" movgs gr0,dbar1 \n"
1127 " movgs gr0,dbmr10 \n" 1161 " movgs gr0,dbmr10 \n"
1128 " movgs gr0,dbmr11 \n" 1162 " movgs gr0,dbmr11 \n"
@@ -1163,7 +1197,7 @@ static void gdbstub_check_breakpoint(void)
1163 */ 1197 */
1164static void __attribute__((unused)) gdbstub_show_regs(void) 1198static void __attribute__((unused)) gdbstub_show_regs(void)
1165{ 1199{
1166 uint32_t *reg; 1200 unsigned long *reg;
1167 int loop; 1201 int loop;
1168 1202
1169 gdbstub_printk("\n"); 1203 gdbstub_printk("\n");
@@ -1172,11 +1206,11 @@ static void __attribute__((unused)) gdbstub_show_regs(void)
1172 __debug_frame, 1206 __debug_frame,
1173 __debug_frame->psr & PSR_S ? "kernel" : "user"); 1207 __debug_frame->psr & PSR_S ? "kernel" : "user");
1174 1208
1175 reg = (uint32_t *) __debug_frame; 1209 reg = (unsigned long *) __debug_frame;
1176 for (loop = 0; loop < REG__END; loop++) { 1210 for (loop = 0; loop < NR_PT_REGS; loop++) {
1177 printk("%s %08x", regnames[loop + 0], reg[loop + 0]); 1211 printk("%s %08lx", regnames[loop + 0], reg[loop + 0]);
1178 1212
1179 if (loop == REG__END - 1 || loop % 5 == 4) 1213 if (loop == NR_PT_REGS - 1 || loop % 5 == 4)
1180 printk("\n"); 1214 printk("\n");
1181 else 1215 else
1182 printk(" | "); 1216 printk(" | ");
@@ -1191,13 +1225,8 @@ static void __attribute__((unused)) gdbstub_show_regs(void)
1191 */ 1225 */
1192static void __attribute__((unused)) gdbstub_dump_debugregs(void) 1226static void __attribute__((unused)) gdbstub_dump_debugregs(void)
1193{ 1227{
1194 unsigned long x; 1228 gdbstub_printk("DCR %08lx ", __debug_status.dcr);
1195 1229 gdbstub_printk("BRR %08lx\n", __debug_status.brr);
1196 x = __debug_regs->dcr;
1197 gdbstub_printk("DCR %08lx ", x);
1198
1199 x = __debug_regs->brr;
1200 gdbstub_printk("BRR %08lx\n", x);
1201 1230
1202 gdbstub_printk("IBAR0 %08lx ", __get_ibar(0)); 1231 gdbstub_printk("IBAR0 %08lx ", __get_ibar(0));
1203 gdbstub_printk("IBAR1 %08lx ", __get_ibar(1)); 1232 gdbstub_printk("IBAR1 %08lx ", __get_ibar(1));
@@ -1360,7 +1389,7 @@ void gdbstub(int sigval)
1360#endif 1389#endif
1361 } 1390 }
1362 1391
1363 save_user_regs(&__break_user_context); 1392 save_user_regs(&__debug_frame0->uc);
1364 1393
1365#if 0 1394#if 0
1366 gdbstub_printk("--> gdbstub() %08x %p %08x %08x\n", 1395 gdbstub_printk("--> gdbstub() %08x %p %08x %08x\n",
@@ -1389,8 +1418,8 @@ void gdbstub(int sigval)
1389 __debug_frame->psr &= ~PSR_S; 1418 __debug_frame->psr &= ~PSR_S;
1390 if (__debug_frame->psr & PSR_PS) 1419 if (__debug_frame->psr & PSR_PS)
1391 __debug_frame->psr |= PSR_S; 1420 __debug_frame->psr |= PSR_S;
1392 __debug_regs->brr = (__debug_frame->tbr & TBR_TT) << 12; 1421 __debug_status.brr = (__debug_frame->tbr & TBR_TT) << 12;
1393 __debug_regs->brr |= BRR_EB; 1422 __debug_status.brr |= BRR_EB;
1394 sigval = SIGINT; 1423 sigval = SIGINT;
1395 } 1424 }
1396 1425
@@ -1404,15 +1433,15 @@ void gdbstub(int sigval)
1404 __debug_frame->psr &= ~PSR_S; 1433 __debug_frame->psr &= ~PSR_S;
1405 if (__debug_frame->psr & PSR_PS) 1434 if (__debug_frame->psr & PSR_PS)
1406 __debug_frame->psr |= PSR_S; 1435 __debug_frame->psr |= PSR_S;
1407 __debug_regs->brr = (__debug_frame->tbr & TBR_TT) << 12; 1436 __debug_status.brr = (__debug_frame->tbr & TBR_TT) << 12;
1408 __debug_regs->brr |= BRR_EB; 1437 __debug_status.brr |= BRR_EB;
1409 sigval = SIGXCPU; 1438 sigval = SIGXCPU;
1410 } 1439 }
1411 1440
1412 LEDS(0x5002); 1441 LEDS(0x5002);
1413 1442
1414 /* after a BREAK insn, the PC lands on the far side of it */ 1443 /* after a BREAK insn, the PC lands on the far side of it */
1415 if (__debug_regs->brr & BRR_SB) 1444 if (__debug_status.brr & BRR_SB)
1416 gdbstub_check_breakpoint(); 1445 gdbstub_check_breakpoint();
1417 1446
1418 LEDS(0x5003); 1447 LEDS(0x5003);
@@ -1431,7 +1460,7 @@ void gdbstub(int sigval)
1431 } 1460 }
1432 1461
1433 if (!sigval) 1462 if (!sigval)
1434 sigval = gdbstub_compute_signal(__debug_regs->brr); 1463 sigval = gdbstub_compute_signal(__debug_status.brr);
1435 1464
1436 LEDS(0x5004); 1465 LEDS(0x5004);
1437 1466
@@ -1441,7 +1470,7 @@ void gdbstub(int sigval)
1441 if (sigval != SIGINT && sigval != SIGTRAP && sigval != SIGILL) { 1470 if (sigval != SIGINT && sigval != SIGTRAP && sigval != SIGILL) {
1442 static const char title[] = "Break "; 1471 static const char title[] = "Break ";
1443 static const char crlf[] = "\r\n"; 1472 static const char crlf[] = "\r\n";
1444 unsigned long brr = __debug_regs->brr; 1473 unsigned long brr = __debug_status.brr;
1445 char hx; 1474 char hx;
1446 1475
1447 ptr = output_buffer; 1476 ptr = output_buffer;
@@ -1565,28 +1594,24 @@ void gdbstub(int sigval)
1565 ptr = mem2hex(&zero, ptr, 4, 0); 1594 ptr = mem2hex(&zero, ptr, 4, 0);
1566 1595
1567 for (loop = 1; loop <= 27; loop++) 1596 for (loop = 1; loop <= 27; loop++)
1568 ptr = mem2hex((unsigned long *)__debug_frame + REG_GR(loop), 1597 ptr = mem2hex(&__debug_user_context->i.gr[loop], ptr, 4, 0);
1569 ptr, 4, 0);
1570 temp = (unsigned long) __frame; 1598 temp = (unsigned long) __frame;
1571 ptr = mem2hex(&temp, ptr, 4, 0); 1599 ptr = mem2hex(&temp, ptr, 4, 0);
1572 ptr = mem2hex((unsigned long *)__debug_frame + REG_GR(29), ptr, 4, 0); 1600 ptr = mem2hex(&__debug_user_context->i.gr[29], ptr, 4, 0);
1573 ptr = mem2hex((unsigned long *)__debug_frame + REG_GR(30), ptr, 4, 0); 1601 ptr = mem2hex(&__debug_user_context->i.gr[30], ptr, 4, 0);
1574#ifdef CONFIG_MMU 1602#ifdef CONFIG_MMU
1575 ptr = mem2hex((unsigned long *)__debug_frame + REG_GR(31), ptr, 4, 0); 1603 ptr = mem2hex(&__debug_user_context->i.gr[31], ptr, 4, 0);
1576#else 1604#else
1577 temp = (unsigned long) __debug_frame; 1605 temp = (unsigned long) __debug_frame;
1578 ptr = mem2hex(&temp, ptr, 4, 0); 1606 ptr = mem2hex(&temp, ptr, 4, 0);
1579#endif 1607#endif
1580 1608
1581 for (loop = 32; loop <= 63; loop++) 1609 for (loop = 32; loop <= 63; loop++)
1582 ptr = mem2hex((unsigned long *)__debug_frame + REG_GR(loop), 1610 ptr = mem2hex(&__debug_user_context->i.gr[loop], ptr, 4, 0);
1583 ptr, 4, 0);
1584 1611
1585 /* deal with FR0-FR63 */ 1612 /* deal with FR0-FR63 */
1586 for (loop = 0; loop <= 63; loop++) 1613 for (loop = 0; loop <= 63; loop++)
1587 ptr = mem2hex((unsigned long *)&__break_user_context + 1614 ptr = mem2hex(&__debug_user_context->f.fr[loop], ptr, 4, 0);
1588 __FPMEDIA_FR(loop),
1589 ptr, 4, 0);
1590 1615
1591 /* deal with special registers */ 1616 /* deal with special registers */
1592 ptr = mem2hex(&__debug_frame->pc, ptr, 4, 0); 1617 ptr = mem2hex(&__debug_frame->pc, ptr, 4, 0);
@@ -1597,7 +1622,7 @@ void gdbstub(int sigval)
1597 ptr = mem2hex(&zero, ptr, 4, 0); 1622 ptr = mem2hex(&zero, ptr, 4, 0);
1598 ptr = mem2hex(&zero, ptr, 4, 0); 1623 ptr = mem2hex(&zero, ptr, 4, 0);
1599 ptr = mem2hex(&__debug_frame->tbr, ptr, 4, 0); 1624 ptr = mem2hex(&__debug_frame->tbr, ptr, 4, 0);
1600 ptr = mem2hex(&__debug_regs->brr , ptr, 4, 0); 1625 ptr = mem2hex(&__debug_status.brr , ptr, 4, 0);
1601 1626
1602 asm volatile("movsg dbar0,%0" : "=r"(dbar)); 1627 asm volatile("movsg dbar0,%0" : "=r"(dbar));
1603 ptr = mem2hex(&dbar, ptr, 4, 0); 1628 ptr = mem2hex(&dbar, ptr, 4, 0);
@@ -1622,21 +1647,21 @@ void gdbstub(int sigval)
1622 1647
1623 ptr = mem2hex(&__debug_frame->iacc0, ptr, 8, 0); 1648 ptr = mem2hex(&__debug_frame->iacc0, ptr, 8, 0);
1624 1649
1625 ptr = mem2hex(&__break_user_context.f.fsr[0], ptr, 4, 0); 1650 ptr = mem2hex(&__debug_user_context->f.fsr[0], ptr, 4, 0);
1626 1651
1627 for (loop = 0; loop <= 7; loop++) 1652 for (loop = 0; loop <= 7; loop++)
1628 ptr = mem2hex(&__break_user_context.f.acc[loop], ptr, 4, 0); 1653 ptr = mem2hex(&__debug_user_context->f.acc[loop], ptr, 4, 0);
1629 1654
1630 ptr = mem2hex(&__break_user_context.f.accg, ptr, 8, 0); 1655 ptr = mem2hex(&__debug_user_context->f.accg, ptr, 8, 0);
1631 1656
1632 for (loop = 0; loop <= 1; loop++) 1657 for (loop = 0; loop <= 1; loop++)
1633 ptr = mem2hex(&__break_user_context.f.msr[loop], ptr, 4, 0); 1658 ptr = mem2hex(&__debug_user_context->f.msr[loop], ptr, 4, 0);
1634 1659
1635 ptr = mem2hex(&__debug_frame->gner0, ptr, 4, 0); 1660 ptr = mem2hex(&__debug_frame->gner0, ptr, 4, 0);
1636 ptr = mem2hex(&__debug_frame->gner1, ptr, 4, 0); 1661 ptr = mem2hex(&__debug_frame->gner1, ptr, 4, 0);
1637 1662
1638 ptr = mem2hex(&__break_user_context.f.fner[0], ptr, 4, 0); 1663 ptr = mem2hex(&__debug_user_context->f.fner[0], ptr, 4, 0);
1639 ptr = mem2hex(&__break_user_context.f.fner[1], ptr, 4, 0); 1664 ptr = mem2hex(&__debug_user_context->f.fner[1], ptr, 4, 0);
1640 1665
1641 break; 1666 break;
1642 1667
@@ -1648,8 +1673,7 @@ void gdbstub(int sigval)
1648 ptr = hex2mem(ptr, &temp, 4); 1673 ptr = hex2mem(ptr, &temp, 4);
1649 1674
1650 for (loop = 1; loop <= 27; loop++) 1675 for (loop = 1; loop <= 27; loop++)
1651 ptr = hex2mem(ptr, (unsigned long *)__debug_frame + REG_GR(loop), 1676 ptr = hex2mem(ptr, &__debug_user_context->i.gr[loop], 4);
1652 4);
1653 1677
1654 ptr = hex2mem(ptr, &temp, 4); 1678 ptr = hex2mem(ptr, &temp, 4);
1655 __frame = (struct pt_regs *) temp; 1679 __frame = (struct pt_regs *) temp;
@@ -1662,14 +1686,11 @@ void gdbstub(int sigval)
1662#endif 1686#endif
1663 1687
1664 for (loop = 32; loop <= 63; loop++) 1688 for (loop = 32; loop <= 63; loop++)
1665 ptr = hex2mem(ptr, (unsigned long *)__debug_frame + REG_GR(loop), 1689 ptr = hex2mem(ptr, &__debug_user_context->i.gr[loop], 4);
1666 4);
1667 1690
1668 /* deal with FR0-FR63 */ 1691 /* deal with FR0-FR63 */
1669 for (loop = 0; loop <= 63; loop++) 1692 for (loop = 0; loop <= 63; loop++)
1670 ptr = mem2hex((unsigned long *)&__break_user_context + 1693 ptr = mem2hex(&__debug_user_context->f.fr[loop], ptr, 4, 0);
1671 __FPMEDIA_FR(loop),
1672 ptr, 4, 0);
1673 1694
1674 /* deal with special registers */ 1695 /* deal with special registers */
1675 ptr = hex2mem(ptr, &__debug_frame->pc, 4); 1696 ptr = hex2mem(ptr, &__debug_frame->pc, 4);
@@ -1694,21 +1715,21 @@ void gdbstub(int sigval)
1694 1715
1695 ptr = hex2mem(ptr, &__debug_frame->iacc0, 8); 1716 ptr = hex2mem(ptr, &__debug_frame->iacc0, 8);
1696 1717
1697 ptr = hex2mem(ptr, &__break_user_context.f.fsr[0], 4); 1718 ptr = hex2mem(ptr, &__debug_user_context->f.fsr[0], 4);
1698 1719
1699 for (loop = 0; loop <= 7; loop++) 1720 for (loop = 0; loop <= 7; loop++)
1700 ptr = hex2mem(ptr, &__break_user_context.f.acc[loop], 4); 1721 ptr = hex2mem(ptr, &__debug_user_context->f.acc[loop], 4);
1701 1722
1702 ptr = hex2mem(ptr, &__break_user_context.f.accg, 8); 1723 ptr = hex2mem(ptr, &__debug_user_context->f.accg, 8);
1703 1724
1704 for (loop = 0; loop <= 1; loop++) 1725 for (loop = 0; loop <= 1; loop++)
1705 ptr = hex2mem(ptr, &__break_user_context.f.msr[loop], 4); 1726 ptr = hex2mem(ptr, &__debug_user_context->f.msr[loop], 4);
1706 1727
1707 ptr = hex2mem(ptr, &__debug_frame->gner0, 4); 1728 ptr = hex2mem(ptr, &__debug_frame->gner0, 4);
1708 ptr = hex2mem(ptr, &__debug_frame->gner1, 4); 1729 ptr = hex2mem(ptr, &__debug_frame->gner1, 4);
1709 1730
1710 ptr = hex2mem(ptr, &__break_user_context.f.fner[0], 4); 1731 ptr = hex2mem(ptr, &__debug_user_context->f.fner[0], 4);
1711 ptr = hex2mem(ptr, &__break_user_context.f.fner[1], 4); 1732 ptr = hex2mem(ptr, &__debug_user_context->f.fner[1], 4);
1712 1733
1713 gdbstub_strcpy(output_buffer,"OK"); 1734 gdbstub_strcpy(output_buffer,"OK");
1714 break; 1735 break;
@@ -1769,52 +1790,52 @@ void gdbstub(int sigval)
1769 case GDB_REG_GR(0): 1790 case GDB_REG_GR(0):
1770 break; 1791 break;
1771 case GDB_REG_GR(1) ... GDB_REG_GR(63): 1792 case GDB_REG_GR(1) ... GDB_REG_GR(63):
1772 __break_user_context.i.gr[addr - GDB_REG_GR(0)] = temp; 1793 __debug_user_context->i.gr[addr - GDB_REG_GR(0)] = temp;
1773 break; 1794 break;
1774 case GDB_REG_FR(0) ... GDB_REG_FR(63): 1795 case GDB_REG_FR(0) ... GDB_REG_FR(63):
1775 __break_user_context.f.fr[addr - GDB_REG_FR(0)] = temp; 1796 __debug_user_context->f.fr[addr - GDB_REG_FR(0)] = temp;
1776 break; 1797 break;
1777 case GDB_REG_PC: 1798 case GDB_REG_PC:
1778 __break_user_context.i.pc = temp; 1799 __debug_user_context->i.pc = temp;
1779 break; 1800 break;
1780 case GDB_REG_PSR: 1801 case GDB_REG_PSR:
1781 __break_user_context.i.psr = temp; 1802 __debug_user_context->i.psr = temp;
1782 break; 1803 break;
1783 case GDB_REG_CCR: 1804 case GDB_REG_CCR:
1784 __break_user_context.i.ccr = temp; 1805 __debug_user_context->i.ccr = temp;
1785 break; 1806 break;
1786 case GDB_REG_CCCR: 1807 case GDB_REG_CCCR:
1787 __break_user_context.i.cccr = temp; 1808 __debug_user_context->i.cccr = temp;
1788 break; 1809 break;
1789 case GDB_REG_BRR: 1810 case GDB_REG_BRR:
1790 __debug_regs->brr = temp; 1811 __debug_status.brr = temp;
1791 break; 1812 break;
1792 case GDB_REG_LR: 1813 case GDB_REG_LR:
1793 __break_user_context.i.lr = temp; 1814 __debug_user_context->i.lr = temp;
1794 break; 1815 break;
1795 case GDB_REG_LCR: 1816 case GDB_REG_LCR:
1796 __break_user_context.i.lcr = temp; 1817 __debug_user_context->i.lcr = temp;
1797 break; 1818 break;
1798 case GDB_REG_FSR0: 1819 case GDB_REG_FSR0:
1799 __break_user_context.f.fsr[0] = temp; 1820 __debug_user_context->f.fsr[0] = temp;
1800 break; 1821 break;
1801 case GDB_REG_ACC(0) ... GDB_REG_ACC(7): 1822 case GDB_REG_ACC(0) ... GDB_REG_ACC(7):
1802 __break_user_context.f.acc[addr - GDB_REG_ACC(0)] = temp; 1823 __debug_user_context->f.acc[addr - GDB_REG_ACC(0)] = temp;
1803 break; 1824 break;
1804 case GDB_REG_ACCG(0): 1825 case GDB_REG_ACCG(0):
1805 *(uint32_t *) &__break_user_context.f.accg[0] = temp; 1826 *(uint32_t *) &__debug_user_context->f.accg[0] = temp;
1806 break; 1827 break;
1807 case GDB_REG_ACCG(4): 1828 case GDB_REG_ACCG(4):
1808 *(uint32_t *) &__break_user_context.f.accg[4] = temp; 1829 *(uint32_t *) &__debug_user_context->f.accg[4] = temp;
1809 break; 1830 break;
1810 case GDB_REG_MSR(0) ... GDB_REG_MSR(1): 1831 case GDB_REG_MSR(0) ... GDB_REG_MSR(1):
1811 __break_user_context.f.msr[addr - GDB_REG_MSR(0)] = temp; 1832 __debug_user_context->f.msr[addr - GDB_REG_MSR(0)] = temp;
1812 break; 1833 break;
1813 case GDB_REG_GNER(0) ... GDB_REG_GNER(1): 1834 case GDB_REG_GNER(0) ... GDB_REG_GNER(1):
1814 __break_user_context.i.gner[addr - GDB_REG_GNER(0)] = temp; 1835 __debug_user_context->i.gner[addr - GDB_REG_GNER(0)] = temp;
1815 break; 1836 break;
1816 case GDB_REG_FNER(0) ... GDB_REG_FNER(1): 1837 case GDB_REG_FNER(0) ... GDB_REG_FNER(1):
1817 __break_user_context.f.fner[addr - GDB_REG_FNER(0)] = temp; 1838 __debug_user_context->f.fner[addr - GDB_REG_FNER(0)] = temp;
1818 break; 1839 break;
1819 default: 1840 default:
1820 temp2 = 0; 1841 temp2 = 0;
@@ -1850,6 +1871,7 @@ void gdbstub(int sigval)
1850 /* step to next instruction */ 1871 /* step to next instruction */
1851 case 's': 1872 case 's':
1852 __debug_regs->dcr |= DCR_SE; 1873 __debug_regs->dcr |= DCR_SE;
1874 __debug_status.dcr |= DCR_SE;
1853 goto done; 1875 goto done;
1854 1876
1855 /* set baud rate (bBB) */ 1877 /* set baud rate (bBB) */
@@ -1934,7 +1956,7 @@ void gdbstub(int sigval)
1934 } 1956 }
1935 1957
1936 done: 1958 done:
1937 restore_user_regs(&__break_user_context); 1959 restore_user_regs(&__debug_frame0->uc);
1938 1960
1939 //gdbstub_dump_debugregs(); 1961 //gdbstub_dump_debugregs();
1940 //gdbstub_printk("<-- gdbstub() %08x\n", __debug_frame->pc); 1962 //gdbstub_printk("<-- gdbstub() %08x\n", __debug_frame->pc);
@@ -1966,7 +1988,6 @@ void __init gdbstub_init(void)
1966#endif 1988#endif
1967 1989
1968 gdbstub_printk("%s", gdbstub_banner); 1990 gdbstub_printk("%s", gdbstub_banner);
1969 gdbstub_printk("DCR: %x\n", __debug_regs->dcr);
1970 1991
1971 gdbstub_io_init(); 1992 gdbstub_io_init();
1972 1993
diff --git a/arch/frv/kernel/head.S b/arch/frv/kernel/head.S
index 47c990af2e06..fecf751c5cae 100644
--- a/arch/frv/kernel/head.S
+++ b/arch/frv/kernel/head.S
@@ -11,6 +11,7 @@
11 11
12#include <linux/threads.h> 12#include <linux/threads.h>
13#include <linux/linkage.h> 13#include <linux/linkage.h>
14#include <asm/thread_info.h>
14#include <asm/ptrace.h> 15#include <asm/ptrace.h>
15#include <asm/page.h> 16#include <asm/page.h>
16#include <asm/spr-regs.h> 17#include <asm/spr-regs.h>
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index f0c767a56c65..515a5cea5469 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -26,6 +26,7 @@
26#include <linux/reboot.h> 26#include <linux/reboot.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28 28
29#include <asm/asm-offsets.h>
29#include <asm/uaccess.h> 30#include <asm/uaccess.h>
30#include <asm/system.h> 31#include <asm/system.h>
31#include <asm/setup.h> 32#include <asm/setup.h>
@@ -207,7 +208,7 @@ int copy_thread(int nr, unsigned long clone_flags,
207 208
208 regs0 = __kernel_frame0_ptr; 209 regs0 = __kernel_frame0_ptr;
209 childregs0 = (struct pt_regs *) 210 childregs0 = (struct pt_regs *)
210 (task_stack_page(p) + THREAD_SIZE - USER_CONTEXT_SIZE); 211 (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE);
211 childregs = childregs0; 212 childregs = childregs0;
212 213
213 /* set up the userspace frame (the only place that the USP is stored) */ 214 /* set up the userspace frame (the only place that the USP is stored) */
diff --git a/arch/frv/kernel/switch_to.S b/arch/frv/kernel/switch_to.S
index 9e5a583991a3..b5275fa9cd0d 100644
--- a/arch/frv/kernel/switch_to.S
+++ b/arch/frv/kernel/switch_to.S
@@ -11,6 +11,7 @@
11# 2 of the License, or (at your option) any later version. 11# 2 of the License, or (at your option) any later version.
12# 12#
13############################################################################### 13###############################################################################
14
14#include <linux/linkage.h> 15#include <linux/linkage.h>
15#include <asm/thread_info.h> 16#include <asm/thread_info.h>
16#include <asm/processor.h> 17#include <asm/processor.h>
@@ -30,7 +31,7 @@
30 # address of frame 0 (userspace) on current kernel stack 31 # address of frame 0 (userspace) on current kernel stack
31 .globl __kernel_frame0_ptr 32 .globl __kernel_frame0_ptr
32__kernel_frame0_ptr: 33__kernel_frame0_ptr:
33 .long init_thread_union + THREAD_SIZE - USER_CONTEXT_SIZE 34 .long init_thread_union + THREAD_SIZE - FRV_FRAME0_SIZE
34 35
35 # address of current task 36 # address of current task
36 .globl __kernel_current_task 37 .globl __kernel_current_task
diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c
index 98ce3628ebde..2e6098c85578 100644
--- a/arch/frv/kernel/traps.c
+++ b/arch/frv/kernel/traps.c
@@ -20,6 +20,7 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/module.h> 21#include <linux/module.h>
22 22
23#include <asm/asm-offsets.h>
23#include <asm/setup.h> 24#include <asm/setup.h>
24#include <asm/fpu.h> 25#include <asm/fpu.h>
25#include <asm/system.h> 26#include <asm/system.h>
@@ -279,20 +280,20 @@ static const char *regnames[] = {
279 280
280void show_regs(struct pt_regs *regs) 281void show_regs(struct pt_regs *regs)
281{ 282{
282 uint32_t *reg; 283 unsigned long *reg;
283 int loop; 284 int loop;
284 285
285 printk("\n"); 286 printk("\n");
286 287
287 printk("Frame: @%08x [%s]\n", 288 printk("Frame: @%08lx [%s]\n",
288 (uint32_t) regs, 289 (unsigned long) regs,
289 regs->psr & PSR_S ? "kernel" : "user"); 290 regs->psr & PSR_S ? "kernel" : "user");
290 291
291 reg = (uint32_t *) regs; 292 reg = (unsigned long *) regs;
292 for (loop = 0; loop < REG__END; loop++) { 293 for (loop = 0; loop < NR_PT_REGS; loop++) {
293 printk("%s %08x", regnames[loop + 0], reg[loop + 0]); 294 printk("%s %08lx", regnames[loop + 0], reg[loop + 0]);
294 295
295 if (loop == REG__END - 1 || loop % 5 == 4) 296 if (loop == NR_PT_REGS - 1 || loop % 5 == 4)
296 printk("\n"); 297 printk("\n");
297 else 298 else
298 printk(" | "); 299 printk(" | ");
@@ -328,7 +329,7 @@ void die_if_kernel(const char *str, ...)
328 */ 329 */
329static void show_backtrace_regs(struct pt_regs *frame) 330static void show_backtrace_regs(struct pt_regs *frame)
330{ 331{
331 uint32_t *reg; 332 unsigned long *reg;
332 int loop; 333 int loop;
333 334
334 /* print the registers for this frame */ 335 /* print the registers for this frame */
@@ -336,11 +337,11 @@ static void show_backtrace_regs(struct pt_regs *frame)
336 frame->psr & PSR_S ? "Kernel Mode" : "User Mode", 337 frame->psr & PSR_S ? "Kernel Mode" : "User Mode",
337 frame); 338 frame);
338 339
339 reg = (uint32_t *) frame; 340 reg = (unsigned long *) frame;
340 for (loop = 0; loop < REG__END; loop++) { 341 for (loop = 0; loop < NR_PT_REGS; loop++) {
341 printk("%s %08x", regnames[loop + 0], reg[loop + 0]); 342 printk("%s %08lx", regnames[loop + 0], reg[loop + 0]);
342 343
343 if (loop == REG__END - 1 || loop % 5 == 4) 344 if (loop == NR_PT_REGS - 1 || loop % 5 == 4)
344 printk("\n"); 345 printk("\n");
345 else 346 else
346 printk(" | "); 347 printk(" | ");