aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-09-27 03:24:55 -0400
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 03:24:55 -0400
commit56e8d7b5786dc2f7d1f701500f8914fd2c52b111 (patch)
tree68654c185bdf5badbddd9698dd14bb0166b9270e
parent2549b3222f588c188674aed0b9a0ef78bbba5c6c (diff)
sh: kgdb stub cleanups.
Some kgdb cleanup. Move hexchars/highhex/lowhex to the header, so it can be reused by sh-sci. Also drop silly ctrl_inl/outl() overloading being done by the kgdb stub. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/kernel/kgdb_stub.c33
-rw-r--r--include/asm-sh/kgdb.h15
2 files changed, 20 insertions, 28 deletions
diff --git a/arch/sh/kernel/kgdb_stub.c b/arch/sh/kernel/kgdb_stub.c
index 42638b92b51c..9c6315f0335d 100644
--- a/arch/sh/kernel/kgdb_stub.c
+++ b/arch/sh/kernel/kgdb_stub.c
@@ -101,16 +101,17 @@
101#include <linux/linkage.h> 101#include <linux/linkage.h>
102#include <linux/init.h> 102#include <linux/init.h>
103 103
104#ifdef CONFIG_SH_KGDB_CONSOLE
105#include <linux/console.h>
106#endif
107
104#include <asm/system.h> 108#include <asm/system.h>
105#include <asm/current.h> 109#include <asm/current.h>
106#include <asm/signal.h> 110#include <asm/signal.h>
107#include <asm/pgtable.h> 111#include <asm/pgtable.h>
108#include <asm/ptrace.h> 112#include <asm/ptrace.h>
109#include <asm/kgdb.h> 113#include <asm/kgdb.h>
110 114#include <asm/io.h>
111#ifdef CONFIG_SH_KGDB_CONSOLE
112#include <linux/console.h>
113#endif
114 115
115/* Function pointers for linkage */ 116/* Function pointers for linkage */
116kgdb_debug_hook_t *kgdb_debug_hook; 117kgdb_debug_hook_t *kgdb_debug_hook;
@@ -240,7 +241,6 @@ static jmp_buf rem_com_env;
240/* Misc static */ 241/* Misc static */
241static int stepped_address; 242static int stepped_address;
242static short stepped_opcode; 243static short stepped_opcode;
243static const char hexchars[] = "0123456789abcdef";
244static char in_buffer[BUFMAX]; 244static char in_buffer[BUFMAX];
245static char out_buffer[OUTBUFMAX]; 245static char out_buffer[OUTBUFMAX];
246 246
@@ -253,29 +253,6 @@ typedef unsigned char threadref[8];
253#define BUF_THREAD_ID_SIZE 16 253#define BUF_THREAD_ID_SIZE 16
254#endif 254#endif
255 255
256/* Return addr as a real volatile address */
257static inline unsigned int ctrl_inl(const unsigned long addr)
258{
259 return *(volatile unsigned long *) addr;
260}
261
262/* Correctly set *addr using volatile */
263static inline void ctrl_outl(const unsigned int b, unsigned long addr)
264{
265 *(volatile unsigned long *) addr = b;
266}
267
268/* Get high hex bits */
269static char highhex(const int x)
270{
271 return hexchars[(x >> 4) & 0xf];
272}
273
274/* Get low hex bits */
275static char lowhex(const int x)
276{
277 return hexchars[x & 0xf];
278}
279 256
280/* Convert ch to hex */ 257/* Convert ch to hex */
281static int hex(const char ch) 258static int hex(const char ch)
diff --git a/include/asm-sh/kgdb.h b/include/asm-sh/kgdb.h
index 1653ffb75fbe..7b26f53fe343 100644
--- a/include/asm-sh/kgdb.h
+++ b/include/asm-sh/kgdb.h
@@ -128,4 +128,19 @@ extern int setjmp(jmp_buf __jmpb);
128#define KGDB_ASSERT(condition, message) 128#define KGDB_ASSERT(condition, message)
129#endif 129#endif
130 130
131/* Taken from sh-stub.c of GDB 4.18 */
132static const char hexchars[] = "0123456789abcdef";
133
134/* Get high hex bits */
135static inline char highhex(const int x)
136{
137 return hexchars[(x >> 4) & 0xf];
138}
139
140/* Get low hex bits */
141static inline char lowhex(const int x)
142{
143 return hexchars[x & 0xf];
144}
145
131#endif 146#endif