hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/sparc/kernel/process_64.c
....@@ -41,7 +41,6 @@
4141 #include <linux/uaccess.h>
4242 #include <asm/page.h>
4343 #include <asm/pgalloc.h>
44
-#include <asm/pgtable.h>
4544 #include <asm/processor.h>
4645 #include <asm/pstate.h>
4746 #include <asm/elf.h>
....@@ -63,11 +62,11 @@
6362 {
6463 if (tlb_type != hypervisor) {
6564 touch_nmi_watchdog();
66
- local_irq_enable();
65
+ raw_local_irq_enable();
6766 } else {
6867 unsigned long pstate;
6968
70
- local_irq_enable();
69
+ raw_local_irq_enable();
7170
7271 /* The sun4v sleeping code requires that we have PSTATE.IE cleared over
7372 * the cpu sleep hypervisor call.
....@@ -195,7 +194,7 @@
195194 regs->u_regs[15]);
196195 printk("RPC: <%pS>\n", (void *) regs->u_regs[15]);
197196 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);
199198 }
200199
201200 union global_cpu_snapshot global_cpu_snapshot[NR_CPUS];
....@@ -313,7 +312,7 @@
313312 trigger_all_cpu_backtrace();
314313 }
315314
316
-static struct sysrq_key_op sparc_globalreg_op = {
315
+static const struct sysrq_key_op sparc_globalreg_op = {
317316 .handler = sysrq_handle_globreg,
318317 .help_msg = "global-regs(y)",
319318 .action_msg = "Show Global CPU Regs",
....@@ -388,7 +387,7 @@
388387 pmu_snapshot_all_cpus();
389388 }
390389
391
-static struct sysrq_key_op sparc_globalpmu_op = {
390
+static const struct sysrq_key_op sparc_globalpmu_op = {
392391 .handler = sysrq_handle_globpmu,
393392 .help_msg = "global-pmu(x)",
394393 .action_msg = "Show Global PMU Regs",
....@@ -519,7 +518,7 @@
519518
520519 static void stack_unaligned(unsigned long sp)
521520 {
522
- force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) sp, 0, current);
521
+ force_sig_fault(SIGBUS, BUS_ADRALN, (void __user *) sp, 0);
523522 }
524523
525524 static const char uwfault32[] = KERN_INFO \
....@@ -570,41 +569,7 @@
570569
571570 barf:
572571 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);
608573 }
609574
610575 /* Copy a Sparc thread. The fork() return value conventions
....@@ -612,8 +577,8 @@
612577 * Parent --> %o0 == childs pid, %o1 == 0
613578 * Child --> %o0 == parents pid, %o1 == 1
614579 */
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)
617582 {
618583 struct thread_info *t = task_thread_info(p);
619584 struct pt_regs *regs = current_pt_regs();
....@@ -632,7 +597,7 @@
632597 sizeof(struct sparc_stackf));
633598 t->fpsaved[0] = 0;
634599
635
- if (unlikely(p->flags & PF_KTHREAD)) {
600
+ if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) {
636601 memset(child_trap_frame, 0, child_stack_sz);
637602 __thread_flag_byte_ptr(t)[TI_FLAG_BYTE_CWP] =
638603 (current_pt_regs()->tstate + 1) & TSTATE_CWP;
....@@ -671,7 +636,7 @@
671636 regs->u_regs[UREG_I1] = 0;
672637
673638 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;
675640
676641 return 0;
677642 }
....@@ -700,72 +665,6 @@
700665 *dst = *src;
701666 return 0;
702667 }
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);
769668
770669 unsigned long get_wchan(struct task_struct *task)
771670 {