Commit 84e8cd6dbc00b4979e8d1c15c80d91987aeb3417

Authored by David Howells
Committed by Linus Torvalds
1 parent 6d8c4e3b01

[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>

Showing 13 changed files with 313 additions and 197 deletions Side-by-side Diff

arch/frv/kernel/asm-offsets.c
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 +
  40 +void 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 +}
arch/frv/kernel/break.S
... ... @@ -9,11 +9,11 @@
9 9 * 2 of the License, or (at your option) any later version.
10 10 */
11 11  
12   -#include <linux/sys.h>
13 12 #include <linux/linkage.h>
14 13 #include <asm/setup.h>
15 14 #include <asm/segment.h>
16 15 #include <asm/ptrace.h>
  16 +#include <asm/thread_info.h>
17 17 #include <asm/spr-regs.h>
18 18  
19 19 #include <asm/errno.h>
20 20  
... ... @@ -23,13 +23,11 @@
23 23 #
24 24 .section .bss.stack
25 25 .globl __break_user_context
26   - .balign 8192
  26 + .balign THREAD_SIZE
27 27 __break_stack:
28   - .space (8192 - (USER_CONTEXT_SIZE + REG__DEBUG_XTRA)) & ~7
29   -__break_stack_tos:
30   - .space REG__DEBUG_XTRA
31   -__break_user_context:
32   - .space USER_CONTEXT_SIZE
  28 + .space THREAD_SIZE - FRV_FRAME0_SIZE
  29 +__break_frame_0:
  30 + .space FRV_FRAME0_SIZE
33 31  
34 32 #
35 33 # miscellaneous variables
... ... @@ -74,8 +72,8 @@
74 72 #endif
75 73 LEDS 0x1001,gr31
76 74  
77   - sethi.p %hi(__break_user_context),gr31
78   - setlo %lo(__break_user_context),gr31
  75 + sethi.p %hi(__break_frame_0),gr31
  76 + setlo %lo(__break_frame_0),gr31
