aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-04-03 17:33:42 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-03 17:33:42 -0400
commit3bb5da3837cc1aa17736b05139c9a22c3794851a (patch)
treec92d5684a866542b1cb20641607ac1643ce03a47 /arch/powerpc/kernel
parent7feb49c82a74bc7c091b8ab2a3f96baa33d08ece (diff)
parent9597362d354f8655ece324b01d0c640a0e99c077 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/process.c16
-rw-r--r--arch/powerpc/kernel/ptrace.c10
2 files changed, 19 insertions, 7 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 4846bf543a8c..4ec605521504 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -241,8 +241,12 @@ void discard_lazy_cpu_state(void)
241} 241}
242#endif /* CONFIG_SMP */ 242#endif /* CONFIG_SMP */
243 243
244static DEFINE_PER_CPU(unsigned long, current_dabr);
245
244int set_dabr(unsigned long dabr) 246int set_dabr(unsigned long dabr)
245{ 247{
248 __get_cpu_var(current_dabr) = dabr;
249
246#ifdef CONFIG_PPC_MERGE /* XXX for now */ 250#ifdef CONFIG_PPC_MERGE /* XXX for now */
247 if (ppc_md.set_dabr) 251 if (ppc_md.set_dabr)
248 return ppc_md.set_dabr(dabr); 252 return ppc_md.set_dabr(dabr);
@@ -259,8 +263,6 @@ int set_dabr(unsigned long dabr)
259DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array); 263DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array);
260#endif 264#endif
261 265
262static DEFINE_PER_CPU(unsigned long, current_dabr);
263
264struct task_struct *__switch_to(struct task_struct *prev, 266struct task_struct *__switch_to(struct task_struct *prev,
265 struct task_struct *new) 267 struct task_struct *new)
266{ 268{
@@ -325,10 +327,8 @@ struct task_struct *__switch_to(struct task_struct *prev,
325 327
326#endif /* CONFIG_SMP */ 328#endif /* CONFIG_SMP */
327 329
328 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) { 330 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr))
329 set_dabr(new->thread.dabr); 331 set_dabr(new->thread.dabr);
330 __get_cpu_var(current_dabr) = new->thread.dabr;
331 }
332 332
333 new_thread = &new->thread; 333 new_thread = &new->thread;
334 old_thread = &current->thread; 334 old_thread = &current->thread;
@@ -353,6 +353,12 @@ struct task_struct *__switch_to(struct task_struct *prev,
353 account_process_vtime(current); 353 account_process_vtime(current);
354 calculate_steal_time(); 354 calculate_steal_time();
355 355
356 /*
357 * We can't take a PMU exception inside _switch() since there is a
358 * window where the kernel stack SLB and the kernel stack are out
359 * of sync. Hard disable here.
360 */
361 hard_irq_disable();
356 last = _switch(old_thread, new_thread); 362 last = _switch(old_thread, new_thread);
357 363
358 local_irq_restore(flags); 364 local_irq_restore(flags);
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 7673e9865733..2a9fe97e4521 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -530,15 +530,21 @@ static int gpr32_set(struct task_struct *target,
530 --count; 530 --count;
531 } 531 }
532 532
533 if (kbuf) 533 if (kbuf) {
534 for (; count > 0 && pos <= PT_MAX_PUT_REG; --count) 534 for (; count > 0 && pos <= PT_MAX_PUT_REG; --count)
535 regs[pos++] = *k++; 535 regs[pos++] = *k++;
536 else 536 for (; count > 0 && pos < PT_TRAP; --count, ++pos)
537 ++k;
538 } else {
537 for (; count > 0 && pos <= PT_MAX_PUT_REG; --count) { 539 for (; count > 0 && pos <= PT_MAX_PUT_REG; --count) {
538 if (__get_user(reg, u++)) 540 if (__get_user(reg, u++))
539 return -EFAULT; 541 return -EFAULT;
540 regs[pos++] = reg; 542 regs[pos++] = reg;
541 } 543 }
544 for (; count > 0 && pos < PT_TRAP; --count, ++pos)
545 if (__get_user(reg, u++))
546 return -EFAULT;
547 }
542 548
543 if (count > 0 && pos == PT_TRAP) { 549 if (count > 0 && pos == PT_TRAP) {
544 if (kbuf) 550 if (kbuf)