patch-2.1.9 linux/arch/sparc/kernel/wof.S

Next file: linux/arch/sparc/kernel/wuf.S
Previous file: linux/arch/sparc/kernel/windows.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.8/linux/arch/sparc/kernel/wof.S linux/arch/sparc/kernel/wof.S
@@ -1,4 +1,4 @@
-/* $Id: wof.S,v 1.22 1996/04/03 02:15:10 davem Exp $
+/* $Id: wof.S,v 1.29 1996/10/11 01:00:04 davem Exp $
  * wof.S: Sparc window overflow handler.
  *
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -92,14 +92,14 @@
 	LOAD_CURRENT(curptr, twin_tmp)
 
 	andcc	%t_psr, PSR_PS, %g0
-	be	spwin_fromuser				! all user wins, branch
-	 nop
+	be,a	spwin_fromuser				! all user wins, branch
+	 save	%g0, %g0, %g0				! Go where saving will occur
 	
 	/* See if any user windows are active in the set. */
 	ld	[%curptr + THREAD_UMASK], %twin_tmp	! grab win mask
 	orcc	%g0, %twin_tmp, %g0			! check for set bits
 	bne	spwin_exist_uwins			! yep, there are some
-	 nop
+	 andn	%twin_tmp, %glob_tmp, %twin_tmp		! compute new umask
 
 	/* Save into the window which must be saved and do it.
 	 * Basically if we are here, this means that we trapped
@@ -108,7 +108,6 @@
 	 */
 	save	%g0, %g0, %g0		! save into the window to stash away
 	wr	%glob_tmp, 0x0, %wim	! set new %wim, this is safe now
-	WRITE_PAUSE			! burn cpu cycles due to bad engineering
 
 spwin_no_userwins_from_kernel:
 	/* LOCATION: Window to be saved */
@@ -140,16 +139,12 @@
 	 * But first, store the new user window mask calculated
 	 * above.
 	 */
-	andn	%twin_tmp, %glob_tmp, %twin_tmp		! compute new umask
 	st	%twin_tmp, [%curptr + THREAD_UMASK]
-
-spwin_fromuser:
-	/* LOCATION: Trap window */
 	save	%g0, %g0, %g0		! Go to where the saving will occur
 
+spwin_fromuser:
 	/* LOCATION: Window to be saved */
 	wr	%glob_tmp, 0x0, %wim	! Now it is safe to set new %wim
-	WRITE_PAUSE			! burn baby burn
 
 	/* LOCATION: Window to be saved */
 
@@ -192,6 +187,7 @@
 	/* Restore saved globals */
 	mov	%saved_g5, %g5
 	mov	%saved_g6, %g6
+
 	wr	%t_psr, 0x0, %psr
 	WRITE_PAUSE
 	jmp	%t_pc
@@ -243,8 +239,10 @@
 
 	/* Restore the saved globals and build a pt_regs frame. */
 	mov	%saved_g5, %g5
+	mov	%g6, %l4
 	mov	%saved_g6, %g6
 	STORE_PT_ALL(sp, t_psr, t_pc, t_npc, g1)
+	mov	%l4, %g6
 
 	ENTER_SYSCALL
 
@@ -260,7 +258,7 @@
 	 * be given the look of death from Commander Peanut.
 	 */
 	b	ret_trap_entry
-	 nop
+	 clr	%l6
 
 spwin_bad_ustack_from_kernel:
 	/* LOCATION: Window to be saved */
@@ -277,7 +275,8 @@
 	/* LOCATION: Trap window */
 
 	/* Restore globals, condition codes in the %psr and
-	 * return from trap.
+	 * return from trap.  Note, restoring %g6 when returning
+	 * to kernel mode is not necessarily these days. ;-)
 	 */
 	mov	%saved_g5, %g5
 	mov	%saved_g6, %g6
@@ -315,8 +314,8 @@
 	be	1f
 	 sra	%sp, 29, %glob_tmp
 
-	b	spwin_user_stack_is_bolixed
-	 nop
+	b	spwin_user_stack_is_bolixed + 0x4
+	 rd	%psr, %glob_tmp
 
 1:
 	add	%glob_tmp, 0x1, %glob_tmp
@@ -324,8 +323,8 @@
 	be	1f
 	 and	%sp, 0xfff, %glob_tmp		! delay slot
 
-	b	spwin_user_stack_is_bolixed
-	 nop
+	b	spwin_user_stack_is_bolixed + 0x4
+	 rd	%psr, %glob_tmp
 
 	/* See if our dump area will be on more than one
 	 * page.
@@ -343,8 +342,8 @@
 	be	1f
 	 add	%sp, 0x38, %glob_tmp	/* Is second page in vma hole? */
 
-	b	spwin_user_stack_is_bolixed
-	 nop
+	b	spwin_user_stack_is_bolixed + 0x4
+	 rd	%psr, %glob_tmp
 
 1:
 	sra	%glob_tmp, 29, %glob_tmp
@@ -353,8 +352,8 @@
 	be	1f
 	 add	%sp, 0x38, %glob_tmp
 
-	b	spwin_user_stack_is_bolixed
-	 nop
+	b	spwin_user_stack_is_bolixed + 0x4
+	 rd	%psr, %glob_tmp
 
 1:
 	lda	[%glob_tmp] ASI_PTE, %glob_tmp
@@ -365,8 +364,8 @@
 	be	spwin_good_ustack			! success
 	 nop
 
-	b	spwin_user_stack_is_bolixed
-	 nop
+	b	spwin_user_stack_is_bolixed + 0x4
+	 rd	%psr, %glob_tmp
 
 	/* This is a generic SRMMU routine.  As far as I know this
 	 * works for all current v8/srmmu implementations, we'll
@@ -388,8 +387,9 @@
 	 * kernel is page aligned, which should always be the case.
 	 */
 	/* Check results of callers andcc %sp, 0x7, %g0 */
+	sethi	%hi(C_LABEL(page_offset)), %glob_tmp
 	bne	spwin_user_stack_is_bolixed
-	 sethi	%hi(KERNBASE), %glob_tmp
+	 ld	[%glob_tmp + %lo(C_LABEL(page_offset))], %glob_tmp
 	cmp	%glob_tmp, %sp
 	bleu	spwin_user_stack_is_bolixed
 	 mov	AC_M_SFSR, %glob_tmp
@@ -414,8 +414,8 @@
 	mov	AC_M_SFSR, %glob_tmp
 	lda	[%glob_tmp] ASI_M_MMUREGS, %glob_tmp
 	andcc	%glob_tmp, 0x2, %g0			! did we fault?
-	be	spwin_finish_up				! cool beans, success
-	 nop
+	be,a	spwin_finish_up + 0x4			! cool beans, success
+	 restore %g0, %g0, %g0
 
-	b	spwin_user_stack_is_bolixed		! we faulted, ugh
-	 nop
+	b	spwin_user_stack_is_bolixed + 0x4	! we faulted, ugh
+	 rd	%psr, %glob_tmp

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov