gdb-io-ttysm-low.S 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. ###############################################################################
  2. #
  3. # MN10300 On-chip serial Rx interrupt handler for GDB stub 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/thread_info.h>
  18. #include <asm/cpu-regs.h>
  19. #include <asm/frame.inc>
  20. #include <asm/intctl-regs.h>
  21. #include <unit/serial.h>
  22. #include "mn10300-serial.h"
  23. .text
  24. ###############################################################################
  25. #
  26. # GDB stub serial receive interrupt entry point
  27. # - intended to run at interrupt priority 0
  28. #
  29. ###############################################################################
  30. .globl gdbstub_io_rx_handler
  31. .type gdbstub_io_rx_handler,@function
  32. gdbstub_io_rx_handler:
  33. movm [d2,d3,a2,a3],(sp)
  34. mov (gdbstub_rx_inp),a3
  35. gdbstub_io_rx_more:
  36. mov a3,a2
  37. add 2,a3
  38. and PAGE_SIZE_asm-1,a3
  39. mov (gdbstub_rx_outp),d3
  40. cmp a3,d3
  41. beq gdbstub_io_rx_overflow
  42. movbu (SCgSTR),d3
  43. btst SC01STR_RBF,d3
  44. beq gdbstub_io_rx_done
  45. movbu (SCgRXB),d2
  46. movbu d3,(gdbstub_rx_buffer+1,a2)
  47. movbu d2,(gdbstub_rx_buffer,a2)
  48. mov a3,(gdbstub_rx_inp)
  49. bra gdbstub_io_rx_more
  50. gdbstub_io_rx_done:
  51. mov GxICR_DETECT,d2
  52. movbu d2,(GxICR(SCgRXIRQ)) # ACK the interrupt
  53. movhu (GxICR(SCgRXIRQ)),d2 # flush
  54. movm (sp),[d2,d3,a2,a3]
  55. bset 0x01,(gdbstub_busy)
  56. beq gdbstub_io_rx_enter
  57. rti
  58. gdbstub_io_rx_overflow:
  59. bset 0x01,(gdbstub_rx_overflow)
  60. bra gdbstub_io_rx_done
  61. ###############################################################################
  62. #
  63. # debugging interrupt - enter the GDB stub proper
  64. #
  65. ###############################################################################
  66. gdbstub_io_rx_enter:
  67. or EPSW_IE|EPSW_IM_1,epsw
  68. add -4,sp
  69. SAVE_ALL
  70. mov 0xffffffff,d0
  71. mov d0,(REG_ORIG_D0,fp)
  72. mov 0x280,d1
  73. mov fp,d0
  74. call gdbstub_rx_irq[],0 # gdbstub_io_rx_irq(regs,excep)
  75. and ~EPSW_IE,epsw
  76. bclr 0x01,(gdbstub_busy)
  77. .globl gdbstub_return
  78. gdbstub_return:
  79. RESTORE_ALL
  80. .size gdbstub_io_rx_handler,.-gdbstub_io_rx_handler