Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Nov 2007 22:08:26 GMT
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 128634 for review
Message-ID:  <200711042208.lA4M8Qcu082038@repoman.freebsd.org>

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

Change 128634 by gonzo@gonzo_jeeves on 2007/11/04 22:07:25

	o Add 16 bytes to default stackframe of GenericException, 
	    Intr, UserGenericException, UserIntr. These functions
	    are non-leaves, so sizeof(register) * MAX(max_args, 4) 
	    bytes should be reserved as a placeholders for arguments.
	    max_args is the maximum number of arguments through all 
	    functions that are called from non-leaf routine. 

Affected files ...

.. //depot/projects/mips2/src/sys/mips/mips/exception.S#26 edit
.. //depot/projects/mips2/src/sys/mips/mips/locore.S#19 edit

Differences ...

==== //depot/projects/mips2/src/sys/mips/mips/exception.S#26 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/mips2/src/sys/mips/mips/exception.S#25 $
+ * $P4: //depot/projects/mips2/src/sys/mips/mips/exception.S#26 $
  */
 
 /*	$NetBSD: mipsX_subr.S,v 1.19 2005/12/11 12:18:09 christos Exp $	*/
@@ -283,14 +283,15 @@
 	/* fall through to GenericEception */
 	.set	at
 
-LEAF(GenericException)
+NESTED(GenericException, TF_SIZE + 16, ra)
 	.set noat
+	.set noreorder
 
 	la	k0, 1f
 	j	exception_save_registers
 	subu	k1, sp, TF_SIZE
 1:
-	subu	sp, sp, TF_SIZE
+	subu	sp, sp, TF_SIZE + 16
 
 	/*
 	 * A generic exception may result in DDB being invoked.  If we
@@ -303,7 +304,6 @@
 #endif /* DDB */
 
 	/*
-
 	 * Call trap() with arguments:
 	 * trapframe, cause, badvaddr.
 	 *
@@ -325,7 +325,7 @@
 	 */
 	mtc0	zero, MIPS_COP_0_CAUSE
 
-	move	k1, sp
+	addu	k1, sp, 16
 	jal	exception_restore_registers
 	nop
 
@@ -343,12 +343,13 @@
 
 LEAF(KernIntr)
 	.set noat
+	.set noreorder
 
 	la	k0, 1f
 	j	exception_save_registers
 	subu	k1, sp, TF_SIZE
 1:
-	subu	sp, sp, TF_SIZE
+	subu	sp, sp, TF_SIZE + 16
 
 	/*
 	 * A generic exception may result in DDB being invoked.  If we
@@ -379,7 +380,7 @@
 	 */
 	mtc0	zero, MIPS_COP_0_CAUSE
 
-	move	k1, sp
+	addu	k1, sp, 16
 	jal	exception_restore_registers
 	nop
 
@@ -654,7 +655,7 @@
 /* 
  * Handle trap from userspace (VM-related, syscall, etc..)
  */
-NESTED(UserGenericException, TF_SIZE, ra)
+NESTED(UserGenericException, 16, ra)
 	.set noat
 	.set noreorder
 	.mask	0x80000000, -4
@@ -666,7 +667,9 @@
 	nop
 1:
 	move	a0, k1				# For following trap call
-	addu	sp, k1, -TF_SIZE		# Switch to kernel's stack
+	subu	sp, k1, 16			# Switch to kernel's stack,
+						# keep 16 bytes as 
+						# placefholders for a0..a3
 
 	###
 	### Fill out trap arcguments and call it
@@ -702,7 +705,7 @@
 	###
 	### Restore regiters and bail out
 	###
-	addu	sp, sp, TF_SIZE			## Restore pointer to saved 
+	addu	sp, sp, 16			## Restore pointer to saved 
 						## registers
 	move	k1, sp
 	jal	exception_restore_registers
@@ -717,7 +720,7 @@
 /*
  * Handle interrupt from userspace
  */
-NESTED(UserIntr, TF_SIZE, ra)
+NESTED(UserIntr, 16, ra)
 	.set noat
 	.set noreorder
 	.mask	0x80000000, -4
@@ -729,7 +732,9 @@
 	nop
 1:
 	move	a0, k1				# For following trap call
-	addu	sp, k1, -TF_SIZE		# Switch to kernel's stack
+	subu	sp, k1, 16			# Switch to kernel's stack,
+						# keep 16 bytes as 
+						# placefholders for a0..a3
 
 	mfc0	t0, MIPS_COP_0_STATUS
 	.set at

==== //depot/projects/mips2/src/sys/mips/mips/locore.S#19 (text+ko) ====

@@ -50,9 +50,8 @@
 
 GLOBAL(stackspace)
 	.space PAGE_SIZE /* Smaller than it should be since it's temp. */
-.align 8
+	.align 8
 GLOBAL(topstack)
-
 	.set noreorder
 
 	.text
@@ -110,6 +109,7 @@
 	 * Set up our temporary stack.
 	 */
 	la	sp, topstack
+	subu	sp, sp, 16	/* Placeholders for a0..a3 */
 
 #ifdef YAMON
 	/*
@@ -149,9 +149,7 @@
 	li	v0, SYS_sigreturn
 	syscall
 	break	0
+esigcode:
 
-esigcode:
-	.data
-	.global szsigcode
-szsigcode:
-	.long esigcode-sigcode
+GLOBAL(szsigcode)
+	.long esigcode - sigcode



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