1
2
3
4
5
6
7
8
9
10
11
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 <unit/serial.h>
22
23 .text
24
25
26
27
28
29
30
31 .globl gdbstub_io_rx_handler
32 .type gdbstub_io_rx_handler,@function
33gdbstub_io_rx_handler:
34 movm [d2,d3,a2,a3],(sp)
35
36
37 movbu (GDBPORT_SERIAL_IIR),d2
38#endif
39
40 mov (gdbstub_rx_inp),a3
41gdbstub_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
58gdbstub_io_rx_done:
59 mov GxICR_DETECT,d2
60 movbu d2,(XIRQxICR(GDBPORT_SERIAL_IRQ))
61 movhu (XIRQxICR(GDBPORT_SERIAL_IRQ)),d2
62 movm (sp),[d2,d3,a2,a3]
63 bset 0x01,(gdbstub_busy)
64 beq gdbstub_io_rx_enter
65 rti
66
67gdbstub_io_rx_overflow:
68 bset 0x01,(gdbstub_rx_overflow)
69 bra gdbstub_io_rx_done
70
71gdbstub_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
82
83 and ~EPSW_IE,epsw
84 bclr 0x01,(gdbstub_busy)
85
86 .globl gdbstub_return
87gdbstub_return:
88 RESTORE_ALL
89
90 .size gdbstub_io_rx_handler,.-gdbstub_io_rx_handler
91