diff options
Diffstat (limited to 'arch/mn10300/kernel/gdb-io-serial-low.S')
-rw-r--r-- | arch/mn10300/kernel/gdb-io-serial-low.S | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/arch/mn10300/kernel/gdb-io-serial-low.S b/arch/mn10300/kernel/gdb-io-serial-low.S new file mode 100644 index 000000000000..c68dcd052201 --- /dev/null +++ b/arch/mn10300/kernel/gdb-io-serial-low.S | |||
@@ -0,0 +1,90 @@ | |||
1 | ############################################################################### | ||
2 | # | ||
3 | # 16550 serial Rx interrupt handler for gdbstub I/O | ||
4 | # | ||
5 | # Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
6 | # Written by David Howells (dhowells@redhat.com) | ||
7 | # | ||
8 | # This program is free software; you can redistribute it and/or | ||
9 | # modify it under the terms of the GNU General Public Licence | ||
10 | # as published by the Free Software Foundation; either version | ||
11 | # 2 of the Licence, or (at your option) any later version. | ||
12 | # | ||
13 | ############################################################################### | ||
14 | #include <linux/sys.h> | ||
15 | #include <linux/linkage.h> | ||
16 | #include <asm/smp.h> | ||
17 | #include <asm/cpu-regs.h> | ||
18 | #include <asm/thread_info.h> | ||
19 | #include <asm/frame.inc> | ||
20 | #include <asm/intctl-regs.h> | ||
21 | #include <asm/unit/serial.h> | ||
22 | |||
23 | .text | ||
24 | |||
25 | ############################################################################### | ||
26 | # | ||
27 | # GDB stub serial receive interrupt entry point | ||
28 | # - intended to run at interrupt priority 0 | ||
29 | # | ||
30 | ############################################################################### | ||
31 | .globl gdbstub_io_rx_handler | ||
32 | .type gdbstub_io_rx_handler,@function | ||
33 | gdbstub_io_rx_handler: | ||
34 | movm [d2,d3,a2,a3],(sp) | ||
35 | |||
36 | #if 1 | ||
37 | movbu (GDBPORT_SERIAL_IIR),d2 | ||
38 | #endif | ||
39 | |||
40 | mov (gdbstub_rx_inp),a3 | ||
41 | gdbstub_io_rx_more: | ||
42 | mov a3,a2 | ||
43 | add 2,a3 | ||
44 | and 0x00000fff,a3 | ||
45 | mov (gdbstub_rx_outp),d3 | ||
46 | cmp a3,d3 | ||
47 | beq gdbstub_io_rx_overflow | ||
48 | |||
49 | movbu (GDBPORT_SERIAL_LSR),d3 | ||
50 | btst UART_LSR_DR,d3 | ||
51 | beq gdbstub_io_rx_done | ||
52 | movbu (GDBPORT_SERIAL_RX),d2 | ||
53 | movbu d3,(gdbstub_rx_buffer+1,a2) | ||
54 | movbu d2,(gdbstub_rx_buffer,a2) | ||
55 | mov a3,(gdbstub_rx_inp) | ||
56 | bra gdbstub_io_rx_more | ||
57 | |||
58 | gdbstub_io_rx_done: | ||
59 | mov GxICR_DETECT,d2 | ||
60 | movbu d2,(XIRQxICR(GDBPORT_SERIAL_IRQ)) # ACK the interrupt | ||
61 | movhu (XIRQxICR(GDBPORT_SERIAL_IRQ)),d2 # flush | ||
62 | movm (sp),[d2,d3,a2,a3] | ||
63 | bset 0x01,(gdbstub_busy) | ||
64 | beq gdbstub_io_rx_enter | ||
65 | rti | ||
66 | |||
67 | gdbstub_io_rx_overflow: | ||
68 | bset 0x01,(gdbstub_rx_overflow) | ||
69 | bra gdbstub_io_rx_done | ||
70 | |||
71 | gdbstub_io_rx_enter: | ||
72 | or EPSW_IE|EPSW_IM_1,epsw | ||
73 | add -4,sp | ||
74 | SAVE_ALL | ||
75 | |||
76 | mov 0xffffffff,d0 | ||
77 | mov d0,(REG_ORIG_D0,fp) | ||
78 | mov 0x280,d1 | ||
79 | |||
80 | mov fp,d0 | ||
81 | call gdbstub_rx_irq[],0 # gdbstub_rx_irq(regs,excep) | ||
82 | |||
83 | and ~EPSW_IE,epsw | ||
84 | bclr 0x01,(gdbstub_busy) | ||
85 | |||
86 | .globl gdbstub_return | ||
87 | gdbstub_return: | ||
88 | RESTORE_ALL | ||
89 | |||
90 | .size gdbstub_io_rx_handler,.-gdbstub_io_rx_handler | ||