PERFORCE change 32084 for review

Marcel Moolenaar marcel at FreeBSD.org
Thu May 29 18:21:18 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=32084

Change 32084 by marcel at 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");


More information about the p4-projects mailing list