~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/mn10300/kernel/gdb-stub.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
#include <asm/system.h>
134
134
#include <asm/gdb-stub.h>
135
135
#include <asm/exceptions.h>
136
 
#include <asm/cacheflush.h>
 
136
#include <asm/debugger.h>
137
137
#include <asm/serial-regs.h>
138
138
#include <asm/busctl-regs.h>
139
139
#include <unit/leds.h>
405
405
        return (numChars);
406
406
}
407
407
 
 
408
#ifdef CONFIG_GDBSTUB_ALLOW_SINGLE_STEP
408
409
/*
409
410
 * We single-step by setting breakpoints. When an exception
410
411
 * is handled, we need to restore the instructions hoisted
729
730
        __gdbstub_restore_bp();
730
731
        return -EFAULT;
731
732
}
 
733
#endif /* CONFIG_GDBSTUB_ALLOW_SINGLE_STEP */
732
734
 
733
735
#ifdef CONFIG_GDBSTUB_CONSOLE
734
736
 
1171
1173
 
1172
1174
/*
1173
1175
 * This function does all command processing for interfacing to gdb
1174
 
 * - returns 1 if the exception should be skipped, 0 otherwise.
 
1176
 * - returns 0 if the exception should be skipped, -ERROR otherwise.
1175
1177
 */
1176
1178
static int gdbstub(struct pt_regs *regs, enum exception_code excep)
1177
1179
{
1186
1188
        int loop;
1187
1189
 
1188
1190
        if (excep == EXCEP_FPU_DISABLED)
1189
 
                return 0;
 
1191
                return -ENOTSUPP;
1190
1192
 
1191
1193
        gdbstub_flush_caches = 0;
1192
1194
 
1195
1197
        asm volatile("mov mdr,%0" : "=d"(mdr));
1196
1198
        local_save_flags(epsw);
1197
1199
        arch_local_change_intr_mask_level(
1198
 
                NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1));
 
1200
                NUM2EPSW_IM(CONFIG_DEBUGGER_IRQ_LEVEL + 1));
1199
1201
 
1200
1202
        gdbstub_store_fpu();
1201
1203
 
1208
1210
        /* if we were single stepping, restore the opcodes hoisted for the
1209
1211
         * breakpoint[s] */
1210
1212
        broke = 0;
 
1213
#ifdef CONFIG_GDBSTUB_ALLOW_SINGLE_STEP
1211
1214
        if ((step_bp[0].addr && step_bp[0].addr == (u8 *) regs->pc) ||
1212
1215
            (step_bp[1].addr && step_bp[1].addr == (u8 *) regs->pc))
1213
1216
                broke = 1;
1214
1217
 
1215
1218
        __gdbstub_restore_bp();
 
1219
#endif
1216
1220
 
1217
1221
        if (gdbstub_rx_unget) {
1218
1222
                sigval = SIGINT;
1548
1552
                         * Step to next instruction
1549
1553
                         */
1550
1554
                case 's':
1551
 
                        /*
1552
 
                         * using the T flag doesn't seem to perform single
 
1555
                        /* Using the T flag doesn't seem to perform single
1553
1556
                         * stepping (it seems to wind up being caught by the
1554
1557
                         * JTAG unit), so we have to use breakpoints and
1555
1558
                         * continue instead.
1556
1559
                         */
 
1560
#ifdef CONFIG_GDBSTUB_ALLOW_SINGLE_STEP
1557
1561
                        if (gdbstub_single_step(regs) < 0)
1558
1562
                                /* ignore any fault error for now */
1559
1563
                                gdbstub_printk("unable to set single-step"
1560
1564
                                               " bp\n");
1561
1565
                        goto done;
 
1566
#else
 
1567
                        gdbstub_strcpy(output_buffer, "E01");
 
1568
                        break;
 
1569
#endif
1562
1570
 
1563
1571
                        /*
1564
1572
                         * Set baud rate (bBB)
1657
1665
         * NB: We flush both caches, just to be sure...
1658
1666
         */
1659
1667
        if (gdbstub_flush_caches)
1660
 
                gdbstub_purge_cache();
 
1668
                debugger_local_cache_flushinv();
1661
1669
 
1662
1670
        gdbstub_load_fpu();
1663
1671
        mn10300_set_gdbleds(0);
1667
1675
        touch_softlockup_watchdog();
1668
1676
 
1669
1677
        local_irq_restore(epsw);
1670
 
        return 1;
 
1678
        return 0;
 
1679
}
 
1680
 
 
1681
/*
 
1682
 * Determine if we hit a debugger special breakpoint that needs skipping over
 
1683
 * automatically.
 
1684
 */
 
1685
int at_debugger_breakpoint(struct pt_regs *regs)
 
1686
{
 
1687
        return 0;
1671
1688
}
1672
1689
 
1673
1690
/*
1674
1691
 * handle event interception
1675
1692
 */
1676
 
asmlinkage int gdbstub_intercept(struct pt_regs *regs,
1677
 
                                 enum exception_code excep)
 
1693
asmlinkage int debugger_intercept(enum exception_code excep,
 
1694
                                  int signo, int si_code, struct pt_regs *regs)
1678
1695
{
1679
1696
        static u8 notfirst = 1;
1680
1697
        int ret;
1688
1705
                asm("mov mdr,%0" : "=d"(mdr));
1689
1706
 
1690
1707
                gdbstub_entry(
1691
 
                        "--> gdbstub_intercept(%p,%04x) [MDR=%lx PC=%lx]\n",
 
1708
                        "--> debugger_intercept(%p,%04x) [MDR=%lx PC=%lx]\n",
1692
1709
                        regs, excep, mdr, regs->pc);
1693
1710
 
1694
1711
                gdbstub_entry(
1722
1739
 
1723
1740
        ret = gdbstub(regs, excep);
1724
1741
 
1725
 
        gdbstub_entry("<-- gdbstub_intercept()\n");
 
1742
        gdbstub_entry("<-- debugger_intercept()\n");
1726
1743
        gdbstub_busy = 0;
1727
1744
        return ret;
1728
1745
}