[OpenBIOS] [PATCH] Adds filll word to dictionary

Programmingkid programmingkidx at gmail.com
Tue Nov 20 04:35:28 CET 2012


The filll word fills a region of memory with a 4 byte value. This word is different from fill because fill is used to fill a region of memory with a 1 byte value. 

This word is needed by bootx to boot Mac OS X. 

Here are some test results comparing Apple's implementation to mine.

Apple's implementation:

0 > 100 buffer: mybuffer  ok
0 > mybuffer 100 87654321 filll  ok
0 > mybuffer 100 dump 
ffbc8800: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc8810: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc8820: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc8830: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc8840: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc8850: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc8860: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc8870: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc8880: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc8890: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc88a0: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc88b0: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc88c0: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc88d0: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc88e0: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|
ffbc88f0: 87 65 43 21 87 65 43 21 87 65 43 21 87 65 43 21 |.eC!.eC!.eC!.eC!|



My patch:

0 > mybuffer 100 87654321 filll   ok
0 > mybuffer 100 dump 
fff771e0  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff771f0  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff77200  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff77210  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff77220  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff77230  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff77240  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff77250  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff77260  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff77270  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff77280  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff77290  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff772a0  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff772b0  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff772c0  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!
fff772d0  87 65 43 21 87 65 43 21  87 65 43 21 87 65 43 21    ?eC!?eC!?eC!?eC!


The results are the same. This indicates the patch will work. 

After I applied this patch, bootx continued booting a little further than before. 


signed-off-by: John Arbuckle <programmingkidx at gmail.com>

Index: kernel/bootstrap.c
===================================================================
--- kernel/bootstrap.c	(revision 1067)
+++ kernel/bootstrap.c	(working copy)
@@ -89,7 +89,7 @@
 	"here", "here!", "dobranch", "do?branch", "unaligned-w@",
 	"unaligned-w!", "unaligned-l@", "unaligned-l!", "ioc@", "iow@",
 	"iol@", "ioc!", "iow!", "iol!", "i", "j", "call", "sys-debug",
-	"$include", "$encode-file", "(debug", "(debug-off)"
+	"$include", "$encode-file", "(debug", "(debug-off)", "filll"
 };
 
 /*
Index: kernel/forth.c
===================================================================
--- kernel/forth.c	(revision 1067)
+++ kernel/forth.c	(working copy)
@@ -1611,6 +1611,24 @@
 }
 
 
+// filll  ( addr len long-number -- )
+
+static void filll(void)
+{
+   int * location;
+   int length, fillNumber, index;
+   
+   fillNumber = POP();
+   length = POP();
+   location = (int *) POP();
+   
+   for(index = 0; index <= length; index++)
+   {
+      location[index] = fillNumber;
+   }
+}
+
+
 /*
  *  unaligned-w@  ( addr -- w )
  */
@@ -1963,4 +1981,5 @@
     do_encode_file,         /* $encode-file */
     do_debug_xt,            /* (debug  */
     do_debug_off,           /* (debug-off) */
+    filll,                  /* filll   */
 };




More information about the OpenBIOS mailing list