Return-Path: thinman@netcom.com
Received: by jove.pa.dec.com; id AA25422; Tue, 23 Feb 93 16:33:56 -0800
Received: by inet-gw-2.pa.dec.com; id AA25228; Tue, 23 Feb 93 16:33:55 -0800
Received: by nfs-serv.netcom.com (5.65/SMI-4.1/Netcom)id AA11758; Tue, 23 Feb 93 16:31:46 -0800
Date: Tue, 23 Feb 93 16:31:46 -0800
From: thinman@netcom.com (Technically Sweet)
Message-Id: <9302240031.AA11758@nfs-serv.netcom.com>
X-Mailer: Mail User's Shell (7.2.3 5/22/91)
To: bartlett
Subject: Patch for 386BSD

Hi-

This is a patch for the 386BSD freeware Unix system.

This patch goes on top of 01nov91.tar.Z AND the MCC01.patch.
SCI works OK, all tests work when compiled.  Aubrey Jaffer's
"test.scm" bombs in (gcd -4 0) and otherwise has a few errors.
These are exactly the same as on my 386/at&t machine.
I.e. #f is inexact, and a few others.  SCC recompiles
nicely, and recompiled itself nicely and the tests still
compiled and worked.  (It would help if scsc/makefile supported
rebuilding itself.)  Cdecl recompiles.  X tests run somewhat but
the C development system is still shakey.  I haven't run
my VR window system.  Won't for awhile.

The 01feb93 port doesn't work very well.  I'll wait until
you have a happy release and try again.

(BSD386 is another Unix, but starting identifiers with
a number is always iffy.  They can call themselves BSDI.)

*** /dev/null	Sat Jan 30 09:27:13 1993
--- BSD386	Sat Jan 30 12:22:59 1993
***************
*** 0 ****
--- 1,30 ----
+ #
+ # This is the header file for constructing make files for BSD386 processors.
+ #
+ 
+ .SUFFIXES:
+ .SUFFIXES:	.o .c .sc .s .u
+ 
+ # Processor name:
+ 
+ cpu = BSD386
+ 
+ # Default flags to use when invoking the C compiler.
+ 
+ CFLAGS = -O 
+ CC = cc
+ CLIBS = -lm
+ 
+ # Assembly language object files.
+ 
+ Aruntime =
+ 
+ # Profiled library
+ 
+ Plib =
+ 
+ # Heap size in megabytes for the compiler.
+ 
+ scheapmb = 4 -scl 40
+ 
+ # End of BSD386 header.
*** makefile.orig	Sat Jan 30 12:33:58 1993
--- makefile	Fri Jan 22 18:11:03 1993
***************
*** 34,52 ****
  SUN3LIB = ${SRCDIR}/lib.sun3
  
  I386DIR = ${SRCDIR}/i386
  I386BIN = ${SRCDIR}/bin.i386
  I386LIB = ${SRCDIR}/lib.i386
  
  NeXTDIR = ${SRCDIR}/next
  NeXTBIN = /usr/local/bin
  NeXTLIB = /usr/local/lib
  
  # This is a list of the machines/architectures that are currently supported.
  # These are also the names of the necessary makefile fragements.
! MACHINES = APOLLO I386 ISC386IX MIPS NeXT PRISM SPARC SUN3 TITAN VAX
  
  # Architecture specific directories and links to the source files are
  # constructed by the following commands which follow:
  
  no-target:
  	@echo 'Use "make for<target>", where <target> is one of:'
--- 34,56 ----
  SUN3LIB = ${SRCDIR}/lib.sun3
  
  I386DIR = ${SRCDIR}/i386
  I386BIN = ${SRCDIR}/bin.i386
  I386LIB = ${SRCDIR}/lib.i386
  
+ BSD386DIR = ${SRCDIR}/bsd386
+ BSD386BIN = ${SRCDIR}/bin.bsd386
+ BSD386LIB = ${SRCDIR}/lib.bsd386
+ 
  NeXTDIR = ${SRCDIR}/next
  NeXTBIN = /usr/local/bin
  NeXTLIB = /usr/local/lib
  
  # This is a list of the machines/architectures that are currently supported.
  # These are also the names of the necessary makefile fragements.
! MACHINES = APOLLO I386 ISC386IX BSD386 MIPS NeXT PRISM SPARC SUN3 TITAN VAX
  
  # Architecture specific directories and links to the source files are
  # constructed by the following commands which follow:
  
  no-target:
  	@echo 'Use "make for<target>", where <target> is one of:'
