.. | .. |
---|
26 | 26 | #include <asm/debug.h> |
---|
27 | 27 | #include <asm/code-patching.h> |
---|
28 | 28 | #include <linux/slab.h> |
---|
| 29 | +#include <asm/inst.h> |
---|
29 | 30 | |
---|
30 | 31 | /* |
---|
31 | 32 | * This table contains the mapping between PowerPC hardware trap types, and |
---|
.. | .. |
---|
117 | 118 | return kgdb_isremovedbreak(regs->nip); |
---|
118 | 119 | } |
---|
119 | 120 | |
---|
120 | | -static int kgdb_call_nmi_hook(struct pt_regs *regs) |
---|
| 121 | +static int kgdb_debugger_ipi(struct pt_regs *regs) |
---|
121 | 122 | { |
---|
122 | 123 | kgdb_nmicallback(raw_smp_processor_id(), regs); |
---|
123 | 124 | return 0; |
---|
124 | 125 | } |
---|
125 | 126 | |
---|
126 | 127 | #ifdef CONFIG_SMP |
---|
127 | | -void kgdb_roundup_cpus(unsigned long flags) |
---|
| 128 | +void kgdb_roundup_cpus(void) |
---|
128 | 129 | { |
---|
129 | 130 | smp_send_debugger_break(); |
---|
130 | 131 | } |
---|
.. | .. |
---|
151 | 152 | return 1; |
---|
152 | 153 | } |
---|
153 | 154 | |
---|
154 | | -static DEFINE_PER_CPU(struct thread_info, kgdb_thread_info); |
---|
155 | 155 | static int kgdb_singlestep(struct pt_regs *regs) |
---|
156 | 156 | { |
---|
157 | | - struct thread_info *thread_info, *exception_thread_info; |
---|
158 | | - struct thread_info *backup_current_thread_info = |
---|
159 | | - this_cpu_ptr(&kgdb_thread_info); |
---|
160 | | - |
---|
161 | 157 | if (user_mode(regs)) |
---|
162 | 158 | return 0; |
---|
163 | 159 | |
---|
164 | | - /* |
---|
165 | | - * On Book E and perhaps other processors, singlestep is handled on |
---|
166 | | - * the critical exception stack. This causes current_thread_info() |
---|
167 | | - * to fail, since it it locates the thread_info by masking off |
---|
168 | | - * the low bits of the current stack pointer. We work around |
---|
169 | | - * this issue by copying the thread_info from the kernel stack |
---|
170 | | - * before calling kgdb_handle_exception, and copying it back |
---|
171 | | - * afterwards. On most processors the copy is avoided since |
---|
172 | | - * exception_thread_info == thread_info. |
---|
173 | | - */ |
---|
174 | | - thread_info = (struct thread_info *)(regs->gpr[1] & ~(THREAD_SIZE-1)); |
---|
175 | | - exception_thread_info = current_thread_info(); |
---|
176 | | - |
---|
177 | | - if (thread_info != exception_thread_info) { |
---|
178 | | - /* Save the original current_thread_info. */ |
---|
179 | | - memcpy(backup_current_thread_info, exception_thread_info, sizeof *thread_info); |
---|
180 | | - memcpy(exception_thread_info, thread_info, sizeof *thread_info); |
---|
181 | | - } |
---|
182 | | - |
---|
183 | 160 | kgdb_handle_exception(0, SIGTRAP, 0, regs); |
---|
184 | | - |
---|
185 | | - if (thread_info != exception_thread_info) |
---|
186 | | - /* Restore current_thread_info lastly. */ |
---|
187 | | - memcpy(exception_thread_info, backup_current_thread_info, sizeof *thread_info); |
---|
188 | 161 | |
---|
189 | 162 | return 1; |
---|
190 | 163 | } |
---|
.. | .. |
---|
446 | 419 | { |
---|
447 | 420 | int err; |
---|
448 | 421 | unsigned int instr; |
---|
449 | | - unsigned int *addr = (unsigned int *)bpt->bpt_addr; |
---|
| 422 | + struct ppc_inst *addr = (struct ppc_inst *)bpt->bpt_addr; |
---|
450 | 423 | |
---|
451 | | - err = probe_kernel_address(addr, instr); |
---|
| 424 | + err = get_kernel_nofault(instr, (unsigned *) addr); |
---|
452 | 425 | if (err) |
---|
453 | 426 | return err; |
---|
454 | 427 | |
---|
455 | | - err = patch_instruction(addr, BREAK_INSTR); |
---|
| 428 | + err = patch_instruction(addr, ppc_inst(BREAK_INSTR)); |
---|
456 | 429 | if (err) |
---|
457 | 430 | return -EFAULT; |
---|
458 | 431 | |
---|
.. | .. |
---|
465 | 438 | { |
---|
466 | 439 | int err; |
---|
467 | 440 | unsigned int instr = *(unsigned int *)bpt->saved_instr; |
---|
468 | | - unsigned int *addr = (unsigned int *)bpt->bpt_addr; |
---|
| 441 | + struct ppc_inst *addr = (struct ppc_inst *)bpt->bpt_addr; |
---|
469 | 442 | |
---|
470 | | - err = patch_instruction(addr, instr); |
---|
| 443 | + err = patch_instruction(addr, ppc_inst(instr)); |
---|
471 | 444 | if (err) |
---|
472 | 445 | return -EFAULT; |
---|
473 | 446 | |
---|
.. | .. |
---|
477 | 450 | /* |
---|
478 | 451 | * Global data |
---|
479 | 452 | */ |
---|
480 | | -struct kgdb_arch arch_kgdb_ops; |
---|
| 453 | +const struct kgdb_arch arch_kgdb_ops; |
---|
481 | 454 | |
---|
482 | 455 | static int kgdb_not_implemented(struct pt_regs *regs) |
---|
483 | 456 | { |
---|
.. | .. |
---|
502 | 475 | old__debugger_break_match = __debugger_break_match; |
---|
503 | 476 | old__debugger_fault_handler = __debugger_fault_handler; |
---|
504 | 477 | |
---|
505 | | - __debugger_ipi = kgdb_call_nmi_hook; |
---|
| 478 | + __debugger_ipi = kgdb_debugger_ipi; |
---|
506 | 479 | __debugger = kgdb_debugger; |
---|
507 | 480 | __debugger_bpt = kgdb_handle_breakpoint; |
---|
508 | 481 | __debugger_sstep = kgdb_singlestep; |
---|