diff options
Diffstat (limited to 'arch/unicore32/kernel/debug.S')
-rw-r--r-- | arch/unicore32/kernel/debug.S | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/arch/unicore32/kernel/debug.S b/arch/unicore32/kernel/debug.S new file mode 100644 index 000000000000..029fd12f6ab0 --- /dev/null +++ b/arch/unicore32/kernel/debug.S | |||
@@ -0,0 +1,85 @@ | |||
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 | |||
17 | .text | ||
18 | |||
19 | /* | ||
20 | * Some debugging routines (useful if you've got MM problems and | ||
21 | * printk isn't working). For DEBUGGING ONLY!!! Do not leave | ||
22 | * references to these in a production kernel! | ||
23 | */ | ||
24 | #include "debug-macro.S" | ||
25 | |||
26 | /* | ||
27 | * Useful debugging routines | ||
28 | */ | ||
29 | ENTRY(printhex8) | ||
30 | mov r1, #8 | ||
31 | b printhex | ||
32 | ENDPROC(printhex8) | ||
33 | |||
34 | ENTRY(printhex4) | ||
35 | mov r1, #4 | ||
36 | b printhex | ||
37 | ENDPROC(printhex4) | ||
38 | |||
39 | ENTRY(printhex2) | ||
40 | mov r1, #2 | ||
41 | printhex: adr r2, hexbuf | ||
42 | add r3, r2, r1 | ||
43 | mov r1, #0 | ||
44 | stb r1, [r3] | ||
45 | 1: and r1, r0, #15 | ||
46 | mov r0, r0 >> #4 | ||
47 | csub.a r1, #10 | ||
48 | beg 2f | ||
49 | add r1, r1, #'0' - 'a' + 10 | ||
50 | 2: add r1, r1, #'a' - 10 | ||
51 | stb.w r1, [r3+], #-1 | ||
52 | cxor.a r3, r2 | ||
53 | bne 1b | ||
54 | mov r0, r2 | ||
55 | b printascii | ||
56 | ENDPROC(printhex2) | ||
57 | |||
58 | .ltorg | ||
59 | |||
60 | ENTRY(printascii) | ||
61 | addruart r3 | ||
62 | b 2f | ||
63 | 1: waituart r2, r3 | ||
64 | senduart r1, r3 | ||
65 | busyuart r2, r3 | ||
66 | cxor.a r1, #'\n' | ||
67 | cmoveq r1, #'\r' | ||
68 | beq 1b | ||
69 | 2: cxor.a r0, #0 | ||
70 | beq 3f | ||
71 | ldb.w r1, [r0]+, #1 | ||
72 | cxor.a r1, #0 | ||
73 | bne 1b | ||
74 | 3: mov pc, lr | ||
75 | ENDPROC(printascii) | ||
76 | |||
77 | ENTRY(printch) | ||
78 | addruart r3 | ||
79 | mov r1, r0 | ||
80 | mov r0, #0 | ||
81 | b 1b | ||
82 | ENDPROC(printch) | ||
83 | |||
84 | hexbuf: .space 16 | ||
85 | |||