***************
*** 154,165 ****
--- 158,173 ----
  	$(MAKE) "CPU = SUN3" "CPUDIR = ${SUN3DIR}" "SRCDIR = ${SRCDIR}" \
  	     "BINDIR=${SUN3BIN}" "LIBDIR=${SUN3LIB}" forCPU
  
  forI386:
  	$(MAKE) "CPU = I386" "CPUDIR = ${I386DIR}" "SRCDIR = ${SRCDIR}" \
  	     "BINDIR = ${I386BIN}" "LIBDIR = ${I386LIB}" forCPU
+ 
+ forBSD386:
+ 	$(MAKE) "CPU = BSD386" "CPUDIR = ${BSD386DIR}" "SRCDIR = ${SRCDIR}" \
+ 	     "BINDIR = ${BSD386BIN}" "LIBDIR = ${BSD386LIB}" forCPU
  
  forNeXT forNEXT:
  	$(MAKE) "CPU = NeXT" "CPUDIR = ${NeXTDIR}" "SRCDIR = ${SRCDIR}" \
  	   "BINDIR = ${NeXTBIN}" "LIBDIR = ${NeXTLIB}" forCPU
  
  forI386-inplace:
*** .././test/test23.sc	Tue Oct 15 11:14:59 1991
--- ./test/test23.sc	Sun Jan 24 04:00:12 1993
***************
*** 323,335 ****
  (eval-when (load compile eval) (define-constant A-CONSTANT-1 23))
  
  (define-constant A-CONSTANT-2 a-constant-1)
  
  ;;; Access to an external array.
  
! (define-c-external _\i\o\b* ARRAY "_iob")
  (eval-when (load) (define _iob _\i\o\b*))
  (eval-when (eval) (define _iob 0))
  
  ;;; Access to an external procedure pointer.
  
  (define-c-external (c-hypot double double) double "hypot")
--- 323,336 ----
  (eval-when (load compile eval) (define-constant A-CONSTANT-1 23))
  
  (define-constant A-CONSTANT-2 a-constant-1)
  
  ;;; Access to an external array.
  
! ;(define-c-external _\i\o\b* ARRAY "_iob")
! (define-c-external _\i\o\b* ARRAY "__sF")
  (eval-when (load) (define _iob _\i\o\b*))
  (eval-when (eval) (define _iob 0))
  
  ;;; Access to an external procedure pointer.
  
  (define-c-external (c-hypot double double) double "hypot")
*** .././scrt/objects.h	Tue Feb  4 11:35:38 1992
--- ./scrt/objects.h	Fri Jan 22 18:22:37 1993
***************
*** 46,57 ****
--- 46,58 ----
  #ifndef MIPS
  #ifndef TITAN
  #ifndef VAX
  #ifndef SPARC
  #ifndef SUN3
  #ifndef I386
+ #ifndef BSD386
  #ifndef APOLLO
  #ifndef PRISM
  
  #ifdef mips
  #define MIPS 1
  #endif
***************
*** 83,94 ****
--- 84,96 ----
  #ifdef sony_news
  #define SONYNEWS
  #endif
  
  #endif /* PRISM */
  #endif /* APOLLO */
+ #endif /* BSD386 */
  #endif /* I386 */
  #endif /* SUN3 */
  #endif /* SPARC */
  #endif /* VAX */
  #endif /* TITAN */
  #endif /* MIPS */
***************
*** 187,198 ****
--- 189,208 ----
  typedef jmp_buf sc_jmp_buf;
  #define CPUTYPE I386
  #undef MATHTRAPS
  #define MATHTRAPS 0
  #endif
  
+ #ifdef BSD386
+ #include <setjmp.h>
+ typedef jmp_buf sc_jmp_buf;
+ #define CPUTYPE BSD386
+ #undef MATHTRAPS
+ #define MATHTRAPS 0
+ #endif
+ 
  #ifdef SONYNEWS
  #include <setjmp.h>
  #include <sys/time.h>
  typedef jmp_buf sc_jmp_buf;
  #define CPUTYPE MIPS
  #define DOUBLE_ALIGN 1
***************
*** 338,349 ****
--- 348,363 ----
  #define  TP_U( tscp ) ((SCP)((char*)tscp-PAIRTAG))
  #endif
  #ifdef I386
  #define  TX_U( tscp ) ((SCP)((char*)tscp-EXTENDEDTAG))
  #define  TP_U( tscp ) ((SCP)((char*)tscp-PAIRTAG))
  #endif
