Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Nov 2010 16:21:47 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r214749 - head/sys/powerpc/aim
Message-ID:  <201011031621.oA3GLlOk026612@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011031621.oA3GLlOk026612>