Author: nyan
Date: Fri Nov 23 15:42:25 2012
New Revision: 243460
URL: http://svnweb.freebsd.org/changeset/base/243460

Log:
  MFC: r240855, r242867, r242868, r242869
  
    MFi386: r237445
  
      Commit changes missed from r237435.  Properly calculate the signal
      trampoline addresses after the shared page is enabled.  Handle FreeBSD
      ABIs without shared page support too.
  
    MFi386: r238792
  
      Introduce curpcb magic variable.
  
    MFi386: r211924
  
      Register an interrupt vector for DTrace return probes.
  
    Fix some KASSERTs.
    They are missing changes from r208833, r227394 and r227442.
  
    Reduce diffs against i386.

Modified:
  stable/9/sys/pc98/pc98/machdep.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/pc98/pc98/machdep.c
==============================================================================
--- stable/9/sys/pc98/pc98/machdep.c    Fri Nov 23 15:31:00 2012        
(r243459)
+++ stable/9/sys/pc98/pc98/machdep.c    Fri Nov 23 15:42:25 2012        
(r243460)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_mp_watchdog.h"
 #include "opt_npx.h"
 #include "opt_perfmon.h"
+#include "opt_kdtrace.h"
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -407,7 +408,13 @@ osendsig(sig_t catcher, ksiginfo_t *ksi,
        }
 
        regs->tf_esp = (int)fp;
-       regs->tf_eip = PS_STRINGS - szosigcode;
+       if (p->p_sysent->sv_sigcode_base != 0) {
+               regs->tf_eip = p->p_sysent->sv_sigcode_base + szsigcode -
+                   szosigcode;
+       } else {
+               /* a.out sysentvec does not use shared page */
+               regs->tf_eip = p->p_sysent->sv_psstrings - szosigcode;
+       }
        regs->tf_eflags &= ~(PSL_T | PSL_D);
        regs->tf_cs = _ucodesel;
        regs->tf_ds = _udatasel;
@@ -534,7 +541,8 @@ freebsd4_sendsig(sig_t catcher, ksiginfo
        }
 
        regs->tf_esp = (int)sfp;
-       regs->tf_eip = PS_STRINGS - szfreebsd4_sigcode;
+       regs->tf_eip = p->p_sysent->sv_sigcode_base + szsigcode -
+           szfreebsd4_sigcode;
        regs->tf_eflags &= ~(PSL_T | PSL_D);
        regs->tf_cs = _ucodesel;
        regs->tf_ds = _udatasel;
@@ -685,7 +693,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, 
        }
 
        regs->tf_esp = (int)sfp;
-       regs->tf_eip = PS_STRINGS - *(p->p_sysent->sv_szsigcode);
+       regs->tf_eip = p->p_sysent->sv_sigcode_base;
        regs->tf_eflags &= ~(PSL_T | PSL_D);
        regs->tf_cs = _ucodesel;
        regs->tf_ds = _udatasel;
@@ -1207,7 +1215,7 @@ cpu_idle(int busy)
 
        CTR2(KTR_SPARE2, "cpu_idle(%d) at %d",
            busy, curcpu);
-#ifdef MP_WATCHDOG
+#if defined(MP_WATCHDOG)
        ap_watchdog(PCPU_GET(cpuid));
 #endif
        /* If we are busy - try to use fast methods. */
@@ -1385,7 +1393,7 @@ exec_setregs(struct thread *td, struct i
                 pcb->pcb_dr3 = 0;
                 pcb->pcb_dr6 = 0;
                 pcb->pcb_dr7 = 0;
-                if (pcb == PCPU_GET(curpcb)) {
+                if (pcb == curpcb) {
                        /*
                         * Clear the debug registers on the running
                         * CPU, otherwise they will end up affecting
@@ -1743,7 +1751,11 @@ extern inthand_t
        IDTVEC(bnd), IDTVEC(ill), IDTVEC(dna), IDTVEC(fpusegm),
        IDTVEC(tss), IDTVEC(missing), IDTVEC(stk), IDTVEC(prot),
        IDTVEC(page), IDTVEC(mchk), IDTVEC(rsvd), IDTVEC(fpu), IDTVEC(align),
-       IDTVEC(xmm), IDTVEC(lcall_syscall), IDTVEC(int0x80_syscall);
+       IDTVEC(xmm),
+#ifdef KDTRACE_HOOKS
+       IDTVEC(dtrace_ret),
+#endif
+       IDTVEC(lcall_syscall), IDTVEC(int0x80_syscall);
 
 #ifdef DDB
 /*
@@ -2123,6 +2135,8 @@ do_next:
        for (off = 0; off < round_page(msgbufsize); off += PAGE_SIZE)
                pmap_kenter((vm_offset_t)msgbufp + off, phys_avail[pa_indx] +
                    off);
+
+       PT_UPDATES_FLUSH();
 }
 
 void
@@ -2262,6 +2276,10 @@ init386(first)
            GSEL(GCODE_SEL, SEL_KPL));
        setidt(IDT_SYSCALL, &IDTVEC(int0x80_syscall), SDT_SYS386TGT, SEL_UPL,
            GSEL(GCODE_SEL, SEL_KPL));
+#ifdef KDTRACE_HOOKS
+       setidt(IDT_DTRACE_RET, &IDTVEC(dtrace_ret), SDT_SYS386TGT, SEL_UPL,
+           GSEL(GCODE_SEL, SEL_KPL));
+#endif
 
        r_idt.rd_limit = sizeof(idt0) - 1;
        r_idt.rd_base = (int) idt;
@@ -2614,7 +2632,8 @@ int
 fill_fpregs(struct thread *td, struct fpreg *fpregs)
 {
 
-       KASSERT(td == curthread || TD_IS_SUSPENDED(td),
+       KASSERT(td == curthread || TD_IS_SUSPENDED(td) ||
+           P_SHOULDSTOP(td->td_proc),
            ("not suspended thread %p", td));
 #ifdef DEV_NPX
        npxgetregs(td);
@@ -2783,6 +2802,7 @@ static void
 fpstate_drop(struct thread *td)
 {
 
+       KASSERT(PCB_USER_FPU(td->td_pcb), ("fpstate_drop: kernel-owned fpu"));
        critical_enter();
 #ifdef DEV_NPX
        if (PCPU_GET(fpcurthread) == td)
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to