+ #ifdef BSD386
+ #define  TX_U( tscp ) ((SCP)((char*)tscp-EXTENDEDTAG))
+ #define  TP_U( tscp ) ((SCP)((char*)tscp-PAIRTAG))
+ #endif
  
  /* Fixed point numbers are encoded in the address portion of the pointer.  The
     value is obtained by arithmetically shifting the pointer value two bits to
     the right.  A tag value of 0 is used to allow fixed point numbers to be
     added and subtracted without any tag extraction and insertion.  Note that
     the define FIXED_C assumes that >> provides an arithmetic right shift.
***************
*** 891,902 ****
--- 905,919 ----
  #define VECTOR_ELEMENT( tscp, n ) (*((PATSCP)(((char*)( tscp ))+3+((int)n))))
  #endif
  #ifdef SPARC
  #define VECTOR_ELEMENT( tscp, n ) (*((PATSCP)(((char*)( tscp ))+3+((int)n))))
  #endif
  #ifdef I386
+ #define VECTOR_ELEMENT( tscp, n ) (*((PATSCP)(((char*)( tscp ))+3+((int)n))))
+ #endif
+ #ifdef BSD386
  #define VECTOR_ELEMENT( tscp, n ) (*((PATSCP)(((char*)( tscp ))+3+((int)n))))
  #endif
  #ifdef SUN3
  #define VECTOR_ELEMENT( tscp, n ) (*((PATSCP)(((char*)( tscp ))+3+((int)n))))
  #endif
  #ifdef NeXT
*** .././scrt/heap.h	Tue Feb  4 11:35:36 1992
--- ./scrt/heap.h	Sat Jan 30 10:49:39 1993
***************
*** 52,70 ****
--- 52,74 ----
  #ifdef SUN3
  #include <sys/time.h>
  #else
  #ifdef NeXT
  #include <sys/time.h>
  #else
+ #ifdef	BSD386
+ #include <sys/time.h>
+ #else
  #ifndef SYSV
  #include <time.h>
  #endif
  #endif
  #endif
  #endif
  #endif
+ #endif
  
  #ifndef SYSV
  #include <sys/resource.h>
  #endif
  
  #endif
***************
*** 365,376 ****
--- 369,384 ----
  #ifdef PRISM
  extern int* prism_stack_frame(void);
  #define STACKPTR prism_stack_frame()
  #endif
  
  #ifdef I386
+ #define STACKPTR sc_processor_register( 4 )
+ #endif
+ 
+ #ifdef BSD386
  #define STACKPTR sc_processor_register( 4 )
  #endif
  
  #ifdef SPARC
  #define STACKPTR sc_processor_register( 0 )
  #endif
*** .././scrt/heap.c	Tue Feb  4 11:35:36 1992
--- ./scrt/heap.c	Sat Jan 30 10:45:32 1993
***************
*** 556,567 ****
--- 556,594 ----
  	setjmp(tmp);
  	pp = STACKPTR;
  	while  (pp != sc_stackbase)  move_continuation_ptr( *pp++ );
  }
  #endif I386
  
+ #ifdef BSD386
+ /* The following code is used to read the stack pointer.  The register
+    number is passed in to force an argument to be on the stack, which in
+    turn can be used to find the address of the top of stack.
+ */
+ 
+ int  *sc_processor_register( reg )
+ 	int  reg;
+ {
+ 	return( &reg +1);
+ }
+ 
+ /* All processor registers which might contain pointers are traced by the
+    following procedure.
+ */
+ 
+ static  trace_stack_and_registers()
+ {
+ 	int  i, *pp;
+ 	sc_jmp_buf tmp;
+ 
+ 	setjmp(tmp);
+ 	pp = STACKPTR;
+ 	while  (pp != sc_stackbase)  move_continuation_ptr( *pp++ );
+ }
+ #endif /* BSD386 */
+ 
  
  /* The size of an extended object in words is returned by the following
     function.
  */
  
  static int  extendedsize( obj )
*** .././scrt/cio.c	Tue Feb  4 11:35:35 1992
--- ./scrt/cio.c	Fri Jan 22 20:40:09 1993
***************
*** 64,75 ****
--- 64,80 ----
    else if (unlink(old) == 0)
      return 0;
    return -1;
  }
  #endif
  
+ #ifdef	BSD386
+ /* naughty naughty */
+ #define _cnt	_r
+ #endif
+ 
  int  sc_libc_eof = EOF;
  
  /*  feof(stream)  */
  
  int sc_feof( stream )
  	FILE *stream;
