Author: nwhitehorn
Date: Wed Nov  3 16:21:47 2010
New Revision: 214749
URL: http://svn.freebsd.org/changeset/base/214749

Log:
  Fix two mistakes on 32-bit systems. The slbmte code in syscall() is 64-bit
  only, and should be protected with an ifdef, and the no-execute bit in
  32-bit set_user_sr() should be set before the comparison, not after, or
  it will never match.

Modified:
  head/sys/powerpc/aim/copyinout.c
  head/sys/powerpc/aim/trap.c

Modified: head/sys/powerpc/aim/copyinout.c
==============================================================================
--- head/sys/powerpc/aim/copyinout.c    Wed Nov  3 16:19:35 2010        
(r214748)
+++ head/sys/powerpc/aim/copyinout.c    Wed Nov  3 16:21:47 2010        
(r214749)
@@ -117,13 +117,13 @@ set_user_sr(pmap_t pm, const void *addr)
 
        vsid = va_to_vsid(pm, (vm_offset_t)addr);
 
+       /* Mark segment no-execute */
+       vsid |= SR_N;
+
        /* If we have already set this VSID, we can just return */
        if (curthread->td_pcb->pcb_cpu.aim.usr_vsid == vsid)
                return;
 
-       /* Mark segment no-execute */
-       vsid |= SR_N;
-
        __asm __volatile("isync");
        curthread->td_pcb->pcb_cpu.aim.usr_segm =
            (uintptr_t)addr >> ADDR_SR_SHFT;

Modified: head/sys/powerpc/aim/trap.c
==============================================================================
--- head/sys/powerpc/aim/trap.c Wed Nov  3 16:19:35 2010        (r214748)
+++ head/sys/powerpc/aim/trap.c Wed Nov  3 16:21:47 2010        (r214749)
@@ -455,12 +455,14 @@ syscall(struct trapframe *frame)
        td = PCPU_GET(curthread);
        td->td_frame = frame;
 
+#ifdef __powerpc64__
        /*
         * Speculatively restore last user SLB segment, which we know is
         * invalid already, since we are likely to do copyin()/copyout().
         */
        __asm __volatile ("slbmte %0, %1; isync" ::
             "r"(td->td_pcb->pcb_cpu.aim.usr_vsid), "r"(USER_SLB_SLBE));
+#endif
 
        error = syscallenter(td, &sa);
        syscallret(td, error, &sa);
_______________________________________________
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