diff options
Diffstat (limited to 'arch/sh/kernel/kgdb_stub.c')
-rw-r--r-- | arch/sh/kernel/kgdb_stub.c | 53 |
1 files changed, 7 insertions, 46 deletions
diff --git a/arch/sh/kernel/kgdb_stub.c b/arch/sh/kernel/kgdb_stub.c index edd1ec214e6d..2fdc700dfd6e 100644 --- a/arch/sh/kernel/kgdb_stub.c +++ b/arch/sh/kernel/kgdb_stub.c | |||
@@ -150,13 +150,6 @@ struct kgdb_regs trap_registers; | |||
150 | char kgdb_in_gdb_mode; | 150 | char kgdb_in_gdb_mode; |
151 | char in_nmi; /* Set during NMI to prevent reentry */ | 151 | char in_nmi; /* Set during NMI to prevent reentry */ |
152 | int kgdb_nofault; /* Boolean to ignore bus errs (i.e. in GDB) */ | 152 | int kgdb_nofault; /* Boolean to ignore bus errs (i.e. in GDB) */ |
153 | int kgdb_enabled = 1; /* Default to enabled, cmdline can disable */ | ||
154 | |||
155 | /* Exposed for user access */ | ||
156 | struct task_struct *kgdb_current; | ||
157 | unsigned int kgdb_g_imask; | ||
158 | int kgdb_trapa_val; | ||
159 | int kgdb_excode; | ||
160 | 153 | ||
161 | /* Default values for SCI (can override via kernel args in setup.c) */ | 154 | /* Default values for SCI (can override via kernel args in setup.c) */ |
162 | #ifndef CONFIG_KGDB_DEFPORT | 155 | #ifndef CONFIG_KGDB_DEFPORT |
@@ -616,7 +609,7 @@ static short *get_step_address(void) | |||
616 | else | 609 | else |
617 | addr = trap_registers.pc + 2; | 610 | addr = trap_registers.pc + 2; |
618 | 611 | ||
619 | kgdb_flush_icache_range(addr, addr + 2); | 612 | flush_icache_range(addr, addr + 2); |
620 | return (short *) addr; | 613 | return (short *) addr; |
621 | } | 614 | } |
622 | 615 | ||
@@ -639,8 +632,7 @@ static void do_single_step(void) | |||
639 | *addr = STEP_OPCODE; | 632 | *addr = STEP_OPCODE; |
640 | 633 | ||
641 | /* Flush and return */ | 634 | /* Flush and return */ |
642 | kgdb_flush_icache_range((long) addr, (long) addr + 2); | 635 | flush_icache_range((long) addr, (long) addr + 2); |
643 | return; | ||
644 | } | 636 | } |
645 | 637 | ||
646 | /* Undo a single step */ | 638 | /* Undo a single step */ |
@@ -650,7 +642,7 @@ static void undo_single_step(void) | |||
650 | /* Use stepped_address in case we stopped elsewhere */ | 642 | /* Use stepped_address in case we stopped elsewhere */ |
651 | if (stepped_opcode != 0) { | 643 | if (stepped_opcode != 0) { |
652 | *(short*)stepped_address = stepped_opcode; | 644 | *(short*)stepped_address = stepped_opcode; |
653 | kgdb_flush_icache_range(stepped_address, stepped_address + 2); | 645 | flush_icache_range(stepped_address, stepped_address + 2); |
654 | } | 646 | } |
655 | stepped_opcode = 0; | 647 | stepped_opcode = 0; |
656 | } | 648 | } |
@@ -736,7 +728,7 @@ static void write_mem_msg(int binary) | |||
736 | ebin_to_mem(ptr, (char*)addr, length); | 728 | ebin_to_mem(ptr, (char*)addr, length); |
737 | else | 729 | else |
738 | hex_to_mem(ptr, (char*)addr, length); | 730 | hex_to_mem(ptr, (char*)addr, length); |
739 | kgdb_flush_icache_range(addr, addr + length); | 731 | flush_icache_range(addr, addr + length); |
740 | ptr = 0; | 732 | ptr = 0; |
741 | send_ok_msg(); | 733 | send_ok_msg(); |
742 | } | 734 | } |
@@ -815,14 +807,10 @@ static void set_regs_msg(void) | |||
815 | /* | 807 | /* |
816 | * Bring up the ports.. | 808 | * Bring up the ports.. |
817 | */ | 809 | */ |
818 | static int kgdb_serial_setup(void) | 810 | static int __init kgdb_serial_setup(void) |
819 | { | 811 | { |
820 | extern int kgdb_console_setup(struct console *co, char *options); | ||
821 | struct console dummy; | 812 | struct console dummy; |
822 | 813 | return kgdb_console_setup(&dummy, 0); | |
823 | kgdb_console_setup(&dummy, 0); | ||
824 | |||
825 | return 0; | ||
826 | } | 814 | } |
827 | #else | 815 | #else |
828 | #define kgdb_serial_setup() 0 | 816 | #define kgdb_serial_setup() 0 |
@@ -833,22 +821,6 @@ static void kgdb_command_loop(const int excep_code, const int trapa_value) | |||
833 | { | 821 | { |
834 | int sigval; | 822 | int sigval; |
835 | 823 | ||
836 | if (excep_code == NMI_VEC) { | ||
837 | #ifndef CONFIG_KGDB_NMI | ||
838 | printk(KERN_NOTICE "KGDB: Ignoring unexpected NMI?\n"); | ||
839 | return; | ||
840 | #else /* CONFIG_KGDB_NMI */ | ||
841 | if (!kgdb_enabled) { | ||
842 | kgdb_enabled = 1; | ||
843 | kgdb_init(); | ||
844 | } | ||
845 | #endif /* CONFIG_KGDB_NMI */ | ||
846 | } | ||
847 | |||
848 | /* Ignore if we're disabled */ | ||
849 | if (!kgdb_enabled) | ||
850 | return; | ||
851 | |||
852 | /* Enter GDB mode (e.g. after detach) */ | 824 | /* Enter GDB mode (e.g. after detach) */ |
853 | if (!kgdb_in_gdb_mode) { | 825 | if (!kgdb_in_gdb_mode) { |
854 | /* Do serial setup, notify user, issue preemptive ack */ | 826 | /* Do serial setup, notify user, issue preemptive ack */ |
@@ -959,18 +931,10 @@ static void handle_exception(struct pt_regs *regs) | |||
959 | 931 | ||
960 | /* Get excode for command loop call, user access */ | 932 | /* Get excode for command loop call, user access */ |
961 | asm("stc r2_bank, %0":"=r"(excep_code)); | 933 | asm("stc r2_bank, %0":"=r"(excep_code)); |
962 | kgdb_excode = excep_code; | ||
963 | |||
964 | /* Other interesting environment items for reference */ | ||
965 | asm("stc r6_bank, %0":"=r"(kgdb_g_imask)); | ||
966 | kgdb_current = current; | ||
967 | kgdb_trapa_val = trapa_value; | ||
968 | 934 | ||
969 | /* Act on the exception */ | 935 | /* Act on the exception */ |
970 | kgdb_command_loop(excep_code, trapa_value); | 936 | kgdb_command_loop(excep_code, trapa_value); |
971 | 937 | ||
972 | kgdb_current = NULL; | ||
973 | |||
974 | /* Copy back the (maybe modified) registers */ | 938 | /* Copy back the (maybe modified) registers */ |
975 | for (count = 0; count < 16; count++) | 939 | for (count = 0; count < 16; count++) |
976 | regs->regs[count] = trap_registers.regs[count]; | 940 | regs->regs[count] = trap_registers.regs[count]; |
@@ -994,11 +958,8 @@ asmlinkage void kgdb_handle_exception(unsigned long r4, unsigned long r5, | |||
994 | } | 958 | } |
995 | 959 | ||
996 | /* Initialise the KGDB data structures and serial configuration */ | 960 | /* Initialise the KGDB data structures and serial configuration */ |
997 | int kgdb_init(void) | 961 | int __init kgdb_init(void) |
998 | { | 962 | { |
999 | if (!kgdb_enabled) | ||
1000 | return 1; | ||
1001 | |||
1002 | in_nmi = 0; | 963 | in_nmi = 0; |
1003 | kgdb_nofault = 0; | 964 | kgdb_nofault = 0; |
1004 | stepped_opcode = 0; | 965 | stepped_opcode = 0; |