]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/misc/kgdbts.c
Merge git://git.infradead.org/battery-2.6
[karo-tx-linux.git] / drivers / misc / kgdbts.c
index 27dc463097f37c5e75a3f5859e8f82c65193f81f..b0c56313dbbb4928826c08f535f3305490c7c61e 100644 (file)
@@ -285,33 +285,26 @@ static void hw_break_val_write(void)
 static int check_and_rewind_pc(char *put_str, char *arg)
 {
        unsigned long addr = lookup_addr(arg);
+       unsigned long ip;
        int offset = 0;
 
        kgdb_hex2mem(&put_str[1], (char *)kgdbts_gdb_regs,
                 NUMREGBYTES);
        gdb_regs_to_pt_regs(kgdbts_gdb_regs, &kgdbts_regs);
-       v2printk("Stopped at IP: %lx\n", instruction_pointer(&kgdbts_regs));
-#ifdef CONFIG_X86
-       /* On x86 a breakpoint stop requires it to be decremented */
-       if (addr + 1 == kgdbts_regs.ip)
-               offset = -1;
-#elif defined(CONFIG_SUPERH)
-       /* On SUPERH a breakpoint stop requires it to be decremented */
-       if (addr + 2 == kgdbts_regs.pc)
-               offset = -2;
+       ip = instruction_pointer(&kgdbts_regs);
+       v2printk("Stopped at IP: %lx\n", ip);
+#ifdef GDB_ADJUSTS_BREAK_OFFSET
+       /* On some arches, a breakpoint stop requires it to be decremented */
+       if (addr + BREAK_INSTR_SIZE == ip)
+               offset = -BREAK_INSTR_SIZE;
 #endif
-       if (strcmp(arg, "silent") &&
-               instruction_pointer(&kgdbts_regs) + offset != addr) {
+       if (strcmp(arg, "silent") && ip + offset != addr) {
                eprintk("kgdbts: BP mismatch %lx expected %lx\n",
-                          instruction_pointer(&kgdbts_regs) + offset, addr);
+                          ip + offset, addr);
                return 1;
        }
-#ifdef CONFIG_X86
-       /* On x86 adjust the instruction pointer if needed */
-       kgdbts_regs.ip += offset;
-#elif defined(CONFIG_SUPERH)
-       kgdbts_regs.pc += offset;
-#endif
+       /* Readjust the instruction pointer if needed */
+       instruction_pointer_set(&kgdbts_regs, ip + offset);
        return 0;
 }
 
@@ -645,7 +638,7 @@ static int validate_simple_test(char *put_str)
 
        while (*chk_str != '\0' && *put_str != '\0') {
                /* If someone does a * to match the rest of the string, allow
-                * it, or stop if the recieved string is complete.
+                * it, or stop if the received string is complete.
                 */
                if (*put_str == '#' || *chk_str == '*')
                        return 0;