diff options
Diffstat (limited to 'arch/frv/kernel/gdb-stub.c')
-rw-r--r-- | arch/frv/kernel/gdb-stub.c | 159 |
1 files changed, 90 insertions, 69 deletions
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); | |||
136 | extern void gdbstub_console_write(struct console *co, const char *p, unsigned n); | 137 | extern void gdbstub_console_write(struct console *co, const char *p, unsigned n); |
137 | 138 | ||
138 | extern volatile uint32_t __break_error_detect[3]; /* ESFR1, ESR15, EAR15 */ | 139 | extern volatile uint32_t __break_error_detect[3]; /* ESFR1, ESR15, EAR15 */ |
139 | extern struct user_context __break_user_context; | ||
140 | 140 | ||
141 | struct __debug_amr { | 141 | struct __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 | */ |
1164 | static void __attribute__((unused)) gdbstub_show_regs(void) | 1198 | static 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 | */ |
1192 | static void __attribute__((unused)) gdbstub_dump_debugregs(void) | 1226 | static 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 | ||