[OpenBIOS] [commit] r886 - trunk/openbios-devel/arch/sparc64

repository service svn at openbios.org
Sun Oct 3 22:28:27 CEST 2010


Author: mcayland
Date: Sun Oct  3 22:28:27 2010
New Revision: 886
URL: http://tracker.coreboot.org/trac/openbios/changeset/886

Log:
Implement va>tte-data defer word for the MMU TLB miss handlers.

As used by OpenSolaris. This enables OpenSolaris boot to proceed further by allowing the kernel to correctly manage its own TLB 
misses.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>

Modified:
   trunk/openbios-devel/arch/sparc64/init.fs
   trunk/openbios-devel/arch/sparc64/lib.c

Modified: trunk/openbios-devel/arch/sparc64/init.fs
==============================================================================
--- trunk/openbios-devel/arch/sparc64/init.fs	Sun Oct  3 21:18:28 2010	(r885)
+++ trunk/openbios-devel/arch/sparc64/init.fs	Sun Oct  3 22:28:27 2010	(r886)
@@ -1,3 +1,10 @@
+\ va>tte-data defer MMU virtual to physical address hook for Solaris
+\ We need to make sure this is in the global wordlist
+active-package 0 active-package!
+defer va>tte-data
+0 to va>tte-data
+active-package!
+
 :noname
   ."   Type 'help' for detailed information" cr
   \ ."   boot secondary slave cdrom: " cr

Modified: trunk/openbios-devel/arch/sparc64/lib.c
==============================================================================
--- trunk/openbios-devel/arch/sparc64/lib.c	Sun Oct  3 21:18:28 2010	(r885)
+++ trunk/openbios-devel/arch/sparc64/lib.c	Sun Oct  3 22:28:27 2010	(r886)
@@ -16,6 +16,8 @@
 
 #include "ofmem_sparc64.h"
 
+static ucell *va2ttedata = 0;
+
 /* Format a string and print it on the screen, just like the libc
  * function printf.
  */
@@ -228,10 +230,28 @@
 	faultva >>= 13;
 	faultva <<= 13;
 
-	/* Search the ofmem linked list for this virtual address */
-	PUSH(faultva);
-	pgmap_fetch();
-	tte_data = POP();
+	/* If a valid va>tte-data routine has been set, invoke that Forth xt instead */
+	if (va2ttedata && *va2ttedata != 0) {
+
+		/* va>tte-data ( addr cnum -- false | tte-data true ) */
+		PUSH(faultva);
+		PUSH(0);
+		enterforth(*va2ttedata);
+
+		/* Check the result first... */
+		tte_data = POP();
+		if (!tte_data) {
+			bug();
+		} else {
+			/* Grab the real data */
+			tte_data = POP();
+		}		
+	} else {
+		/* Search the ofmem linked list for this virtual address */
+		PUSH(faultva);
+		pgmap_fetch();
+		tte_data = POP();
+	}
 
 	if (tte_data) {
 		/* Update MMU */
@@ -240,6 +260,7 @@
 		/* If we got here, there was no translation so fail */
 		bug();
 	}
+
 }
 
 static void
@@ -298,10 +319,28 @@
 	faultva >>= 13;
 	faultva <<= 13;
 
-	/* Search the ofmem linked list for this virtual address */
-	PUSH(faultva);
-	pgmap_fetch();
-	tte_data = POP();
+	/* If a valid va>tte-data routine has been set, invoke that Forth xt instead */
+	if (va2ttedata && *va2ttedata != 0) {
+
+		/* va>tte-data ( addr cnum -- false | tte-data true ) */
+		PUSH(faultva);
+		PUSH(0);
+		enterforth(*va2ttedata);
+
+		/* Check the result first... */
+		tte_data = POP();
+		if (!tte_data) {
+			bug();
+		} else {
+			/* Grab the real data */
+			tte_data = POP();
+		}		
+	} else {
+		/* Search the ofmem linked list for this virtual address */
+		PUSH(faultva);
+		pgmap_fetch();
+		tte_data = POP();
+	}
 
 	if (tte_data) {
 		/* Update MMU */
@@ -617,4 +656,8 @@
     PUSH(0);
     fword("active-package!");
     bind_func("pgmap@", pgmap_fetch);
+
+    /* Find address of va2ttedata defer word contents for MMU miss handlers */
+    va2ttedata = (ucell *)findword("va>tte-data");
+    va2ttedata++;
 }



More information about the OpenBIOS mailing list