1 ###############################################################################
3 # MN10300 On-chip serial Rx interrupt handler for GDB stub I/O
5 # Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
6 # Written by David Howells (dhowells@redhat.com)
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.
13 ###############################################################################
14 #include <linux/sys.h>
15 #include <linux/linkage.h>
17 #include <asm/thread_info.h>
18 #include <asm/cpu-regs.h>
19 #include <asm/frame.inc>
20 #include <asm/intctl-regs.h>
21 #include <asm/unit/serial.h>
22 #include "mn10300-serial.h"
26 ###############################################################################
28 # GDB stub serial receive interrupt entry point
29 # - intended to run at interrupt priority 0
31 ###############################################################################
32 .globl gdbstub_io_rx_handler
33 .type gdbstub_io_rx_handler,@function
34 gdbstub_io_rx_handler:
35 movm [d2,d3,a2,a3],(sp)
37 mov (gdbstub_rx_inp),a3
41 and PAGE_SIZE_asm-1,a3
42 mov (gdbstub_rx_outp),d3
44 beq gdbstub_io_rx_overflow
48 beq gdbstub_io_rx_done
50 movbu d3,(gdbstub_rx_buffer+1,a2)
51 movbu d2,(gdbstub_rx_buffer,a2)
52 mov a3,(gdbstub_rx_inp)
53 bra gdbstub_io_rx_more
57 movbu d2,(GxICR(SCgRXIRQ)) # ACK the interrupt
58 movhu (GxICR(SCgRXIRQ)),d2 # flush
60 movm (sp),[d2,d3,a2,a3]
61 bset 0x01,(gdbstub_busy)
62 beq gdbstub_io_rx_enter
65 gdbstub_io_rx_overflow:
66 bset 0x01,(gdbstub_rx_overflow)
67 bra gdbstub_io_rx_done
69 ###############################################################################
71 # debugging interrupt - enter the GDB stub proper
73 ###############################################################################
75 or EPSW_IE|EPSW_IM_1,epsw
80 mov d0,(REG_ORIG_D0,fp)
84 call gdbstub_rx_irq[],0 # gdbstub_io_rx_irq(regs,excep)
87 bclr 0x01,(gdbstub_busy)
93 .size gdbstub_io_rx_handler,.-gdbstub_io_rx_handler