[OpenBIOS] r241 - openbios-devel/arch/sparc32

svn at openbios.org svn at openbios.org
Mon Sep 29 19:11:01 CEST 2008


Author: blueswirl
Date: 2008-09-29 19:11:00 +0200 (Mon, 29 Sep 2008)
New Revision: 241

Modified:
   openbios-devel/arch/sparc32/entry.S
   openbios-devel/arch/sparc32/wof.S
   openbios-devel/arch/sparc32/wuf.S
Log:
Fix window handling on 7 window Sparcs

Modified: openbios-devel/arch/sparc32/entry.S
===================================================================
--- openbios-devel/arch/sparc32/entry.S	2008-09-28 19:55:25 UTC (rev 240)
+++ openbios-devel/arch/sparc32/entry.S	2008-09-29 17:11:00 UTC (rev 241)
@@ -364,6 +364,49 @@
         mov     %y, %g2
         st      %g2, [%g1]
 
+        /* Compute NWINDOWS and stash it away. Now uses %wim trick explained
+         * in the V8 manual. Ok, this method seems to work, Sparc is cool...
+         * No, it doesn't work, have to play the save/readCWP/restore trick.
+         */
+
+        wr      %g0, 0x0, %wim                  ! so we do not get a trap
+        WRITE_PAUSE
+
+        save
+
+        rd      %psr, %g3
+
+        restore
+
+        and     %g3, 0x1f, %g3
+        add     %g3, 0x1, %g3
+
+        mov     2, %g1
+        wr      %g1, 0x0, %wim                  ! make window 1 invalid
+        WRITE_PAUSE
+
+        cmp     %g3, 0x7
+        bne     1f
+         nop
+
+        /* Adjust our window handling routines to
+         * do things correctly on 7 window Sparcs.
+         */
+#define PATCH_INSN(src, dest) \
+        set     src, %g5; \
+        set     dest, %g2; \
+        ld      [%g5], %g4; \
+        st      %g4, [%g2];
+
+        /* Patch for window spills... */
+        PATCH_INSN(spnwin_patch1_7win, spnwin_patch1)
+        PATCH_INSN(spnwin_patch2_7win, spnwin_patch2)
+
+        /* Patch for window fills... */
+        PATCH_INSN(fnwin_patch1_7win, fnwin_patch1)
+        PATCH_INSN(fnwin_patch2_7win, fnwin_patch2)
+
+1:
         /* Finally, turn on traps so that we can call c-code. */
         rd	%psr, %g3
         wr	%g3, 0x0, %psr

Modified: openbios-devel/arch/sparc32/wof.S
===================================================================
--- openbios-devel/arch/sparc32/wof.S	2008-09-28 19:55:25 UTC (rev 240)
+++ openbios-devel/arch/sparc32/wof.S	2008-09-29 17:11:00 UTC (rev 241)
@@ -77,7 +77,7 @@
 
 	.text
 	.align	4
-#if 0
+
 	/* BEGINNING OF PATCH INSTRUCTIONS */
 	/* On a 7-window Sparc the boot code patches spnwin_*
 	 * instructions with the following ones.
@@ -87,7 +87,7 @@
 spnwin_patch2_7win:	and	%glob_tmp, 0x7f, %glob_tmp
 spnwin_patch3_7win:	and	%twin_tmp, 0x7f, %twin_tmp
 	/* END OF PATCH INSTRUCTIONS */
-#endif
+
 	/* The trap entry point has done the following:
 	 *
 	 * rd    %psr, %l0

Modified: openbios-devel/arch/sparc32/wuf.S
===================================================================
--- openbios-devel/arch/sparc32/wuf.S	2008-09-28 19:55:25 UTC (rev 240)
+++ openbios-devel/arch/sparc32/wuf.S	2008-09-29 17:11:00 UTC (rev 241)
@@ -96,7 +96,7 @@
 	 *      I == this window will be the invalid one when we
 	 *           are done and return from trap if successful
 	 */
-#if 0
+
 	/* BEGINNING OF PATCH INSTRUCTIONS */
 
 	/* On 7-window Sparc the boot code patches fnwin_patch1
@@ -106,8 +106,8 @@
 fnwin_patch1_7win:	srl	%t_wim, 6, %twin_tmp2
 fnwin_patch2_7win:	and	%twin_tmp1, 0x7f, %twin_tmp1
 	/* END OF PATCH INSTRUCTIONS */
-#endif
 
+
 	.globl	fill_window_entry, fnwin_patch1, fnwin_patch2
 fill_window_entry:
 	/* LOCATION: Window 'T' */




More information about the OpenBIOS mailing list