79 77  
80 78 stdi gr2,@(gr31,#REG_GR(2))
81 79 movsg ccr,gr3
... ... @@ -585,8 +583,8 @@
585 583 # set up the kernel stack pointer
586 584 sti sp,@(gr31,#REG_SP)
587 585  
588   - sethi.p %hi(__break_stack_tos),sp
589   - setlo %lo(__break_stack_tos),sp
  586 + sethi.p %hi(__break_frame_0),sp
  587 + setlo %lo(__break_frame_0),sp
590 588  
591 589 # finish building the exception frame
592 590 stdi gr4 ,@(gr31,#REG_GR(4))
593 591  
... ... @@ -651,10 +649,13 @@
651 649 movsg nmar,gr5
652 650 movsg dcr,gr6
653 651  
654   - stdi gr4 ,@(gr31,#REG_BRR)
655   - sti gr19,@(gr31,#REG_BPSR)
656   - sti.p gr6 ,@(gr31,#REG_DCR)
  652 + sethi.p %hi(__debug_status),gr7
  653 + setlo %lo(__debug_status),gr7
657 654  
  655 + stdi gr4 ,@(gr7,#DEBUG_BRR)
  656 + sti gr19,@(gr7,#DEBUG_BPSR)
  657 + sti.p gr6 ,@(gr7,#DEBUG_DCR)
  658 +
658 659 # trap exceptions during break handling and disable h/w breakpoints/watchpoints
659 660 sethi %hi(DCR_EBE),gr5
660 661 setlo.p %lo(DCR_EBE),gr5
... ... @@ -698,7 +699,10 @@
698 699 lddi @(gr31,#REG_PSR) ,gr22
699 700 ldi @(gr31,#REG_PC) ,gr21
700 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 707 andi gr22,#PSR_S,gr19 /* rebuild BPSR */
704 708 andi.p gr22,#PSR_ET,gr5
arch/frv/kernel/debug-stub.c
... ... @@ -39,11 +39,10 @@
39 39 gdbstub_do_rx(); \
40 40 } while(!FLOWCTL_QUERY(LINE))
41 41  
  42 +struct frv_debug_status __debug_status;
  43 +
42 44 static void __init debug_stub_init(void);
43 45  
44   -extern asmlinkage void __break_hijack_kernel_event(void);
45   -extern asmlinkage void __break_hijack_kernel_event_breaks_here(void);
46   -
47 46 /*****************************************************************************/
48 47 /*
49 48 * debug mode handler stub
... ... @@ -67,7 +66,7 @@
67 66 __set_HSR(0, hsr0 & ~HSR0_ETMD);
68 67  
69 68 /* disable single stepping */
70   - __debug_regs->dcr &= ~DCR_SE;
  69 + __debug_status.dcr &= ~DCR_SE;
71 70  
72 71 /* kernel mode can propose an exception be handled in debug mode by jumping to a special
73 72 * location */
... ... @@ -76,8 +75,8 @@
76 75 * the top kernel context */
77 76 *__debug_frame = *__frame;
78 77 __frame = __debug_frame->next_frame;
79   - __debug_regs->brr = (__debug_frame->tbr & TBR_TT) << 12;
80   - __debug_regs->brr |= BRR_EB;
  78 + __debug_status.brr = (__debug_frame->tbr & TBR_TT) << 12;
  79 + __debug_status.brr |= BRR_EB;
81 80 }
82 81  
83 82 if (__debug_frame->pc == (unsigned long) __debug_bug_trap + 4) {
... ... @@ -124,7 +123,7 @@
124 123 __debug_frame->pc = (unsigned long) start_kernel;
125 124  
126 125 /* enable the debug events we want to trap */
127   - __debug_regs->dcr = DCR_EBE;
  126 + __debug_status.dcr = DCR_EBE;
128 127  
129 128 #ifdef CONFIG_GDBSTUB
130 129 gdbstub_init();
arch/frv/kernel/entry.S
... ... @@ -27,7 +27,6 @@
27 27 *
28 28 */
29 29  
30   -#include <linux/sys.h>
31 30 #include <linux/linkage.h>
32 31 #include <asm/thread_info.h>
33 32 #include <asm/setup.h>
arch/frv/kernel/gdb-stub.c
... ... @@ -124,6 +124,7 @@
124 124 #include <linux/slab.h>
125 125 #include <linux/nmi.h>
126 126  
  127 +#include <asm/asm-offsets.h>
127 128 #include <asm/pgtable.h>
128 129 #include <asm/system.h>
129 130 #include <asm/gdb-stub.h>
... ... @@ -136,7 +137,6 @@
136 137 extern void gdbstub_console_write(struct console *co, const char *p, unsigned n);
137 138  
138 139 extern volatile uint32_t __break_error_detect[3]; /* ESFR1, ESR15, EAR15 */
139   -extern struct user_context __break_user_context;
140 140  
141 141 struct __debug_amr {
142 142 unsigned long L, P;
... ... @@ -926,6 +926,7 @@
926 926 if (!(__debug_regs->dcr & DCR_IBE0)) {
927 927 //gdbstub_printk("set h/w break 0: %08lx\n", addr);
928 928 __debug_regs->dcr |= DCR_IBE0;
  929 + __debug_regs->ibar[0] = addr;
929 930 asm volatile("movgs %0,ibar0" : : "r"(addr));
930 931 return 0;
931 932 }
... ... @@ -933,6 +934,7 @@
933 934 if (!(__debug_regs->dcr & DCR_IBE1)) {
934 935 //gdbstub_printk("set h/w break 1: %08lx\n", addr);
935 936 __debug_regs->dcr |= DCR_IBE1;
  937 + __debug_regs->ibar[1] = addr;
936 938 asm volatile("movgs %0,ibar1" : : "r"(addr));
937 939 return 0;
938 940 }
... ... @@ -940,6 +942,7 @@
940 942 if (!(__debug_regs->dcr & DCR_IBE2)) {
941 943 //gdbstub_printk("set h/w break 2: %08lx\n", addr);
942 944 __debug_regs->dcr |= DCR_IBE2;
  945 + __debug_regs->ibar[2] = addr;
943 946 asm volatile("movgs %0,ibar2" : : "r"(addr));
944 947 return 0;
945 948 }
... ... @@ -947,6 +950,7 @@
947 950 if (!(__debug_regs->dcr & DCR_IBE3)) {
948 951 //gdbstub_printk("set h/w break 3: %08lx\n", addr);
949 952 __debug_regs->dcr |= DCR_IBE3;
  953 + __debug_regs->ibar[3] = addr;
950 954 asm volatile("movgs %0,ibar3" : : "r"(addr));
951 955 return 0;
952 956 }
953 957  
... ... @@ -971,7 +975,14 @@
971 975 if (!(__debug_regs->dcr & (DCR_DRBE0|DCR_DWBE0))) {
972 976 //gdbstub_printk("set h/w watchpoint 0 type %ld: %08lx\n", type, addr);
973 977 tmp = type==2 ? DCR_DWBE0 : type==3 ? DCR_DRBE0 : DCR_DRBE0|DCR_DWBE0;
  978 +
974 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 986 asm volatile(" movgs %0,dbar0 \n"
976 987 " movgs %1,dbmr00 \n"
977 988 " movgs %2,dbmr01 \n"
978 989  
... ... @@ -984,7 +995,14 @@
984 995 if (!(__debug_regs->dcr & (DCR_DRBE1|DCR_DWBE1))) {
985 996 //gdbstub_printk("set h/w watchpoint 1 type %ld: %08lx\n", type, addr);
986 997 tmp = type==2 ? DCR_DWBE1 : type==3 ? DCR_DRBE1 : DCR_DRBE1|DCR_DWBE1;
  998 +
987 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 1006 asm volatile(" movgs %0,dbar1 \n"
989 1007 " movgs %1,dbmr10 \n"
990 1008 " movgs %2,dbmr11 \n"
... ... @@ -1047,6 +1065,7 @@
1047 1065 if (__debug_regs->dcr & DCR_IBE0 && __get_ibar(0) == addr) {
1048 1066 //gdbstub_printk("clear h/w break 0: %08lx\n", addr);
1049 1067 __debug_regs->dcr &= ~DCR_IBE0;
  1068 + __debug_regs->ibar[0] = 0;
1050 1069 asm volatile("movgs gr0,ibar0");
1051 1070 return 0;
1052 1071 }
... ... @@ -1054,6 +1073,7 @@
1054 1073 if (__debug_regs->dcr & DCR_IBE1 && __get_ibar(1) == addr) {
1055 1074 //gdbstub_printk("clear h/w break 1: %08lx\n", addr);
1056 1075 __debug_regs->dcr &= ~DCR_IBE1;
  1076 + __debug_regs->ibar[1] = 0;
1057 1077 asm volatile("movgs gr0,ibar1");
1058 1078 return 0;
1059 1079 }
... ... @@ -1061,6 +1081,7 @@
1061 1081 if (__debug_regs->dcr & DCR_IBE2 && __get_ibar(2) == addr) {
1062 1082 //gdbstub_printk("clear h/w break 2: %08lx\n", addr);
1063 1083 __debug_regs->dcr &= ~DCR_IBE2;
  1084 + __debug_regs->ibar[2] = 0;
1064 1085 asm volatile("movgs gr0,ibar2");
1065 1086 return 0;
1066 1087 }
... ... @@ -1068,6 +1089,7 @@
1068 1089 if (__debug_regs->dcr & DCR_IBE3 && __get_ibar(3) == addr) {
1069 1090 //gdbstub_printk("clear h/w break 3: %08lx\n", addr);
1070 1091 __debug_regs->dcr &= ~DCR_IBE3;
  1092 + __debug_regs->ibar[3] = 0;
1071 1093 asm volatile("movgs gr0,ibar3");
1072 1094 return 0;
1073 1095 }
... ... @@ -1104,6 +1126,12 @@
1104 1126  
1105 1127 //gdbstub_printk("clear h/w watchpoint 0 type %ld: %08lx\n", type, addr);
1106 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 1135 asm volatile(" movgs gr0,dbar0 \n"
1108 1136 " movgs gr0,dbmr00 \n"
1109 1137 " movgs gr0,dbmr01 \n"
... ... @@ -1123,6 +1151,12 @@
1123 1151  
1124 1152 //gdbstub_printk("clear h/w watchpoint 1 type %ld: %08lx\n", type, addr);
1125 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 1160 asm volatile(" movgs gr0,dbar1 \n"
1127 1161 " movgs gr0,dbmr10 \n"
1128 1162 " movgs gr0,dbmr11 \n"
... ... @@ -1163,7 +1197,7 @@
1163 1197 */
1164 1198 static void __attribute__((unused)) gdbstub_show_regs(void)
1165 1199 {
1166   - uint32_t *reg;
  1200 + unsigned long *reg;
1167 1201 int loop;
1168 1202  
1169 1203 gdbstub_printk("\n");
1170 1204  
... ... @@ -1172,11 +1206,11 @@
1172 1206 __debug_frame,
1173 1207 __debug_frame->psr & PSR_S ? "kernel" : "user");
1174 1208  
1175   - reg = (uint32_t *) __debug_frame;
1176   - for (loop = 0; loop < REG__END; loop++) {
1177   - printk("%s %08x", regnames[loop + 0], reg[loop + 0]);
  1209 + reg = (unsigned long *) __debug_frame;
  1210 + for (loop = 0; loop < NR_PT_REGS; loop++) {
  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 1214 printk("\n");
1181 1215 else
1182 1216 printk(" | ");
1183 1217  
... ... @@ -1191,14 +1225,9 @@
1191 1225 */
1192 1226 static void __attribute__((unused)) gdbstub_dump_debugregs(void)
1193 1227 {
1194   - unsigned long x;
  1228 + gdbstub_printk("DCR %08lx ", __debug_status.dcr);
  1229 + gdbstub_printk("BRR %08lx\n", __debug_status.brr);
1195 1230  
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   -
1202 1231 gdbstub_printk("IBAR0 %08lx ", __get_ibar(0));
1203 1232 gdbstub_printk("IBAR1 %08lx ", __get_ibar(1));
1204 1233 gdbstub_printk("IBAR2 %08lx ", __get_ibar(2));
... ... @@ -1360,7 +1389,7 @@
1360 1389 #endif
1361 1390 }
1362 1391  
1363   - save_user_regs(&__break_user_context);
  1392 + save_user_regs(&__debug_frame0->uc);
1364 1393  
1365 1394 #if 0
1366 1395 gdbstub_printk("--> gdbstub() %08x %p %08x %08x\n",
... ... @@ -1389,8 +1418,8 @@
1389 1418 __debug_frame->psr &= ~PSR_S;
1390 1419 if (__debug_frame->psr & PSR_PS)
1391 1420 __debug_frame->psr |= PSR_S;
1392   - __debug_regs->brr = (__debug_frame->tbr & TBR_TT) << 12;
1393   - __debug_regs->brr |= BRR_EB;
  1421 + __debug_status.brr = (__debug_frame->tbr & TBR_TT) << 12;
  1422 + __debug_status.brr |= BRR_EB;
1394 1423 sigval = SIGINT;
1395 1424 }
1396 1425  
1397 1426  
... ... @@ -1404,15 +1433,15 @@
1404 1433 __debug_frame->psr &= ~PSR_S;
1405 1434 if (__debug_frame->psr & PSR_PS)
1406 1435 __debug_frame->psr |= PSR_S;
1407   - __debug_regs->brr = (__debug_frame->tbr & TBR_TT) << 12;
1408   - __debug_regs->brr |= BRR_EB;
  1436 + __debug_status.brr = (__debug_frame->tbr & TBR_TT) << 12;
  1437 + __debug_status.brr |= BRR_EB;
1409 1438 sigval = SIGXCPU;
1410 1439 }
1411 1440  
1412 1441 LEDS(0x5002);
1413 1442  
1414 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 1445 gdbstub_check_breakpoint();
1417 1446  
1418 1447 LEDS(0x5003);
... ... @@ -1431,7 +1460,7 @@
1431 1460 }
1432 1461  
1433 1462 if (!sigval)
1434   - sigval = gdbstub_compute_signal(__debug_regs->brr);
  1463 + sigval = gdbstub_compute_signal(__debug_status.brr);
1435 1464  
1436 1465 LEDS(0x5004);
1437 1466  
... ... @@ -1441,7 +1470,7 @@
1441 1470 if (sigval != SIGINT && sigval != SIGTRAP && sigval != SIGILL) {
1442 1471 static const char title[] = "Break ";
1443 1472 static const char crlf[] = "\r\n";
1444   - unsigned long brr = __debug_regs->brr;
  1473 + unsigned long brr = __debug_status.brr;
1445 1474 char hx;
1446 1475  
1447 1476 ptr = output_buffer;
1448 1477  
1449 1478  
1450 1479  
1451 1480  
... ... @@ -1565,28 +1594,24 @@
1565 1594 ptr = mem2hex(&zero, ptr, 4, 0);
1566 1595  
1567 1596 for (loop = 1; loop <= 27; loop++)
1568   - ptr = mem2hex((unsigned long *)__debug_frame + REG_GR(loop),
1569   - ptr, 4, 0);
  1597 + ptr = mem2hex(&__debug_user_context->i.gr[loop], ptr, 4, 0);
1570 1598 temp = (unsigned long) __frame;
1571 1599 ptr = mem2hex(&temp, ptr, 4, 0);
1572   - ptr = mem2hex((unsigned long *)__debug_frame + REG_GR(29), ptr, 4, 0);
1573   - ptr = mem2hex((unsigned long *)__debug_frame + REG_GR(30), ptr, 4, 0);
  1600 + ptr = mem2hex(&__debug_user_context->i.gr[29], ptr, 4, 0);
  1601 + ptr = mem2hex(&__debug_user_context->i.gr[30], ptr, 4, 0);
1574 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 1604 #else
1577 1605 temp = (unsigned long) __debug_frame;
1578 1606 ptr = mem2hex(&temp, ptr, 4, 0);
1579 1607 #endif
1580 1608  
1581 1609 for (loop = 32; loop <= 63; loop++)
1582   - ptr = mem2hex((unsigned long *)__debug_frame + REG_GR(loop),
1583   - ptr, 4, 0);
  1610 + ptr = mem2hex(&__debug_user_context->i.gr[loop], ptr, 4, 0);
1584 1611  
1585 1612 /* deal with FR0-FR63 */
1586 1613 for (loop = 0; loop <= 63; loop++)
1587   - ptr = mem2hex((unsigned long *)&__break_user_context +
1588   - __FPMEDIA_FR(loop),
1589   - ptr, 4, 0);
  1614 + ptr = mem2hex(&__debug_user_context->f.fr[loop], ptr, 4, 0);
1590 1615  
1591 1616 /* deal with special registers */
1592 1617 ptr = mem2hex(&__debug_frame->pc, ptr, 4, 0);
... ... @@ -1597,7 +1622,7 @@
1597 1622 ptr = mem2hex(&zero, ptr, 4, 0);
1598 1623 ptr = mem2hex(&zero, ptr, 4, 0);
1599 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 1627 asm volatile("movsg dbar0,%0" : "=r"(dbar));
1603 1628 ptr = mem2hex(&dbar, ptr, 4, 0);
1604 1629  
1605 1630  
1606 1631  
1607 1632  
... ... @@ -1622,21 +1647,21 @@
1622 1647  
1623 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 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 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 1660 ptr = mem2hex(&__debug_frame->gner0, ptr, 4, 0);
1636 1661 ptr = mem2hex(&__debug_frame->gner1, ptr, 4, 0);
1637 1662  
1638   - ptr = mem2hex(&__break_user_context.f.fner[0], ptr, 4, 0);
1639   - ptr = mem2hex(&__break_user_context.f.fner[1], ptr, 4, 0);
  1663 + ptr = mem2hex(&__debug_user_context->f.fner[0], ptr, 4, 0);
  1664 + ptr = mem2hex(&__debug_user_context->f.fner[1], ptr, 4, 0);
1640 1665  
1641 1666 break;
1642 1667  
... ... @@ -1648,8 +1673,7 @@
1648 1673 ptr = hex2mem(ptr, &temp, 4);
1649 1674  
1650 1675 for (loop = 1; loop <= 27; loop++)
1651   - ptr = hex2mem(ptr, (unsigned long *)__debug_frame + REG_GR(loop),
1652   - 4);
  1676 + ptr = hex2mem(ptr, &__debug_user_context->i.gr[loop], 4);
1653 1677  
1654 1678 ptr = hex2mem(ptr, &temp, 4);
1655 1679 __frame = (struct pt_regs *) temp;
1656 1680  
... ... @@ -1662,14 +1686,11 @@
1662 1686 #endif
1663 1687  
1664 1688 for (loop = 32; loop <= 63; loop++)
1665   - ptr = hex2mem(ptr, (unsigned long *)__debug_frame + REG_GR(loop),
1666   - 4);
  1689 + ptr = hex2mem(ptr, &__debug_user_context->i.gr[loop], 4);
1667 1690  
1668 1691 /* deal with FR0-FR63 */
1669 1692 for (loop = 0; loop <= 63; loop++)
1670   - ptr = mem2hex((unsigned long *)&__break_user_context +
1671   - __FPMEDIA_FR(loop),
1672   - ptr, 4, 0);
  1693 + ptr = mem2hex(&__debug_user_context->f.fr[loop], ptr, 4, 0);
1673 1694  
1674 1695 /* deal with special registers */
1675 1696 ptr = hex2mem(ptr, &__debug_frame->pc, 4);
1676 1697  
1677 1698  
1678 1699  
1679 1700  
... ... @@ -1694,21 +1715,21 @@
1694 1715  
1695 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 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 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 1728 ptr = hex2mem(ptr, &__debug_frame->gner0, 4);
1708 1729 ptr = hex2mem(ptr, &__debug_frame->gner1, 4);
1709 1730  
1710   - ptr = hex2mem(ptr, &__break_user_context.f.fner[0], 4);
1711   - ptr = hex2mem(ptr, &__break_user_context.f.fner[1], 4);
  1731 + ptr = hex2mem(ptr, &__debug_user_context->f.fner[0], 4);
  1732 + ptr = hex2mem(ptr, &__debug_user_context->f.fner[1], 4);
1712 1733  
1713 1734 gdbstub_strcpy(output_buffer,"OK");
1714 1735 break;
1715 1736  
1716 1737  
1717 1738  
1718 1739  
1719 1740  
1720 1741  
1721 1742  
1722 1743  
1723 1744  
1724 1745  
1725 1746  
1726 1747  
1727 1748  
1728 1749  
1729 1750  
... ... @@ -1769,52 +1790,52 @@
1769 1790 case GDB_REG_GR(0):
1770 1791 break;
1771 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 1794 break;
1774 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 1797 break;
1777 1798 case GDB_REG_PC:
1778   - __break_user_context.i.pc = temp;
  1799 + __debug_user_context->i.pc = temp;
1779 1800 break;
1780 1801 case GDB_REG_PSR:
1781   - __break_user_context.i.psr = temp;
  1802 + __debug_user_context->i.psr = temp;
1782 1803 break;
1783 1804 case GDB_REG_CCR:
1784   - __break_user_context.i.ccr = temp;
  1805 + __debug_user_context->i.ccr = temp;
1785 1806 break;
1786 1807 case GDB_REG_CCCR:
1787   - __break_user_context.i.cccr = temp;
  1808 + __debug_user_context->i.cccr = temp;
1788 1809 break;
1789 1810 case GDB_REG_BRR:
1790   - __debug_regs->brr = temp;
  1811 + __debug_status.brr = temp;
1791 1812 break;
1792 1813 case GDB_REG_LR:
1793   - __break_user_context.i.lr = temp;
  1814 + __debug_user_context->i.lr = temp;
1794 1815 break;
1795 1816 case GDB_REG_LCR:
1796   - __break_user_context.i.lcr = temp;
  1817 + __debug_user_context->i.lcr = temp;
1797 1818 break;
1798 1819 case GDB_REG_FSR0:
1799   - __break_user_context.f.fsr[0] = temp;
  1820 + __debug_user_context->f.fsr[0] = temp;
1800 1821 break;
1801 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 1824 break;
1804 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 1827 break;
1807 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 1830 break;
1810 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 1833 break;
1813 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 1836 break;
1816 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 1839 break;
1819 1840 default:
1820 1841 temp2 = 0;
... ... @@ -1850,6 +1871,7 @@
1850 1871 /* step to next instruction */
1851 1872 case 's':
1852 1873 __debug_regs->dcr |= DCR_SE;
  1874 + __debug_status.dcr |= DCR_SE;
1853 1875 goto done;
1854 1876  
1855 1877 /* set baud rate (bBB) */
... ... @@ -1934,7 +1956,7 @@
1934 1956 }
1935 1957  
1936 1958 done:
1937   - restore_user_regs(&__break_user_context);
  1959 + restore_user_regs(&__debug_frame0->uc);
1938 1960  
1939 1961 //gdbstub_dump_debugregs();
1940 1962 //gdbstub_printk("<-- gdbstub() %08x\n", __debug_frame->pc);
... ... @@ -1966,7 +1988,6 @@
1966 1988 #endif
1967 1989  
1968 1990 gdbstub_printk("%s", gdbstub_banner);
1969   - gdbstub_printk("DCR: %x\n", __debug_regs->dcr);
1970 1991  
1971 1992 gdbstub_io_init();
1972 1993  
arch/frv/kernel/head.S
... ... @@ -11,6 +11,7 @@
11 11  
12 12 #include <linux/threads.h>
13 13 #include <linux/linkage.h>
  14 +#include <asm/thread_info.h>
14 15 #include <asm/ptrace.h>
15 16 #include <asm/page.h>
16 17 #include <asm/spr-regs.h>
arch/frv/kernel/process.c
... ... @@ -26,6 +26,7 @@
26 26 #include <linux/reboot.h>
27 27 #include <linux/interrupt.h>
28 28  
  29 +#include <asm/asm-offsets.h>
29 30 #include <asm/uaccess.h>
30 31 #include <asm/system.h>
31 32 #include <asm/setup.h>
... ... @@ -207,7 +208,7 @@
207 208  
208 209 regs0 = __kernel_frame0_ptr;
209 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 212 childregs = childregs0;
212 213  
213 214 /* set up the userspace frame (the only place that the USP is stored) */
arch/frv/kernel/switch_to.S
... ... @@ -11,6 +11,7 @@
11 11 # 2 of the License, or (at your option) any later version.
12 12 #
13 13 ###############################################################################
  14 +
14 15 #include <linux/linkage.h>
15 16 #include <asm/thread_info.h>
16 17 #include <asm/processor.h>
... ... @@ -30,7 +31,7 @@
30 31 # address of frame 0 (userspace) on current kernel stack
31 32 .globl __kernel_frame0_ptr
32 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 36 # address of current task
36 37 .globl __kernel_current_task
arch/frv/kernel/traps.c
... ... @@ -20,6 +20,7 @@
20 20 #include <linux/init.h>
21 21 #include <linux/module.h>
22 22  
  23 +#include <asm/asm-offsets.h>
23 24 #include <asm/setup.h>
24 25 #include <asm/fpu.h>
25 26 #include <asm/system.h>
26 27  
27 28  
28 29  
... ... @@ -279,20 +280,20 @@
279 280  
280 281 void show_regs(struct pt_regs *regs)
281 282 {
282   - uint32_t *reg;
  283 + unsigned long *reg;
283 284 int loop;
284 285  
285 286 printk("\n");
286 287  
287   - printk("Frame: @%08x [%s]\n",
288   - (uint32_t) regs,
  288 + printk("Frame: @%08lx [%s]\n",
  289 + (unsigned long) regs,
289 290 regs->psr & PSR_S ? "kernel" : "user");
290 291  
291   - reg = (uint32_t *) regs;
292   - for (loop = 0; loop < REG__END; loop++) {
293   - printk("%s %08x", regnames[loop + 0], reg[loop + 0]);
  292 + reg = (unsigned long *) regs;
  293 + for (loop = 0; loop < NR_PT_REGS; loop++) {
  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 297 printk("\n");
297 298 else
298 299 printk(" | ");
... ... @@ -328,7 +329,7 @@
328 329 */
329 330 static void show_backtrace_regs(struct pt_regs *frame)
330 331 {
331   - uint32_t *reg;
  332 + unsigned long *reg;
332 333 int loop;
333 334  
334 335 /* print the registers for this frame */
335 336  
... ... @@ -336,11 +337,11 @@
336 337 frame->psr & PSR_S ? "Kernel Mode" : "User Mode",
337 338 frame);
338 339  
339   - reg = (uint32_t *) frame;
340   - for (loop = 0; loop < REG__END; loop++) {
341   - printk("%s %08x", regnames[loop + 0], reg[loop + 0]);
  340 + reg = (unsigned long *) frame;
  341 + for (loop = 0; loop < NR_PT_REGS; loop++) {
  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 345 printk("\n");
345 346 else
346 347 printk(" | ");
include/asm-frv/gdb-stub.h
... ... @@ -89,6 +89,7 @@
89 89  
90 90 extern asmlinkage void __debug_stub_init_break(void);
91 91 extern asmlinkage void __break_hijack_kernel_event(void);
  92 +extern asmlinkage void __break_hijack_kernel_event_breaks_here(void);
92 93 extern asmlinkage void start_kernel(void);
93 94  
94 95 extern asmlinkage void gdbstub_rx_handler(void);
... ... @@ -113,6 +114,27 @@
113 114 #else
114 115 #define gdbstub_proto(FMT,...) ({ 0; })
115 116 #endif
  117 +
  118 +/*
  119 + * we dedicate GR31 to keeping a pointer to the gdbstub exception frame
  120 + * - gr31 is destroyed on entry to the gdbstub if !MMU
  121 + * - gr31 is saved in scr3 on entry to the gdbstub if in !MMU
  122 + */
  123 +register struct frv_frame0 *__debug_frame0 asm("gr31");
  124 +
  125 +#define __debug_frame (&__debug_frame0->regs)
  126 +#define __debug_user_context (&__debug_frame0->uc)
  127 +#define __debug_regs (&__debug_frame0->debug)
  128 +#define __debug_reg(X) ((unsigned long *) ((unsigned long) &__debug_frame0 + (X)))
  129 +
  130 +struct frv_debug_status {
  131 + unsigned long bpsr;
  132 + unsigned long dcr;
  133 + unsigned long brr;
  134 + unsigned long nmar;
  135 +};
  136 +
  137 +extern struct frv_debug_status __debug_status;
116 138  
117 139 #endif /* _LANGUAGE_ASSEMBLY */
118 140 #endif /* __ASM_GDB_STUB_H */
include/asm-frv/ptrace.h
... ... @@ -62,18 +62,10 @@
62 62 #ifndef __ASSEMBLY__
63 63  
64 64 /*
65   - * dedicate GR28; to keeping the a pointer to the current exception frame
  65 + * we dedicate GR28 to keeping a pointer to the current exception frame
  66 + * - gr28 is destroyed on entry to the kernel from userspace
66 67 */
67 68 register struct pt_regs *__frame asm("gr28");
68   -register struct pt_regs *__debug_frame asm("gr31");
69   -
70   -#ifndef container_of
71   -#define container_of(ptr, type, member) ({ \
72   - const typeof( ((type *)0)->member ) *__mptr = (ptr); \
73   - (type *)( (char *)__mptr - offsetof(type,member) );})
74   -#endif
75   -
76   -#define __debug_regs container_of(__debug_frame, struct pt_debug_regs, normal_regs)
77 69  
78 70 #define user_mode(regs) (!((regs)->psr & PSR_S))
79 71 #define instruction_pointer(regs) ((regs)->pc)
include/asm-frv/registers.h
... ... @@ -23,7 +23,13 @@
23 23 *
24 24 * +0x2000 +----------------------
25 25 * | union {
26   - * | struct user_context
  26 + * | struct frv_frame0 {
  27 + * | struct user_context {
  28 + * | struct user_int_regs
  29 + * | struct user_fpmedia_regs
  30 + * | }
  31 + * | struct frv_debug_regs
  32 + * | }
27 33 * | struct pt_regs [user exception]
28 34 * | }
29 35 * +---------------------- <-- __kernel_frame0_ptr (maybe GR28)
30 36  
... ... @@ -51,11 +57,11 @@
51 57 #define _ASM_REGISTERS_H
52 58  
53 59 #ifndef __ASSEMBLY__
54   -#define __OFFSET(X) (X)
  60 +#define __OFFSET(X,N) ((X)+(N)*4)
55 61 #define __OFFSETC(X,N) xxxxxxxxxxxxxxxxxxxxxxxx
56 62 #else
57   -#define __OFFSET(X) ((X)*4)
58   -#define __OFFSETC(X,N) ((X)*4+(N))
  63 +#define __OFFSET(X,N) ((X)+(N)*4)
  64 +#define __OFFSETC(X,N) ((X)+(N))
59 65 #endif
60 66  
61 67 /*****************************************************************************/
62 68  
63 69  
... ... @@ -117,31 +123,14 @@
117 123  
118 124 #endif
119 125  
120   -#define REG_PSR __OFFSET( 0) /* Processor Status Register */
121   -#define REG_ISR __OFFSET( 1) /* Integer Status Register */
122   -#define REG_CCR __OFFSET( 2) /* Condition Code Register */
123   -#define REG_CCCR __OFFSET( 3) /* Condition Code for Conditional Insns Register */
124   -#define REG_LR __OFFSET( 4) /* Link Register */
125   -#define REG_LCR __OFFSET( 5) /* Loop Count Register */
126   -#define REG_PC __OFFSET( 6) /* Program Counter */
127   -
128   -#define REG__STATUS __OFFSET( 7) /* exception status */
129 126 #define REG__STATUS_STEP 0x00000001 /* - reenable single stepping on return */
130 127 #define REG__STATUS_STEPPED 0x00000002 /* - single step caused exception */
131 128 #define REG__STATUS_BROKE 0x00000004 /* - BREAK insn caused exception */
132 129 #define REG__STATUS_SYSC_ENTRY 0x40000000 /* - T on syscall entry (ptrace.c only) */
133 130 #define REG__STATUS_SYSC_EXIT 0x80000000 /* - T on syscall exit (ptrace.c only) */
134 131  
135   -#define REG_SYSCALLNO __OFFSET( 8) /* syscall number or -1 */
136   -#define REG_ORIG_GR8 __OFFSET( 9) /* saved GR8 for signal handling */
137   -#define REG_GNER0 __OFFSET(10)
138   -#define REG_GNER1 __OFFSET(11)
139   -#define REG_IACC0 __OFFSET(12)
  132 +#define REG_GR(R) __OFFSET(REG_GR0, (R))
140 133  
141   -#define REG_TBR __OFFSET(14) /* Trap Vector Register */
142   -#define REG_GR(R) __OFFSET((14+(R)))
143   -#define REG__END REG_GR(32)
144   -
145 134 #define REG_SP REG_GR(1)
146 135 #define REG_FP REG_GR(2)
147 136 #define REG_PREV_FRAME REG_GR(28) /* previous exception frame pointer (old gr28 value) */
148 137  
149 138  
150 139  
151 140  
... ... @@ -149,27 +138,21 @@
149 138  
150 139 /*****************************************************************************/
151 140 /*
152   - * extension tacked in front of the exception frame in debug mode
  141 + * debugging registers
153 142 */
154 143 #ifndef __ASSEMBLY__
155 144  
156   -struct pt_debug_regs
  145 +struct frv_debug_regs
157 146 {
158   - unsigned long bpsr;
159 147 unsigned long dcr;
160   - unsigned long brr;
161   - unsigned long nmar;
162   - struct pt_regs normal_regs;
  148 + unsigned long ibar[4] __attribute__((aligned(8)));
  149 + unsigned long dbar[4] __attribute__((aligned(8)));
  150 + unsigned long dbdr[4][4] __attribute__((aligned(8)));
  151 + unsigned long dbmr[4][4] __attribute__((aligned(8)));
163 152 } __attribute__((aligned(8)));
164 153  
165 154 #endif
166 155  
167   -#define REG_NMAR __OFFSET(-1)
168   -#define REG_BRR __OFFSET(-2)
169   -#define REG_DCR __OFFSET(-3)
170   -#define REG_BPSR __OFFSET(-4)
171   -#define REG__DEBUG_XTRA __OFFSET(4)
172   -
173 156 /*****************************************************************************/
174 157 /*
175 158 * userspace registers
176 159  
177 160  
178 161  
179 162  
180 163  
... ... @@ -223,34 +206,28 @@
223 206 void *extension;
224 207 } __attribute__((aligned(8)));
225 208  
226   -#endif
  209 +struct frv_frame0 {
  210 + union {
  211 + struct pt_regs regs;
  212 + struct user_context uc;
  213 + };
227 214  
228   -#define NR_USER_INT_REGS (14 + 64)
229   -#define NR_USER_FPMEDIA_REGS (64 + 2 + 2 + 8 + 8/4 + 1)
230   -#define NR_USER_CONTEXT (NR_USER_INT_REGS + NR_USER_FPMEDIA_REGS + 1)
  215 + struct frv_debug_regs debug;
231 216  
232   -#define USER_CONTEXT_SIZE (((NR_USER_CONTEXT + 1) & ~1) * 4)
  217 +} __attribute__((aligned(32)));
233 218  
234   -#define __THREAD_FRAME __OFFSET(0)
235   -#define __THREAD_CURR __OFFSET(1)
236   -#define __THREAD_SP __OFFSET(2)
237   -#define __THREAD_FP __OFFSET(3)
238   -#define __THREAD_LR __OFFSET(4)
239   -#define __THREAD_PC __OFFSET(5)
240   -#define __THREAD_GR(R) __OFFSET(6 + (R) - 16)
241   -#define __THREAD_FRAME0 __OFFSET(19)
242   -#define __THREAD_USER __OFFSET(19)
  219 +#endif
243 220  
244   -#define __USER_INT __OFFSET(0)
245   -#define __INT_GR(R) __OFFSET(14 + (R))
  221 +#define __INT_GR(R) __OFFSET(__INT_GR0, (R))
246 222  
247   -#define __USER_FPMEDIA __OFFSET(NR_USER_INT_REGS)
248   -#define __FPMEDIA_FR(R) __OFFSET(NR_USER_INT_REGS + (R))
249   -#define __FPMEDIA_FNER(R) __OFFSET(NR_USER_INT_REGS + 64 + (R))
250   -#define __FPMEDIA_MSR(R) __OFFSET(NR_USER_INT_REGS + 66 + (R))
251   -#define __FPMEDIA_ACC(R) __OFFSET(NR_USER_INT_REGS + 68 + (R))
252   -#define __FPMEDIA_ACCG(R) __OFFSETC(NR_USER_INT_REGS + 76, (R))
253   -#define __FPMEDIA_FSR(R) __OFFSET(NR_USER_INT_REGS + 78 + (R))
  223 +#define __FPMEDIA_FR(R) __OFFSET(__FPMEDIA_FR0, (R))
  224 +#define __FPMEDIA_FNER(R) __OFFSET(__FPMEDIA_FNER0, (R))
  225 +#define __FPMEDIA_MSR(R) __OFFSET(__FPMEDIA_MSR0, (R))
  226 +#define __FPMEDIA_ACC(R) __OFFSET(__FPMEDIA_ACC0, (R))
  227 +#define __FPMEDIA_ACCG(R) __OFFSETC(__FPMEDIA_ACCG0, (R))
  228 +#define __FPMEDIA_FSR(R) __OFFSET(__FPMEDIA_FSR0, (R))
  229 +
  230 +#define __THREAD_GR(R) __OFFSET(__THREAD_GR16, (R) - 16)
254 231  
255 232 #endif /* _ASM_REGISTERS_H */
include/asm-frv/thread_info.h
... ... @@ -19,6 +19,8 @@
19 19 #include <asm/processor.h>
20 20 #endif
21 21  
  22 +#define THREAD_SIZE 8192
  23 +
22 24 /*
23 25 * low level task data that entry.S needs immediate access to
24 26 * - this struct should fit entirely inside of one cache line
... ... @@ -46,15 +48,7 @@
46 48  
47 49 #else /* !__ASSEMBLY__ */
48 50  
49   -/* offsets into the thread_info struct for assembly code access */
50   -#define TI_TASK 0x00000000
51   -#define TI_EXEC_DOMAIN 0x00000004
52   -#define TI_FLAGS 0x00000008
53   -#define TI_STATUS 0x0000000C
54   -#define TI_CPU 0x00000010
55   -#define TI_PRE_COUNT 0x00000014
56   -#define TI_ADDR_LIMIT 0x00000018
57   -#define TI_RESTART_BLOCK 0x0000001C
  51 +#include <asm/asm-offsets.h>
58 52  
59 53 #endif
60 54  
... ... @@ -83,12 +77,6 @@
83 77 #define init_thread_info (init_thread_union.thread_info)
84 78 #define init_stack (init_thread_union.stack)
85 79  
86   -#ifdef CONFIG_SMALL_TASKS
87   -#define THREAD_SIZE 4096
88   -#else
89   -#define THREAD_SIZE 8192
90   -#endif
91   -
92 80 /* how to get the thread information struct from C */
93 81 register struct thread_info *__current_thread_info asm("gr15");
94 82  
... ... @@ -111,11 +99,7 @@
111 99  
112 100 #define free_thread_info(info) kfree(info)
113 101  
114   -#else /* !__ASSEMBLY__ */
115   -
116   -#define THREAD_SIZE 8192
117   -
118   -#endif
  102 +#endif /* __ASSEMBLY__ */
119 103  
120 104 /*
121 105 * thread information flags