[openfirmware] r1055 - cpu/x86 cpu/x86/build forth/wrapper forth/wrapper/zip

svn at openfirmware.info svn at openfirmware.info
Tue Dec 30 03:09:26 CET 2008


Author: wmb
Date: 2008-12-30 03:09:26 +0100 (Tue, 30 Dec 2008)
New Revision: 1055

Added:
   cpu/x86/Darwin/
Modified:
   cpu/x86/build/builder.dic
   cpu/x86/syscall.fth
   forth/wrapper/logger.c
   forth/wrapper/wrapper.c
   forth/wrapper/zip/util.c
   forth/wrapper/zip/zipmem.c
Log:
Added support for building on Mac OSX/Darwin.


Modified: cpu/x86/syscall.fth
===================================================================
--- cpu/x86/syscall.fth	2008-12-29 23:50:42 UTC (rev 1054)
+++ cpu/x86/syscall.fth	2008-12-30 02:09:26 UTC (rev 1055)
@@ -32,6 +32,9 @@
       0 [bx]  sp  lss
    then
 
+   \ Nonce pushes to enforce 16-byte stack args alignment for Darwin
+   ax push  ax push
+
    cx push				\ my SP
    gs push				\ my SS
    ds push				\ my DS
@@ -66,6 +69,8 @@
    bx pop				\ my SS
    cx pop				\ my SP
 
+   ax pop  ax pop  \ Undo nonce pushes
+
    1 #  'user flat?  test   0= if
       bx ss mov				\ Reload my SS:SP
    then

Modified: forth/wrapper/logger.c
===================================================================
--- forth/wrapper/logger.c	2008-12-29 23:50:42 UTC (rev 1054)
+++ forth/wrapper/logger.c	2008-12-30 02:09:26 UTC (rev 1055)
@@ -11,6 +11,7 @@
 #endif
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 #ifndef USE_STDIO
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -18,6 +19,8 @@
 #include <time.h>
 #ifdef MAJC
 #include <sys/unistd.h>
+#else
+#include <unistd.h>
 #endif
 
 #ifndef MAXPATHLEN

Modified: forth/wrapper/wrapper.c
===================================================================
--- forth/wrapper/wrapper.c	2008-12-29 23:50:42 UTC (rev 1054)
+++ forth/wrapper/wrapper.c	2008-12-30 02:09:26 UTC (rev 1055)
@@ -9,7 +9,7 @@
 3) At which address will the binary run (relocation)
 
 This C program finesses problems 1 and 2 by assuming that the C
-compiler/linker knows how to do those those things.  The Forth
+compiler/linker knows how to do those things.  The Forth 
 interpreter itself is stored in a file whose format is system-independent.
 The C program mallocs an array, reads the Forth image into that array,
 and calls the array as a subroutine, passing it the address of another
@@ -56,6 +56,16 @@
 #include <stdlib.h>
 #include <string.h>
 
+/* 
+ * The following #includes and externs fix GCC warnings when compiled with
+ * -Wimplicit-function-declarations, which I'm doing while trying to get
+ * this working on Darwin hosts.
+ */
+#include <ctype.h>
+/* zlib externs */
+extern int inflate();
+extern int zip_memory();
+
 #ifdef __linux__
 char *host_os = "Linux";
 #define SYS5 1
@@ -91,6 +101,11 @@
 #define START_OFFSET 0x10
 #endif
 
+#if defined(__APPLE__)
+char *host_os = "Darwin";
+#define BSD 1
+#endif
+
 #ifdef MIPS
 char *host_cpu = "mips";
 #define START_OFFSET 8
@@ -200,7 +215,6 @@
 
 #ifdef __unix__
 # include <sys/mman.h>
-# include <sys/mman.h>
 # include <limits.h>    /* for PAGESIZE */
 # ifndef PAGESIZE
 #  define PAGESIZE 4096
@@ -305,13 +319,19 @@
   INTERNAL void	error(char *, char*);
 
 #else
+  INTERNAL int  getnum(char *);
   INTERNAL void	error();
 #endif
 
+/* externs from logger.c */
 extern char *rootname();
 extern char *basename();
+extern void log_output();
+extern void log_input();
+extern void log_command_line();
+extern void log_env();
 
-#ifndef LinuxPOWERPC
+#if !defined(LinuxPOWERPC) && !defined(__APPLE__)
   extern int	read(), write();
 #endif
 

Modified: forth/wrapper/zip/util.c
===================================================================
--- forth/wrapper/zip/util.c	2008-12-29 23:50:42 UTC (rev 1054)
+++ forth/wrapper/zip/util.c	2008-12-30 02:09:26 UTC (rev 1055)
@@ -13,6 +13,7 @@
 #include "tailor.h"
 #include "gzip.h"
 
+extern int write_mem(); /* found in zipmem.c */
 extern ulg crc_32_tab[];   /* crc table, defined below */
 
 /* ===========================================================================

Modified: forth/wrapper/zip/zipmem.c
===================================================================
--- forth/wrapper/zip/zipmem.c	2008-12-29 23:50:42 UTC (rev 1054)
+++ forth/wrapper/zip/zipmem.c	2008-12-30 02:09:26 UTC (rev 1055)
@@ -66,6 +66,7 @@
 local void do_exit      OF((int exitcode));
       int zip_memory    OF((void *inbuf,  int insize,
 			    void *outbuf, int outsize));
+      int simple_zip OF((void));
 
 local int read_mem	OF((int fd, void *buf, size_t size));
 




More information about the openfirmware mailing list