debug.S 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * linux/arch/unicore32/kernel/debug.S
  3. *
  4. * Code specific to PKUnity SoC and UniCore ISA
  5. *
  6. * Copyright (C) 2001-2010 GUAN Xue-tao
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * 32-bit debugging code
  13. */
  14. #include <linux/linkage.h>
  15. #include <asm/assembler.h>
  16. .text
  17. /*
  18. * Some debugging routines (useful if you've got MM problems and
  19. * printk isn't working). For DEBUGGING ONLY!!! Do not leave
  20. * references to these in a production kernel!
  21. */
  22. #include "debug-macro.S"
  23. /*
  24. * Useful debugging routines
  25. */
  26. ENTRY(printhex8)
  27. mov r1, #8
  28. b printhex
  29. ENDPROC(printhex8)
  30. ENTRY(printhex4)
  31. mov r1, #4
  32. b printhex
  33. ENDPROC(printhex4)
  34. ENTRY(printhex2)
  35. mov r1, #2
  36. printhex: adr r2, hexbuf
  37. add r3, r2, r1
  38. mov r1, #0
  39. stb r1, [r3]
  40. 1: and r1, r0, #15
  41. mov r0, r0 >> #4
  42. csub.a r1, #10
  43. beg 2f
  44. add r1, r1, #'0' - 'a' + 10
  45. 2: add r1, r1, #'a' - 10
  46. stb.w r1, [r3+], #-1
  47. cxor.a r3, r2
  48. bne 1b
  49. mov r0, r2
  50. b printascii
  51. ENDPROC(printhex2)
  52. .ltorg
  53. ENTRY(printascii)
  54. addruart r3
  55. b 2f
  56. 1: waituart r2, r3
  57. senduart r1, r3
  58. busyuart r2, r3
  59. cxor.a r1, #'\n'
  60. cmoveq r1, #'\r'
  61. beq 1b
  62. 2: cxor.a r0, #0
  63. beq 3f
  64. ldb.w r1, [r0]+, #1
  65. cxor.a r1, #0
  66. bne 1b
  67. 3: mov pc, lr
  68. ENDPROC(printascii)
  69. ENTRY(printch)
  70. addruart r3
  71. mov r1, r0
  72. mov r0, #0
  73. b 1b
  74. ENDPROC(printch)
  75. hexbuf: .space 16