2 * linux/arch/arm/kernel/debug.S
4 * Copyright (C) 1994-1999 Russell King
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * 32-bit debugging code
12 #include <linux/linkage.h>
13 #include <asm/assembler.h>
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!
23 #if defined(CONFIG_DEBUG_ICEDCC)
24 @@ debug using ARM EmbeddedICE DCC channel
26 .macro addruart, rp, rv, tmp
29 #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) || defined(CONFIG_CPU_V7)
31 .macro senduart, rd, rx
32 mcr p14, 0, \rd, c0, c5, 0
35 .macro busyuart, rd, rx
37 mrc p14, 0, \rx, c0, c1, 0
42 .macro waituart, rd, rx
47 mrc p14, 0, \rx, c0, c1, 0
53 #elif defined(CONFIG_CPU_XSCALE)
55 .macro senduart, rd, rx
56 mcr p14, 0, \rd, c8, c0, 0
59 .macro busyuart, rd, rx
61 mrc p14, 0, \rx, c14, c0, 0
66 .macro waituart, rd, rx
71 mrc p14, 0, \rx, c14, c0, 0
79 .macro senduart, rd, rx
80 mcr p14, 0, \rd, c1, c0, 0
83 .macro busyuart, rd, rx
85 mrc p14, 0, \rx, c0, c0, 0
91 .macro waituart, rd, rx
96 mrc p14, 0, \rx, c0, c0, 0
102 #endif /* CONFIG_CPU_V6 */
104 #elif !defined(CONFIG_DEBUG_SEMIHOSTING)
105 #include <mach/debug-macro.S>
106 #endif /* CONFIG_DEBUG_ICEDCC */
109 .macro addruart_current, rx, tmp1, tmp2
110 addruart \tmp1, \tmp2, \rx
111 mrc p15, 0, \rx, c1, c0
117 #else /* !CONFIG_MMU */
118 .macro addruart_current, rx, tmp1, tmp2
122 #endif /* CONFIG_MMU */
125 * Useful debugging routines
139 printhex: adr r2, hexbuf
147 addge r1, r1, #'a' - 10
159 #ifndef CONFIG_DEBUG_SEMIHOSTING
162 addruart_current r3, r1, r2
178 addruart_current r3, r1, r2
188 mov r0, #0x04 @ SYS_WRITE0
197 mov r0, #0x03 @ SYS_WRITEC