diff options
Diffstat (limited to 'kernel/kgdb.c')
-rw-r--r-- | kernel/kgdb.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/kernel/kgdb.c b/kernel/kgdb.c index 39e31a036f5..79e3c90113c 100644 --- a/kernel/kgdb.c +++ b/kernel/kgdb.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <asm/byteorder.h> | 52 | #include <asm/byteorder.h> |
53 | #include <asm/atomic.h> | 53 | #include <asm/atomic.h> |
54 | #include <asm/system.h> | 54 | #include <asm/system.h> |
55 | #include <asm/unaligned.h> | ||
55 | 56 | ||
56 | static int kgdb_break_asap; | 57 | static int kgdb_break_asap; |
57 | 58 | ||
@@ -227,8 +228,6 @@ void __weak kgdb_disable_hw_debug(struct pt_regs *regs) | |||
227 | * GDB remote protocol parser: | 228 | * GDB remote protocol parser: |
228 | */ | 229 | */ |
229 | 230 | ||
230 | static const char hexchars[] = "0123456789abcdef"; | ||
231 | |||
232 | static int hex(char ch) | 231 | static int hex(char ch) |
233 | { | 232 | { |
234 | if ((ch >= 'a') && (ch <= 'f')) | 233 | if ((ch >= 'a') && (ch <= 'f')) |
@@ -316,8 +315,8 @@ static void put_packet(char *buffer) | |||
316 | } | 315 | } |
317 | 316 | ||
318 | kgdb_io_ops->write_char('#'); | 317 | kgdb_io_ops->write_char('#'); |
319 | kgdb_io_ops->write_char(hexchars[checksum >> 4]); | 318 | kgdb_io_ops->write_char(hex_asc_hi(checksum)); |
320 | kgdb_io_ops->write_char(hexchars[checksum & 0xf]); | 319 | kgdb_io_ops->write_char(hex_asc_lo(checksum)); |
321 | if (kgdb_io_ops->flush) | 320 | if (kgdb_io_ops->flush) |
322 | kgdb_io_ops->flush(); | 321 | kgdb_io_ops->flush(); |
323 | 322 | ||
@@ -346,14 +345,6 @@ static void put_packet(char *buffer) | |||
346 | } | 345 | } |
347 | } | 346 | } |
348 | 347 | ||
349 | static char *pack_hex_byte(char *pkt, u8 byte) | ||
350 | { | ||
351 | *pkt++ = hexchars[byte >> 4]; | ||
352 | *pkt++ = hexchars[byte & 0xf]; | ||
353 | |||
354 | return pkt; | ||
355 | } | ||
356 | |||
357 | /* | 348 | /* |
358 | * Convert the memory pointed to by mem into hex, placing result in buf. | 349 | * Convert the memory pointed to by mem into hex, placing result in buf. |
359 | * Return a pointer to the last char put in buf (null). May return an error. | 350 | * Return a pointer to the last char put in buf (null). May return an error. |
@@ -486,8 +477,8 @@ static void error_packet(char *pkt, int error) | |||
486 | { | 477 | { |
487 | error = -error; | 478 | error = -error; |
488 | pkt[0] = 'E'; | 479 | pkt[0] = 'E'; |
489 | pkt[1] = hexchars[(error / 10)]; | 480 | pkt[1] = hex_asc[(error / 10)]; |
490 | pkt[2] = hexchars[(error % 10)]; | 481 | pkt[2] = hex_asc[(error % 10)]; |
491 | pkt[3] = '\0'; | 482 | pkt[3] = '\0'; |
492 | } | 483 | } |
493 | 484 | ||
@@ -518,10 +509,7 @@ static void int_to_threadref(unsigned char *id, int value) | |||
518 | scan = (unsigned char *)id; | 509 | scan = (unsigned char *)id; |
519 | while (i--) | 510 | while (i--) |
520 | *scan++ = 0; | 511 | *scan++ = 0; |
521 | *scan++ = (value >> 24) & 0xff; | 512 | put_unaligned_be32(value, scan); |
522 | *scan++ = (value >> 16) & 0xff; | ||
523 | *scan++ = (value >> 8) & 0xff; | ||
524 | *scan++ = (value & 0xff); | ||
525 | } | 513 | } |
526 | 514 | ||
527 | static struct task_struct *getthread(struct pt_regs *regs, int tid) | 515 | static struct task_struct *getthread(struct pt_regs *regs, int tid) |