***************
*** 136,146 ****
--- 141,160 ----
     stream, 0 otherwise.
  */
  
  int  sc_bufferedchars( stream )
  	FILE *stream;
  {
+ #ifdef	BSD386
+ 	if  (((stream)->_flags & __SWR) && (((stream)->_w) > 0))
+ 	   return( 1 );
+ 	else if  (((stream)->_flags & __SRD) && (((stream)->_r) > 0))
+ 	   return( 1 );
+ 	else
+ 	   return( 0 );
+ #else
  	if  (((stream)->_cnt) > 0)
  	   return( 1 );
  	else
  	   return( 0 );
+ #endif
  }
*** .././scrt/scinit.c	Tue Feb  4 11:35:41 1992
--- ./scrt/scinit.c	Sat Jan 30 11:59:39 1993
***************
*** 121,132 ****
--- 121,146 ----
  #define STACKBASE (int*)USRSTACK
  #define MACH_STRING "VAX"
  #define CPU_STRING "VAX"
  #define OS_STRING "ULTRIX"
  #endif
  
+ #ifdef BSD386
+ #define ETEXT	((int)&etext)	/* First address after text */
+ #include <sys/param.h>
+ /*
+ #include <vax/vmparam.h>
+ */
+ /* vmparam.h doesn't get put in /usr/include/sys! */
+ #define	USRSTACK	0xFBBFDFFC
+ #define STACKBASE (int*)USRSTACK
+ #define MACH_STRING "PC/AT"
+ #define CPU_STRING "386"
+ #define OS_STRING "386BSD"
+ #endif
+ 
  #ifdef apollo
  #  ifdef _ISP_A88K
  #    define PRISM 1
  #  else
  #    define APOLLO 1
  #  endif
***************
*** 569,581 ****
  	     last_addr <= sc_lastheappage)  {
  	   /* Block fits in the side table */
  	   if  (sc_gcinfo > 1)
  	      fprintf( stderr, "***** To heap %x %x\n", addr, addr+count-1 );
  	   for  (i = first_addr; i <= last_addr; i++)  {
  	      if  (sc_pagegeneration[ i ])  {
! 	         fprintf( "***** COLLECT Trying to reallocate page %d\n", i );
  		 abort();
  	      }
  	      sc_pagegeneration[ i ] = 1;
  	      sc_pagelock[ i ] = 0;
  	   }
  	   sc_heappages = sc_heappages+last_addr-first_addr+1;
--- 583,595 ----
  	     last_addr <= sc_lastheappage)  {
  	   /* Block fits in the side table */
  	   if  (sc_gcinfo > 1)
  	      fprintf( stderr, "***** To heap %x %x\n", addr, addr+count-1 );
  	   for  (i = first_addr; i <= last_addr; i++)  {
  	      if  (sc_pagegeneration[ i ])  {
! 	         fprintf(stderr,  "***** COLLECT Trying to reallocate page %d\n", i );
  		 abort();
  	      }
  	      sc_pagegeneration[ i ] = 1;
  	      sc_pagelock[ i ] = 0;
  	   }
  	   sc_heappages = sc_heappages+last_addr-first_addr+1;
***************
*** 1017,1029 ****
  TSCP  sc_implementation()
  {
  	return(
  	   sc_cons(
  	      sc_cstringtostring( "Scheme->C" ),
  	      sc_cons(
! 	         sc_cstringtostring( "01nov91jfb+MCC01" ),
  	         sc_cons(
  		    sc_cstringtostring( MACH_STRING ),
  		    sc_cons(
  		       sc_cstringtostring( CPU_STRING ),
  		       sc_cons(
  		          sc_cstringtostring( OS_STRING ),
--- 1031,1043 ----
  TSCP  sc_implementation()
  {
  	return(
  	   sc_cons(
  	      sc_cstringtostring( "Scheme->C" ),
  	      sc_cons(
! 	         sc_cstringtostring( "01nov91jfb+MCC01+LCN01" ),
  	         sc_cons(
  		    sc_cstringtostring( MACH_STRING ),
  		    sc_cons(
  		       sc_cstringtostring( CPU_STRING ),
  		       sc_cons(
  		          sc_cstringtostring( OS_STRING ),
***************
*** 1080,1085 ****
--- 1094,1111 ----
      }
      my_end_brk = ptr + vm_page_size;
      goto more;
    }
  }
  #endif /* NeXT */
+ 
+ #ifdef	BSD386
+ char *
+ gcvt(double value, int ndigits, char *buf)
+ {
+ 	char fmt[20];
+ 
+ 	sprintf(fmt, "%%.%dg", ndigits);
+ 	sprintf(buf, fmt, value);
+ 	return buf;
+ }
+ #endif




-- 

Lance Norskog
thinman@netcom.com
Data is not information is not knowledge is not wisdom.
