*BSD News Article 14490


Return to BSD News archive

Newsgroups: comp.os.386bsd.apps
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!haven.umd.edu!uunet!math.fu-berlin.de!fub!abraxas!luthien!wagner
From: wagner@luthien.in-berlin.de (Olaf Wagner)
Subject: SML of New Jersey for 386bsd
Organization: 'Holistic Computing Services'
Message-ID: <1993Apr14.223106.3708@luthien.in-berlin.de>
X-Newsreader: Tin 1.1 PL4
Date: Wed, 14 Apr 93 22:31:06 GMT
Lines: 121

Since SML of New Jersey had been ported to BSD/386 I attempted
to get it running on 386bsd as well, and with some minor additions
I succeeded.

After finding and reading the paper `A Runtime System (Draft)' I
decided that the only thing that was going wrong was the writing
of an executable image in function exportML. So I dived somewhat
deeper into the matter, studied the structures and macros in a.out.h
and made some minor additions to export.c and makeml.

SML now runs without any problem (so far). I was able to build the
interactive compiler, the batch compiler, the cml system, and run some
(small) example programs. I haven't done thorough and exhaustive
tests, though. The changes I made to the BSD386 port are really tiny,
and I am not able to guarantee that everything will work as expected.

SML-NJ is available via anonymous ftp from

   princeton.edu (128.112.128.1)   /pub/ml
   research.att.com (192.20.255.2) /dist/ml

In order to build executables under 386bsd, you will need the following
files:
   
   93.src.tar.Z		(source code for runtime support and compiler)
   93.mo..i386.tar.Z    (Intel i386 object files)

You might also want to get the following files:

   93.release-notes.ps 
   93.release-notes.txt
   93.doc.tar.Z         (documentation of the compiler and various papers)
   93.tools.tar.Z       (various tools, including debugger, profiler,
                         lexical analyser, parser generator, ...)
   smlnj-lib.0.1.tar.Z  (Standard ML of New Jersey Library)
   CML-0.9.8.tar.Z      (Concurrent ML - threads, events, channels, ...)
   eXene-0.4.tar.Z      (X11 interface (not tested yet on 386bsd))

You will need to patch the file src/makeml and src/runtime/export.c.

To build a working sml executable just type

   makeml -i386 386bsd ... (any other options you deem appropriate)
                ^^^^^^

Here are the diffs:

------------- aditions to export.c ----------------------------------- 
*** runtime/export.c	Mon Mar 22 19:40:59 1993
--- ../save/runtime/export.c	Wed Apr 14 16:51:29 1993
***************
*** 26,31 ****
--- 26,35 ----
  
  #define CEIL(x,quantum) ((((int)(x))+(quantum)-1)&~((quantum)-1))
  
+ #ifdef i386BSD
+ #undef BSD386
+ #endif
+ 
  #ifdef MIPS
  #define N_DATADDR 0x10000000
  #define N_TXTADDR 0x400000 /* start of headers; text segment follows */
***************
*** 240,245 ****
--- 244,256 ----
  
      }
  #endif
+ #ifdef i386BSD
+     {int i, nzeros = getpagesize()-sizeof(E);
+ 	char zeros[4096];
+         for(i=0;i<nzeros;i++) zeros[i]=0;
+         bulletproofWrite(filid,zeros,nzeros);
+     }
+ #endif
  #if sony_news || MORE
      {int i, nzeros = getpagesize()-bytcount;
       char zeros[4096];
***************


--------------- additions to makeml ----------------------------------

*** makeml	Mon Mar 22 00:03:43 1993
--- ../save/makeml	Wed Apr 14 16:50:27 1993
***************
*** 204,212 ****
  	    case $1 in
  		bsd)    OPSYS=BSD ;;
  		bsd386) OPSYS=BSD; DEFS="$DEFS -DBSD386";;
  		mach)   OPSYS=MACH; DEFS="$DEFS -DBSD";;
  		*)
! 		    echo "$CMD must specify opsys arg for i386/i486 (bsd, bsd386 or mach)"
  		    exit 1
  		;;
  	    esac
--- 204,213 ----
  	    case $1 in
  		bsd)    OPSYS=BSD ;;
  		bsd386) OPSYS=BSD; DEFS="$DEFS -DBSD386";;
+ 		386bsd) OPSYS=BSD; DEFS="$DEFS -DBSD386 -Di386BSD";;
  		mach)   OPSYS=MACH; DEFS="$DEFS -DBSD";;
  		*)
! 		    echo "$CMD must specify opsys arg for i386/i486 (bsd, bsd386, 386bsd or mach)"
  		    exit 1
  		;;
  	    esac

-----------------------------------

That's all. I hope this will be useful.

Olaf

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ 
| Olaf Wagner           | wagner@luthien.in-berlin.de (private) | 
| Hobrechtstrasse 80    | owagner@cs.tu-berlin.de (work)        |
| 1000 Berlin 44        | phone: 49 30  624 99 48               |
| Germany / Deutschland | please don't call before 9 o'clock    |
/////////////////////////////////////////////////////////////////