[OpenBIOS] [PATCH 10/10] Adding filll Forth primitive (v2)

William Hahne will07c5 at gmail.com
Mon Aug 22 05:14:55 CEST 2011


This is a forth word that is required by BootX. It just fills some
specified memory address and length with 32 bit integers. It is a
non-standard addition and therefore isn't documented. Thanks to Segher
Boessenkool for the corrected for loop.

Index: arch/ppc/qemu/init.c
===================================================================
--- arch/ppc/qemu/init.c        (revision 1047)
+++ arch/ppc/qemu/init.c        (working copy)
@@ -539,6 +539,7 @@
 }

 static void go(void);
+static void filll(void);

 static void
 go(void)
@@ -551,6 +552,23 @@
     call_elf(0, 0, addr);
 }

+/* This is an Apple specific word that fills a specified location and length
+   of memory with 32bit integers.
+
+   ( dest count value -- ) */
+static void
+filll(void)
+{
+    uint32_t value = POP();
+    int count = POP();
+    uint32_t *dest = (uint32_t*)cell2pointer(POP());
+
+    int i;
+    for (i = count; i > 0; i -= sizeof(uint32_t)) {
+        *dest++ = value;
+    }
+}
+
 static void kvm_of_init(void)
 {
     char hypercall[4 * 4];
@@ -879,4 +897,5 @@

     bind_func("platform-boot", boot);
     bind_func("(go)", go);
+    bind_func("filll", filll);
 }



More information about the OpenBIOS mailing list