Module Name:    src
Committed By:   thorpej
Date:           Tue Nov  3 16:08:00 UTC 2009

Modified Files:
        src/sys/arch/alpha/alpha: locore.s

Log Message:
Restructure exception_return() a bit in preparation for some upcoming
changes.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/alpha/alpha/locore.s

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/alpha/alpha/locore.s
diff -u src/sys/arch/alpha/alpha/locore.s:1.114 src/sys/arch/alpha/alpha/locore.s:1.115
--- src/sys/arch/alpha/alpha/locore.s:1.114	Mon Jun  1 20:58:16 2009
+++ src/sys/arch/alpha/alpha/locore.s	Tue Nov  3 16:08:00 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.114 2009/06/01 20:58:16 martin Exp $ */
+/* $NetBSD: locore.s,v 1.115 2009/11/03 16:08:00 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <machine/asm.h>
 
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.114 2009/06/01 20:58:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.115 2009/11/03 16:08:00 thorpej Exp $");
 
 #include "assym.h"
 
@@ -255,37 +255,36 @@
 
 	ldq	s1, (FRAME_PS * 8)(sp)		/* get the saved PS */
 	and	s1, ALPHA_PSL_IPL_MASK, t0	/* look at the saved IPL */
-	bne	t0, 4f				/* != 0: can't do AST or SIR */
+	bne	t0, 5f				/* != 0: can't do AST or SIR */
 
 	/* see if we can do an SIR */
 2:	ldq	t1, ssir			/* SIR pending? */
-	bne	t1, 5f				/* yes */
+	bne	t1, 6f				/* yes */
 	/* no */
 
-	/* check for AST */
-3:	and	s1, ALPHA_PSL_USERMODE, t0	/* are we returning to user? */
-	beq	t0, 4f				/* no: just return */
+	and	s1, ALPHA_PSL_USERMODE, t0	/* are we returning to user? */
+	beq	t0, 5f				/* no: just return */
 	/* yes */
 
 	/* GET_CPUINFO clobbers v0, t0, t8...t11. */
 	GET_CPUINFO
-	ldq	t1, CPU_INFO_CURLWP(v0)
+	mov	v0, s3				/* squirrel away our CPU info */
+
+	/* check for AST */
+3:	ldq	t1, CPU_INFO_CURLWP(s3)
 	ldl	t3, L_MD_ASTPENDING(t1)		/* AST pending? */
-	bne	t3, 6f				/* yes */
-	/* no: return & deal with FP */
+	bne	t3, 7f				/* yes */
+	/* no: headed back to user space */
 
-	/*
-	 * We are going back to usermode.  Enable the FPU based on whether
-	 * the current proc is fpcurlwp.
-	 */
-	ldq	t2, CPU_INFO_FPCURLWP(v0)
+	/* Enable the FPU based on whether the current proc is fpcurlwp. */
+4:	ldq	t2, CPU_INFO_FPCURLWP(s3)
 	cmpeq	t1, t2, t1
 	mov	zero, a0
 	cmovne	t1, 1, a0
 	call_pal PAL_OSF1_wrfen
 
 	/* restore the registers, and return */
-4:	bsr	ra, exception_restore_regs	/* jmp/CALL trashes pv/t12 */
+5:	bsr	ra, exception_restore_regs	/* jmp/CALL trashes pv/t12 */
 	ldq	ra,(FRAME_RA*8)(sp)
 	.set noat
 	ldq	at_reg,(FRAME_AT*8)(sp)
@@ -296,7 +295,7 @@
 	/* NOTREACHED */
 
 	/* We've got a SIR */
-5:	ldiq	a0, ALPHA_PSL_IPL_SOFT
+6:	ldiq	a0, ALPHA_PSL_IPL_SOFT
 	call_pal PAL_OSF1_swpipl
 	mov	v0, s2				/* remember old IPL */
 	CALL(softintr_dispatch)
@@ -307,7 +306,7 @@
 	br	2b
 
 	/* We've got an AST */
-6:	stl	zero, L_MD_ASTPENDING(t1)	/* no AST pending */
+7:	stl	zero, L_MD_ASTPENDING(t1)	/* no AST pending */
 
 	ldiq	a0, ALPHA_PSL_IPL_0		/* drop IPL to zero */
 	call_pal PAL_OSF1_swpipl

Reply via email to