| .. | .. |
|---|
| 41 | 41 | #include <linux/uaccess.h> |
|---|
| 42 | 42 | #include <asm/page.h> |
|---|
| 43 | 43 | #include <asm/pgalloc.h> |
|---|
| 44 | | -#include <asm/pgtable.h> |
|---|
| 45 | 44 | #include <asm/processor.h> |
|---|
| 46 | 45 | #include <asm/pstate.h> |
|---|
| 47 | 46 | #include <asm/elf.h> |
|---|
| .. | .. |
|---|
| 63 | 62 | { |
|---|
| 64 | 63 | if (tlb_type != hypervisor) { |
|---|
| 65 | 64 | touch_nmi_watchdog(); |
|---|
| 66 | | - local_irq_enable(); |
|---|
| 65 | + raw_local_irq_enable(); |
|---|
| 67 | 66 | } else { |
|---|
| 68 | 67 | unsigned long pstate; |
|---|
| 69 | 68 | |
|---|
| 70 | | - local_irq_enable(); |
|---|
| 69 | + raw_local_irq_enable(); |
|---|
| 71 | 70 | |
|---|
| 72 | 71 | /* The sun4v sleeping code requires that we have PSTATE.IE cleared over |
|---|
| 73 | 72 | * the cpu sleep hypervisor call. |
|---|
| .. | .. |
|---|
| 195 | 194 | regs->u_regs[15]); |
|---|
| 196 | 195 | printk("RPC: <%pS>\n", (void *) regs->u_regs[15]); |
|---|
| 197 | 196 | show_regwindow(regs); |
|---|
| 198 | | - show_stack(current, (unsigned long *) regs->u_regs[UREG_FP]); |
|---|
| 197 | + show_stack(current, (unsigned long *)regs->u_regs[UREG_FP], KERN_DEFAULT); |
|---|
| 199 | 198 | } |
|---|
| 200 | 199 | |
|---|
| 201 | 200 | union global_cpu_snapshot global_cpu_snapshot[NR_CPUS]; |
|---|
| .. | .. |
|---|
| 313 | 312 | trigger_all_cpu_backtrace(); |
|---|
| 314 | 313 | } |
|---|
| 315 | 314 | |
|---|
| 316 | | -static struct sysrq_key_op sparc_globalreg_op = { |
|---|
| 315 | +static const struct sysrq_key_op sparc_globalreg_op = { |
|---|
| 317 | 316 | .handler = sysrq_handle_globreg, |
|---|
| 318 | 317 | .help_msg = "global-regs(y)", |
|---|
| 319 | 318 | .action_msg = "Show Global CPU Regs", |
|---|
| .. | .. |
|---|
| 388 | 387 | pmu_snapshot_all_cpus(); |
|---|
| 389 | 388 | } |
|---|
| 390 | 389 | |
|---|
| 391 | | -static struct sysrq_key_op sparc_globalpmu_op = { |
|---|
| 390 | +static const struct sysrq_key_op sparc_globalpmu_op = { |
|---|
| 392 | 391 | .handler = sysrq_handle_globpmu, |
|---|
| 393 | 392 | .help_msg = "global-pmu(x)", |
|---|
| 394 | 393 | .action_msg = "Show Global PMU Regs", |
|---|
| .. | .. |
|---|
| 519 | 518 | |
|---|
| 520 | 519 | static void stack_unaligned(unsigned long sp) |
|---|
| 521 | 520 | { |
|---|
| 522 | | - force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) sp, 0, current); |
|---|
| 521 | + force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) sp, 0); |
|---|
| 523 | 522 | } |
|---|
| 524 | 523 | |
|---|
| 525 | 524 | static const char uwfault32[] = KERN_INFO \ |
|---|
| .. | .. |
|---|
| 570 | 569 | |
|---|
| 571 | 570 | barf: |
|---|
| 572 | 571 | set_thread_wsaved(window + 1); |
|---|
| 573 | | - force_sig(SIGSEGV, current); |
|---|
| 574 | | -} |
|---|
| 575 | | - |
|---|
| 576 | | -asmlinkage long sparc_do_fork(unsigned long clone_flags, |
|---|
| 577 | | - unsigned long stack_start, |
|---|
| 578 | | - struct pt_regs *regs, |
|---|
| 579 | | - unsigned long stack_size) |
|---|
| 580 | | -{ |
|---|
| 581 | | - int __user *parent_tid_ptr, *child_tid_ptr; |
|---|
| 582 | | - unsigned long orig_i1 = regs->u_regs[UREG_I1]; |
|---|
| 583 | | - long ret; |
|---|
| 584 | | - |
|---|
| 585 | | -#ifdef CONFIG_COMPAT |
|---|
| 586 | | - if (test_thread_flag(TIF_32BIT)) { |
|---|
| 587 | | - parent_tid_ptr = compat_ptr(regs->u_regs[UREG_I2]); |
|---|
| 588 | | - child_tid_ptr = compat_ptr(regs->u_regs[UREG_I4]); |
|---|
| 589 | | - } else |
|---|
| 590 | | -#endif |
|---|
| 591 | | - { |
|---|
| 592 | | - parent_tid_ptr = (int __user *) regs->u_regs[UREG_I2]; |
|---|
| 593 | | - child_tid_ptr = (int __user *) regs->u_regs[UREG_I4]; |
|---|
| 594 | | - } |
|---|
| 595 | | - |
|---|
| 596 | | - ret = do_fork(clone_flags, stack_start, stack_size, |
|---|
| 597 | | - parent_tid_ptr, child_tid_ptr); |
|---|
| 598 | | - |
|---|
| 599 | | - /* If we get an error and potentially restart the system |
|---|
| 600 | | - * call, we're screwed because copy_thread() clobbered |
|---|
| 601 | | - * the parent's %o1. So detect that case and restore it |
|---|
| 602 | | - * here. |
|---|
| 603 | | - */ |
|---|
| 604 | | - if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK) |
|---|
| 605 | | - regs->u_regs[UREG_I1] = orig_i1; |
|---|
| 606 | | - |
|---|
| 607 | | - return ret; |
|---|
| 572 | + force_sig(SIGSEGV); |
|---|
| 608 | 573 | } |
|---|
| 609 | 574 | |
|---|
| 610 | 575 | /* Copy a Sparc thread. The fork() return value conventions |
|---|
| .. | .. |
|---|
| 612 | 577 | * Parent --> %o0 == childs pid, %o1 == 0 |
|---|
| 613 | 578 | * Child --> %o0 == parents pid, %o1 == 1 |
|---|
| 614 | 579 | */ |
|---|
| 615 | | -int copy_thread(unsigned long clone_flags, unsigned long sp, |
|---|
| 616 | | - unsigned long arg, struct task_struct *p) |
|---|
| 580 | +int copy_thread(unsigned long clone_flags, unsigned long sp, unsigned long arg, |
|---|
| 581 | + struct task_struct *p, unsigned long tls) |
|---|
| 617 | 582 | { |
|---|
| 618 | 583 | struct thread_info *t = task_thread_info(p); |
|---|
| 619 | 584 | struct pt_regs *regs = current_pt_regs(); |
|---|
| .. | .. |
|---|
| 632 | 597 | sizeof(struct sparc_stackf)); |
|---|
| 633 | 598 | t->fpsaved[0] = 0; |
|---|
| 634 | 599 | |
|---|
| 635 | | - if (unlikely(p->flags & PF_KTHREAD)) { |
|---|
| 600 | + if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) { |
|---|
| 636 | 601 | memset(child_trap_frame, 0, child_stack_sz); |
|---|
| 637 | 602 | __thread_flag_byte_ptr(t)[TI_FLAG_BYTE_CWP] = |
|---|
| 638 | 603 | (current_pt_regs()->tstate + 1) & TSTATE_CWP; |
|---|
| .. | .. |
|---|
| 671 | 636 | regs->u_regs[UREG_I1] = 0; |
|---|
| 672 | 637 | |
|---|
| 673 | 638 | if (clone_flags & CLONE_SETTLS) |
|---|
| 674 | | - t->kregs->u_regs[UREG_G7] = regs->u_regs[UREG_I3]; |
|---|
| 639 | + t->kregs->u_regs[UREG_G7] = tls; |
|---|
| 675 | 640 | |
|---|
| 676 | 641 | return 0; |
|---|
| 677 | 642 | } |
|---|
| .. | .. |
|---|
| 700 | 665 | *dst = *src; |
|---|
| 701 | 666 | return 0; |
|---|
| 702 | 667 | } |
|---|
| 703 | | - |
|---|
| 704 | | -typedef struct { |
|---|
| 705 | | - union { |
|---|
| 706 | | - unsigned int pr_regs[32]; |
|---|
| 707 | | - unsigned long pr_dregs[16]; |
|---|
| 708 | | - } pr_fr; |
|---|
| 709 | | - unsigned int __unused; |
|---|
| 710 | | - unsigned int pr_fsr; |
|---|
| 711 | | - unsigned char pr_qcnt; |
|---|
| 712 | | - unsigned char pr_q_entrysize; |
|---|
| 713 | | - unsigned char pr_en; |
|---|
| 714 | | - unsigned int pr_q[64]; |
|---|
| 715 | | -} elf_fpregset_t32; |
|---|
| 716 | | - |
|---|
| 717 | | -/* |
|---|
| 718 | | - * fill in the fpu structure for a core dump. |
|---|
| 719 | | - */ |
|---|
| 720 | | -int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs) |
|---|
| 721 | | -{ |
|---|
| 722 | | - unsigned long *kfpregs = current_thread_info()->fpregs; |
|---|
| 723 | | - unsigned long fprs = current_thread_info()->fpsaved[0]; |
|---|
| 724 | | - |
|---|
| 725 | | - if (test_thread_flag(TIF_32BIT)) { |
|---|
| 726 | | - elf_fpregset_t32 *fpregs32 = (elf_fpregset_t32 *)fpregs; |
|---|
| 727 | | - |
|---|
| 728 | | - if (fprs & FPRS_DL) |
|---|
| 729 | | - memcpy(&fpregs32->pr_fr.pr_regs[0], kfpregs, |
|---|
| 730 | | - sizeof(unsigned int) * 32); |
|---|
| 731 | | - else |
|---|
| 732 | | - memset(&fpregs32->pr_fr.pr_regs[0], 0, |
|---|
| 733 | | - sizeof(unsigned int) * 32); |
|---|
| 734 | | - fpregs32->pr_qcnt = 0; |
|---|
| 735 | | - fpregs32->pr_q_entrysize = 8; |
|---|
| 736 | | - memset(&fpregs32->pr_q[0], 0, |
|---|
| 737 | | - (sizeof(unsigned int) * 64)); |
|---|
| 738 | | - if (fprs & FPRS_FEF) { |
|---|
| 739 | | - fpregs32->pr_fsr = (unsigned int) current_thread_info()->xfsr[0]; |
|---|
| 740 | | - fpregs32->pr_en = 1; |
|---|
| 741 | | - } else { |
|---|
| 742 | | - fpregs32->pr_fsr = 0; |
|---|
| 743 | | - fpregs32->pr_en = 0; |
|---|
| 744 | | - } |
|---|
| 745 | | - } else { |
|---|
| 746 | | - if(fprs & FPRS_DL) |
|---|
| 747 | | - memcpy(&fpregs->pr_regs[0], kfpregs, |
|---|
| 748 | | - sizeof(unsigned int) * 32); |
|---|
| 749 | | - else |
|---|
| 750 | | - memset(&fpregs->pr_regs[0], 0, |
|---|
| 751 | | - sizeof(unsigned int) * 32); |
|---|
| 752 | | - if(fprs & FPRS_DU) |
|---|
| 753 | | - memcpy(&fpregs->pr_regs[16], kfpregs+16, |
|---|
| 754 | | - sizeof(unsigned int) * 32); |
|---|
| 755 | | - else |
|---|
| 756 | | - memset(&fpregs->pr_regs[16], 0, |
|---|
| 757 | | - sizeof(unsigned int) * 32); |
|---|
| 758 | | - if(fprs & FPRS_FEF) { |
|---|
| 759 | | - fpregs->pr_fsr = current_thread_info()->xfsr[0]; |
|---|
| 760 | | - fpregs->pr_gsr = current_thread_info()->gsr[0]; |
|---|
| 761 | | - } else { |
|---|
| 762 | | - fpregs->pr_fsr = fpregs->pr_gsr = 0; |
|---|
| 763 | | - } |
|---|
| 764 | | - fpregs->pr_fprs = fprs; |
|---|
| 765 | | - } |
|---|
| 766 | | - return 1; |
|---|
| 767 | | -} |
|---|
| 768 | | -EXPORT_SYMBOL(dump_fpu); |
|---|
| 769 | 668 | |
|---|
| 770 | 669 | unsigned long get_wchan(struct task_struct *task) |
|---|
| 771 | 670 | { |
|---|