aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/process.c')
-rw-r--r--arch/powerpc/kernel/process.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 923cd2daba89..b4cc7bef6b16 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -37,9 +37,9 @@
37#include <linux/personality.h> 37#include <linux/personality.h>
38#include <linux/random.h> 38#include <linux/random.h>
39#include <linux/hw_breakpoint.h> 39#include <linux/hw_breakpoint.h>
40#include <linux/uaccess.h>
40 41
41#include <asm/pgtable.h> 42#include <asm/pgtable.h>
42#include <asm/uaccess.h>
43#include <asm/io.h> 43#include <asm/io.h>
44#include <asm/processor.h> 44#include <asm/processor.h>
45#include <asm/mmu.h> 45#include <asm/mmu.h>
@@ -499,7 +499,7 @@ static inline int set_dawr(struct arch_hw_breakpoint *brk)
499 499
500void __set_breakpoint(struct arch_hw_breakpoint *brk) 500void __set_breakpoint(struct arch_hw_breakpoint *brk)
501{ 501{
502 __get_cpu_var(current_brk) = *brk; 502 memcpy(this_cpu_ptr(&current_brk), brk, sizeof(*brk));
503 503
504 if (cpu_has_feature(CPU_FTR_DAWR)) 504 if (cpu_has_feature(CPU_FTR_DAWR))
505 set_dawr(brk); 505 set_dawr(brk);
@@ -842,7 +842,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
842 * schedule DABR 842 * schedule DABR
843 */ 843 */
844#ifndef CONFIG_HAVE_HW_BREAKPOINT 844#ifndef CONFIG_HAVE_HW_BREAKPOINT
845 if (unlikely(!hw_brk_match(&__get_cpu_var(current_brk), &new->thread.hw_brk))) 845 if (unlikely(!hw_brk_match(this_cpu_ptr(&current_brk), &new->thread.hw_brk)))
846 __set_breakpoint(&new->thread.hw_brk); 846 __set_breakpoint(&new->thread.hw_brk);
847#endif /* CONFIG_HAVE_HW_BREAKPOINT */ 847#endif /* CONFIG_HAVE_HW_BREAKPOINT */
848#endif 848#endif
@@ -856,7 +856,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
856 * Collect processor utilization data per process 856 * Collect processor utilization data per process
857 */ 857 */
858 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 858 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
859 struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array); 859 struct cpu_usage *cu = this_cpu_ptr(&cpu_usage_array);
860 long unsigned start_tb, current_tb; 860 long unsigned start_tb, current_tb;
861 start_tb = old_thread->start_tb; 861 start_tb = old_thread->start_tb;
862 cu->current_tb = current_tb = mfspr(SPRN_PURR); 862 cu->current_tb = current_tb = mfspr(SPRN_PURR);
@@ -866,7 +866,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
866#endif /* CONFIG_PPC64 */ 866#endif /* CONFIG_PPC64 */
867 867
868#ifdef CONFIG_PPC_BOOK3S_64 868#ifdef CONFIG_PPC_BOOK3S_64
869 batch = &__get_cpu_var(ppc64_tlb_batch); 869 batch = this_cpu_ptr(&ppc64_tlb_batch);
870 if (batch->active) { 870 if (batch->active) {
871 current_thread_info()->local_flags |= _TLF_LAZY_MMU; 871 current_thread_info()->local_flags |= _TLF_LAZY_MMU;
872 if (batch->index) 872 if (batch->index)
@@ -889,7 +889,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
889#ifdef CONFIG_PPC_BOOK3S_64 889#ifdef CONFIG_PPC_BOOK3S_64
890 if (current_thread_info()->local_flags & _TLF_LAZY_MMU) { 890 if (current_thread_info()->local_flags & _TLF_LAZY_MMU) {
891 current_thread_info()->local_flags &= ~_TLF_LAZY_MMU; 891 current_thread_info()->local_flags &= ~_TLF_LAZY_MMU;
892 batch = &__get_cpu_var(ppc64_tlb_batch); 892 batch = this_cpu_ptr(&ppc64_tlb_batch);
893 batch->active = 1; 893 batch->active = 1;
894 } 894 }
895#endif /* CONFIG_PPC_BOOK3S_64 */ 895#endif /* CONFIG_PPC_BOOK3S_64 */
@@ -921,12 +921,8 @@ static void show_instructions(struct pt_regs *regs)
921 pc = (unsigned long)phys_to_virt(pc); 921 pc = (unsigned long)phys_to_virt(pc);
922#endif 922#endif
923 923
924 /* We use __get_user here *only* to avoid an OOPS on a
925 * bad address because the pc *should* only be a
926 * kernel address.
927 */
928 if (!__kernel_text_address(pc) || 924 if (!__kernel_text_address(pc) ||
929 __get_user(instr, (unsigned int __user *)pc)) { 925 probe_kernel_address((unsigned int __user *)pc, instr)) {
930 printk(KERN_CONT "XXXXXXXX "); 926 printk(KERN_CONT "XXXXXXXX ");
931 } else { 927 } else {
932 if (regs->nip == pc) 928 if (regs->nip == pc)
@@ -1531,13 +1527,6 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
1531 int curr_frame = current->curr_ret_stack; 1527 int curr_frame = current->curr_ret_stack;
1532 extern void return_to_handler(void); 1528 extern void return_to_handler(void);
1533 unsigned long rth = (unsigned long)return_to_handler; 1529 unsigned long rth = (unsigned long)return_to_handler;
1534 unsigned long mrth = -1;
1535#ifdef CONFIG_PPC64
1536 extern void mod_return_to_handler(void);
1537 rth = *(unsigned long *)rth;
1538 mrth = (unsigned long)mod_return_to_handler;
1539 mrth = *(unsigned long *)mrth;
1540#endif
1541#endif 1530#endif
1542 1531
1543 sp = (unsigned long) stack; 1532 sp = (unsigned long) stack;
@@ -1562,7 +1551,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
1562 if (!firstframe || ip != lr) { 1551 if (!firstframe || ip != lr) {
1563 printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip); 1552 printk("["REG"] ["REG"] %pS", sp, ip, (void *)ip);
1564#ifdef CONFIG_FUNCTION_GRAPH_TRACER 1553#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1565 if ((ip == rth || ip == mrth) && curr_frame >= 0) { 1554 if ((ip == rth) && curr_frame >= 0) {
1566 printk(" (%pS)", 1555 printk(" (%pS)",
1567 (void *)current->ret_stack[curr_frame].ret); 1556 (void *)current->ret_stack[curr_frame].ret);
1568 curr_frame--; 1557 curr_frame--;
@@ -1665,12 +1654,3 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
1665 return ret; 1654 return ret;
1666} 1655}
1667 1656
1668unsigned long randomize_et_dyn(unsigned long base)
1669{
1670 unsigned long ret = PAGE_ALIGN(base + brk_rnd());
1671
1672 if (ret < base)
1673 return base;
1674
1675 return ret;
1676}