diff options
Diffstat (limited to 'kernel/kgdb.c')
-rw-r--r-- | kernel/kgdb.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/kernel/kgdb.c b/kernel/kgdb.c index 14787de568b3..3ec23c3ec97f 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 | ||
@@ -478,8 +477,8 @@ static void error_packet(char *pkt, int error) | |||
478 | { | 477 | { |
479 | error = -error; | 478 | error = -error; |
480 | pkt[0] = 'E'; | 479 | pkt[0] = 'E'; |
481 | pkt[1] = hexchars[(error / 10)]; | 480 | pkt[1] = hex_asc[(error / 10)]; |
482 | pkt[2] = hexchars[(error % 10)]; | 481 | pkt[2] = hex_asc[(error % 10)]; |
483 | pkt[3] = '\0'; | 482 | pkt[3] = '\0'; |
484 | } | 483 | } |
485 | 484 | ||
@@ -510,10 +509,7 @@ static void int_to_threadref(unsigned char *id, int value) | |||
510 | scan = (unsigned char *)id; | 509 | scan = (unsigned char *)id; |
511 | while (i--) | 510 | while (i--) |
512 | *scan++ = 0; | 511 | *scan++ = 0; |
513 | *scan++ = (value >> 24) & 0xff; | 512 | put_unaligned_be32(value, scan); |
514 | *scan++ = (value >> 16) & 0xff; | ||
515 | *scan++ = (value >> 8) & 0xff; | ||
516 | *scan++ = (value & 0xff); | ||
517 | } | 513 | } |
518 | 514 | ||
519 | static struct task_struct *getthread(struct pt_regs *regs, int tid) | 515 | static struct task_struct *getthread(struct pt_regs *regs, int tid) |
@@ -1503,7 +1499,8 @@ int kgdb_nmicallback(int cpu, void *regs) | |||
1503 | return 1; | 1499 | return 1; |
1504 | } | 1500 | } |
1505 | 1501 | ||
1506 | void kgdb_console_write(struct console *co, const char *s, unsigned count) | 1502 | static void kgdb_console_write(struct console *co, const char *s, |
1503 | unsigned count) | ||
1507 | { | 1504 | { |
1508 | unsigned long flags; | 1505 | unsigned long flags; |
1509 | 1506 | ||