gdb-io-serial-low.S 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. .text
  23. ###############################################################################
  24. #
  25. # GDB stub serial receive interrupt entry point
  26. # - intended to run at interrupt priority 0
  27. #
  28. ###############################################################################
  29. .globl gdbstub_io_rx_handler
  30. .type gdbstub_io_rx_handler,@function
  31. gdbstub_io_rx_handler:
  32. movm [d2,d3,a2,a3],(sp)
  33. #if 1
  34. movbu (GDBPORT_SERIAL_IIR),d2
  35. #endif
  36. mov (gdbstub_rx_inp),a3
  37. gdbstub_io_rx_more:
  38. mov a3,a2
  39. add 2,a3
  40. and 0x00000fff,a3
  41. mov (gdbstub_rx_outp),d3
  42. cmp a3,d3
  43. beq gdbstub_io_rx_overflow
  44. movbu (GDBPORT_SERIAL_LSR),d3
  45. btst UART_LSR_DR,d3
  46. beq gdbstub_io_rx_done
  47. movbu (GDBPORT_SERIAL_RX),d2
  48. movbu d3,(gdbstub_rx_buffer+1,a2)
  49. movbu d2,(gdbstub_rx_buffer,a2)
  50. mov a3,(gdbstub_rx_inp)
  51. bra gdbstub_io_rx_more
  52. gdbstub_io_rx_done:
  53. mov GxICR_DETECT,d2
  54. movbu d2,(XIRQxICR(GDBPORT_SERIAL_IRQ)) # ACK the interrupt
  55. movhu (XIRQxICR(GDBPORT_SERIAL_IRQ)),d2 # flush
  56. movm (sp),[d2,d3,a2,a3]
  57. bset 0x01,(gdbstub_busy)
  58. beq gdbstub_io_rx_enter
  59. rti
  60. gdbstub_io_rx_overflow:
  61. bset 0x01,(gdbstub_rx_overflow)
  62. bra gdbstub_io_rx_done
  63. gdbstub_io_rx_enter:
  64. or EPSW_IE|EPSW_IM_1,epsw
  65. add -4,sp
  66. SAVE_ALL
  67. mov 0xffffffff,d0
  68. mov d0,(REG_ORIG_D0,fp)
  69. mov 0x280,d1
  70. mov fp,d0
  71. call gdbstub_rx_irq[],0 # gdbstub_rx_irq(regs,excep)
  72. and ~EPSW_IE,epsw
  73. bclr 0x01,(gdbstub_busy)
  74. .globl gdbstub_return
  75. gdbstub_return:
  76. RESTORE_ALL
  77. .size gdbstub_io_rx_handler,.-gdbstub_io_rx_handler