Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 May 2003 18:21:15 -0700 (PDT)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 32084 for review
Message-ID:  <200305300121.h4U1LFQv083953@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=32084

Change 32084 by marcel@marcel_nfs on 2003/05/29 18:20:53

	When we discard user registers on the kernel stack
	when we execve, make sure we have them all written
	to the backing store first. We cannot discard them
	is they are still dirty.

Affected files ...

.. //depot/projects/ia64/sys/ia64/ia64/machdep.c#73 edit

Differences ...

==== //depot/projects/ia64/sys/ia64/ia64/machdep.c#73 (text+ko) ====

@@ -1077,8 +1077,18 @@
 	if (ndirty > 0) {
 		__asm __volatile("mov	ar.rsc=0;;");
 		__asm __volatile("mov	%0=ar.bspstore" : "=r"(bspst));
-		rssz = bspst - kstack - ndirty;
-		bcopy((void*)(kstack + ndirty), (void*)kstack, rssz);
+		/*
+		 * Make sure we have all the user registers written out.
+		 * We're doing culculations with ndirty and ar.bspstore
+		 * and we better make sure ar.bspstore >= ndirty.
+		 */
+		rssz = bspst - kstack;
+		if (rssz < ndirty) {
+			__asm __volatile("flushrs;;");
+			__asm __volatile("mov   %0=ar.bspstore" : "=r"(bspst));
+			rssz = bspst - kstack;
+		}
+		bcopy((void*)(kstack + ndirty), (void*)kstack, rssz - ndirty);
 		bspst -= ndirty;
 		__asm __volatile("mov	ar.bspstore=%0;;" :: "r"(bspst));
 		__asm __volatile("mov	ar.rsc=3");



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