[OpenBIOS] [PATCH 6/6] ppc: add Apple copyright injection to adler32

Cormac O'Brien i.am.cormac.obrien at gmail.com
Sat Jun 20 19:49:02 CEST 2015


Since Mac OS 9 and BootX are the only known users of the adler32 word, we use
the word to add an Apple copyright message to the device tree in order to
allow OS 9 to boot.

Signed-off-by: Cormac O'Brien <i.am.cormac.obrien at gmail.com>
---
 arch/ppc/qemu/init.c  |  2 +-
 arch/ppc/qemu/qemu.fs | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c
index 180679c..2b5b8e1 100644
--- a/arch/ppc/qemu/init.c
+++ b/arch/ppc/qemu/init.c
@@ -1006,7 +1006,7 @@ arch_of_init(void)
     bind_func("filll", ffilll);
 
     /* Implementation of adler32 word (required by OS 9, BootX) */
-    bind_func("adler32", adler32);
+    bind_func("(adler32)", adler32);
     
     bind_func("platform-boot", boot);
     bind_func("(go)", go);
diff --git a/arch/ppc/qemu/qemu.fs b/arch/ppc/qemu/qemu.fs
index 458af1b..11e344a 100644
--- a/arch/ppc/qemu/qemu.fs
+++ b/arch/ppc/qemu/qemu.fs
@@ -93,3 +93,31 @@ variable keyboard-phandle 0 keyboard-phandle !
 :noname
   set-defaults
 ; PREPOST-initializer
+
+\ -------------------------------------------------------------------------
+\ Adler-32 wrapper
+\ -------------------------------------------------------------------------
+
+: adler32 ( adler buf len -- checksum )
+  \ Since Mac OS 9 is the only system using this word, we take this
+  \ opportunity to inject a copyright message that is necessary for the
+  \ system to boot.
+  " Copyright 1983-2001 Apple Computer, Inc. THIS MESSAGE FOR COMPATIBILITY ONLY"
+  encode-string " copyright"
+  " /" find-package if
+    " set-property" $find if
+      execute
+    else
+      3drop drop
+    then
+  then
+
+  ( adler buf len )
+
+  " (adler32)" $find if
+    execute
+  else
+    ." Can't find " ( adler32-name ) type cr
+    3drop 0
+  then
+;
-- 
2.4.4




More information about the OpenBIOS mailing list