[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compiling T



Here is what is required to generate Alliant T from a Sun. You should
be able to modify it to do what you want.
John
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	sources/system/sun2al.sh
#	sources/orbit/assembler/alis.t
#	sources/orbit/back_end/unalgen.t
#	sources/orbit/build/ocomp.t
#	sources/orbit/build/oload.t
#	sources/orbit/build/orbit_files.t
#	sources/system/sun2al.t
#	sources/system/sun2al.c
#	sources/system/sun2almakefile
#	sources/system/al_start_t.s
#	sources/system/al.sh
#	sources/system/almachine.t
# This archive created: Sun Sep 20 10:27:29 1987
export PATH; PATH=/bin:$PATH
if test -f 'sources/system/sun2al.sh'
then
	echo shar: will not over-write existing file "'sources/system/sun2al.sh'"
else
cat << \SHAR_EOF > 'sources/system/sun2al.sh'
#!/bin/sh
# See $OSYS/sun2al.t for instructions.
date > 'sun2al.log'
# You should delete information files.
# rm $TSOURCES/*/*.m*
# rm $TSOURCES/*/*/*.m*
t >> 'sun2al.log' <<\T_EOF
(set (repl-env) orbit-env)
(load '(osys sun2al))
(sun->alliant)
(exit)
T_EOF
date >> 'sun2al.log'
SHAR_EOF
fi # end of overwriting check
if test -f 'sources/orbit/assembler/alis.t'
then
	echo shar: will not over-write existing file "'sources/orbit/assembler/alis.t'"
else
cat << \SHAR_EOF > 'sources/orbit/assembler/alis.t'
(herald (assembler alis t 0)
        (env t (assembler as_open))
        (syntax-table tas-syntax-table))

;;; Instructions special to the Alliant.

;;; fmoveddfp0 moves a double precision floating point
;;; number in register fp0 to an effective address.
;;; Used to handle a return of a double from C code.
(define (al/fmoveddfp0 ea)
    (or (fmoveddfp0 ea)
        (error "no match for (fmove.dd fp0 ~g)" ea)))

;;; Ugly hack to make it only work with 2(a4).
(define-fg (fmoveddfp0 (ea-m&a? dst))
  (printer "fmove.d fp0,2(a4)")
  ;; Op-code
  (1 1 1 1 1 0 1 0 0 0)
  ;; 6-bits of effective address.
  (1 0 1 1 0 0)
  ;; type-ea  type-fpy  fpy  1 0 1 0 0 0 0
  ;; double   double    fp0  1 0 1 0 0 0 0
  (1 1 1  1 1 1  0 0 0  1 0 1 0 0 0 0)
  (0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0))
SHAR_EOF
fi # end of overwriting check
if test -f 'sources/orbit/back_end/unalgen.t'
then
	echo shar: will not over-write existing file "'sources/orbit/back_end/unalgen.t'"
else
cat << \SHAR_EOF > 'sources/orbit/back_end/unalgen.t'
(herald unalgen)

;;; we can do unsafe things here once we set the foreign call cont

(define (generate-foreign-call node)
  (destructure (((cont foreign rep-list value-rep . args) (call-args node)))
    (emit m68/move .l SP (reg-offset TASK task/foreign-call-cont))
    (generate-push nil-reg)   ; save slink
    (generate-move nil-reg AN)
    (emit m68/move .l TASK (reg-offset AN slink/current-task))
    ;;; make a dummy stack frame.
    (emit m68/link TASK (machine-num -8))
    (iterate loop ((args (reverse args)); Push args.
                   (reps (map cadr (leaf-value rep-list))))
      (cond ((null? args)
             (walk (lambda (node) (kill (leaf-value node))) args))
            ((eq? (car reps) 'rep/double)
             (let ((reg (->register 'pointer node (leaf-value (car args)) '*)))
               (emit m68/move .l (reg-offset reg 6) (@-r 15))
               (emit m68/move .l (reg-offset reg 2) (@-r 15))
               (loop (cdr args) (cdr reps))))
            (else
             (rep-push node (leaf-value (car args)) (car reps))
             (loop (cdr args) (cdr reps)))))
    (let ((reg (->register 'pointer node (leaf-value foreign) '*))) ; get xenoid
      (emit m68/move .l (reg-offset reg 6) A1))  ; A1, get 2nd slot
    ;;; The above uses A0, so this must be done here!
    (cond ((null? args)		; Set up parameter list pointer in A0.
	   (generate-move-word (machine-num 0) P))
	  (else
	   (generate-move SP P)
	   ;; This is supposed to generate a pea, but its not an ea.
	   (generate-push (machine-num (length args)))))
    (emit m68/jsr (@r 9))   ; A1 is 9.  Can't be A0 (holds the parameter list).
    (clear-slots)
    (emit m68/unlk TASK)    ; Pop stack frame; load saved A6 (TASK).
    (emit m68/move .l (reg-offset TASK task/foreign-call-cont) SP)
    (emit m68/move .l (reg-offset sp -4) nil-reg)  ; restore slink
    (emit m68/clr .l (reg-offset TASK task/foreign-call-cont))
    (case (leaf-value value-rep)
      ((rep/undefined ignore))                                        
      ((rep/double)			; cons a flonum
;;;       (emit m68/move .l S1 SCRATCH)	; save hign longword
       (emit m68/move .l (machine-num 8) S1); 2 words for double
;;;    float is left in fp0 on an Alliant.
       (emit m68/move .l (machine-num header/double-float) AN)
       (generate-move nil-reg A1)
       (emit m68/jsr (reg-offset A1 slink/make-extend))
;;;       (emit m68/move .l SCRATCH (reg-offset AN 6))
;;;       (emit m68/move .l S0 (reg-offset AN 2))
       (emit al/fmoveddfp0 (reg-offset AN 2))
       (emit m68/move .l AN A1))                         ; return consed flonum
      (else
       (really-rep-convert node S0 (leaf-value value-rep) A1 'rep/pointer)))
    (if (eq? (leaf-value value-rep) 'ignore)
        (generate-return 0)
        (generate-return 1))))

(define (rep-push node value to-rep)
  (let ((access (access-value node value)))
    (case to-rep
      ((rep/pointer) (generate-push access))
      ((rep/extend)
       (emit m68/move .l access (@-r 15))
       (emit m68/add .l (machine-num tag/extend) (@r 15)))
      (else
       (select (rep-size to-rep)
         ((size/long)
          (really-rep-convert node access 'rep/pointer (@-r 15) to-rep))
         ((size/word)
          (emit m68/pea (@r 8))                                         
          (really-rep-convert node access 'rep/pointer (d@r 15 2) to-rep))
         ((size/byte)
          (emit m68/pea (@r 8))                                         
          (really-rep-convert node access 'rep/pointer (d@r 15 3) to-rep)))))))
SHAR_EOF
fi # end of overwriting check
if test -f 'sources/orbit/build/ocomp.t'
then
	echo shar: will not over-write existing file "'sources/orbit/build/ocomp.t'"
else
cat << \SHAR_EOF > 'sources/orbit/build/ocomp.t'
(herald ocomp)
;;; Alliant version.
(define orbit-files
    '((top orbit_imports)
      (top defs)
      (top util)
      (top primop)
      (top orbit_syntax)        ;** changed 12 July 86
      (top top)
      (front_end free_stuff)
      (front_end let_nodes)
      (front_end type_sets)
      (front_end types)
      (front_end type)
      (front_end envs)
      (front_end nodestuff)
      (front_end shape)
      (front_end expand)
      (front_end alpha)
      (front_end declare)
      (front_end node)
      (front_end assign)
      (front_end simplify)
      (front_end simplify_call)
      (front_end simplify_let)
      (front_end param)
      (front_end simplifiers)
      (front_end simplify_y)
      (front_end fx_const)
      (front_end safe)
      (front_end inf_files)
      (front_end gen_interface)
      (front_end fixup)
      (front_end user)
      (front_end user_error)
      (front_end module)
      (front_end analyze)
      (front_end front)
      (back_end strategy)
      (back_end live)
      (back_end closure)
      (back_end comex)
      (back_end bookkeep)
      (back_end generate)
      (back_end generate_y)
      (back_end parassign)
      (back_end reg)
      (back_end lookup)
      (back_end m68emit)
      (back_end m68bookkeep)
      (back_end m68gen)
      (back_end m68locgen)
      (back_end m68arithgen)
      (back_end m68rep)
      (back_end unalgen)   ;;; Alliant foreign code generator.
      (assembler ib)
      (assembler as_open)      
      (assembler fg)
      (assembler lap)
      (assembler as_utils)     
      (assembler as)           
      (assembler count)
      (assembler mark)
      (assembler mini)
      (assembler bits)
      (assembler listing)
      (assembler as_m68)
      (assembler m68am)
      (assembler m68is1)
      (assembler m68is2)
      (assembler alis)))    ;;; Alliant instructions.

;;;; Make sure new code generator is loaded.
;;; (load '(assembler compile_as) orbit-env)
;;; (load '(assembler alis) orbit-env)	; Get new instructions.
;;; (load '(back_end unalgen) orbit-env)	; Get new code generator.

(define tas-locale (make-locale standard-env 'tas))
(define tas-syntax-table (env-syntax-table tas-locale))

(walk comfile '((assembler expand)
		(assembler fg_spec)  
		(assembler fg_expr)  
		(assembler as_syntax)))
         
(load '(assembler as_utils) tas-locale)
(load '(assembler fg_spec) tas-locale)
(load '(assembler fg_expr) tas-locale)
(load '(assembler expand) tas-locale)
(load '(assembler as_syntax) tas-locale)

(set (tc-syntax-table) (env-syntax-table orbit-env))
(walk comfile (cons '(t3_primops base) orbit-files))
SHAR_EOF
fi # end of overwriting check
if test -f 'sources/orbit/build/oload.t'
then
	echo shar: will not over-write existing file "'sources/orbit/build/oload.t'"
else
cat << \SHAR_EOF > 'sources/orbit/build/oload.t'
(herald oload (env tsys))

;;; Alliant version

(let ((oenv (make-locale standard-env 'orbit-env)))
  (*define standard-env 'orbit-env oenv)
  (*define standard-env '*orbit-env* oenv)

  (*define t-implementation-env 'orbit-env oenv)
  (*define t-implementation-env '*orbit-env* oenv)

  (*define oenv 'load-orbit
    (lambda system
      (let ((os (if (null? system) 
                    ((*value t-implementation-env 'os-type)
                     ((*value t-implementation-env 'local-os)))
                    (car system)))
            (processor (if (null? system) 
                           ((*value t-implementation-env 'processor-type)
                            ((*value t-implementation-env 'local-processor)))
                           (cadr system))))
        (load '(build orbit_files) oenv)
        (walk (lambda (f) (load f oenv)) (*value oenv '*orbit-files*))
        (walk (lambda (f) (load f oenv)) (*value oenv '*top-files*))
        (walk (lambda (f) (load f oenv)) (*value oenv '*front-files*))
        (*define oenv 'variable-support (*value oenv 'variable-definition))
        (*define oenv 'primop.support-variant (*value oenv 'primop.definition-variant))
        (walk (lambda (f) (load f oenv)) (*value oenv '*back-end-files*))
        (xcase processor
          ((mc68000)
           (walk (lambda (f) (load f oenv)) (*value oenv '*orbit-m68-files*)))
          ((vax11)
           (walk (lambda (f) (load f oenv)) (*value oenv '*orbit-vax-files*))))
        (walk (lambda (f) (load f oenv)) (*value oenv '*tas-files*))
        (xcase processor
          ((mc68000)
           (walk (lambda (f) (load f oenv)) (*value oenv '*tas-m68-files*)))
          ((vax11)
           (walk (lambda (f) (load f oenv)) (*value oenv '*tas-vax-files*))))
        (load (xcase os
                ((aegis) '(back_end aem68gen))
                ((unix)
                 (xcase processor
;;;;; Alliant modification     ((mc68000) '(back_end unm68gen))
                   ((mc68000) '(back_end unalgen))
                   ((vax11) '(back_end unvaxgen)))))
              orbit-env)
        (let ((load (*value t-implementation-env 'load-quietly-if-present)))
          (load '(top fix)             oenv)
          (load '(front_end fix)       oenv)
          (load '(back_end fix)       oenv)
          (load '(assembler fix)       oenv))
        (xcase processor
            ((mc68000)
      ;**
             (load-quietly            '(t3_primops m68constants) oenv)
             (load-quietly-if-present '(back_end   m68fix)       oenv)
             (load-quietly-if-present '(assembler  m68fix)       oenv)
             ((*value oenv 'orbit-m68-init) 't3_primops))
            ((vax11)
       ;**
             (load-quietly            '(t3_primops vaxconstants) oenv)
             (load-quietly-if-present '(back_end   vaxfix)       oenv)
             (load-quietly-if-present '(assembler  vaxfix)       oenv)
             ((*value oenv 'orbit-vax-init) 't3_primops)))
        (*define t-implementation-env 'comfile (*value oenv 'comfile))
        (walk (lambda (sym)
                (*define standard-env sym (*value oenv sym)))
              '(cl 
                quicklist 
                orbit 
                comfile 
                compile-file 
                comfile2 
                tc-syntax-table
                make-empty-early-binding-locale
                )))))

    oenv)
SHAR_EOF
fi # end of overwriting check
if test -f 'sources/orbit/build/orbit_files.t'
then
	echo shar: will not over-write existing file "'sources/orbit/build/orbit_files.t'"
else
cat << \SHAR_EOF > 'sources/orbit/build/orbit_files.t'
(herald (front_end orbit_files))

;;; Alliant version.

;;; Copyright (c) 1985 Yale University
;;;     Authors: N Adams, R Kelsey, D Kranz, J Philbin, J Rees.
;;; This material was developed by the T Project at the Yale University Computer 
;;; Science Department.  Permission to copy this software, to redistribute it, 
;;; and to use it for any purpose is granted, subject to the following restric-
;;; tions and understandings.
;;; 1. Any copy made of this software must include this copyright notice in full.
;;; 2. Users of this software agree to make their best efforts (a) to return
;;;    to the T Project at Yale any improvements or extensions that they make,
;;;    so that these may be included in future releases; and (b) to inform
;;;    the T Project of noteworthy uses of this software.
;;; 3. All materials developed as a consequence of the use of this software
;;;    shall duly acknowledge such use, in accordance with the usual standards
;;;    of acknowledging credit in academic research.
;;; 4. Yale has made no warrantee or representation that the operation of
;;;    this software will be error-free, and Yale is under no obligation to
;;;    provide any services, by way of maintenance, update, or otherwise.
;;; 5. In conjunction with products arising from the use of this material,
;;;    there shall be no use of the name of the Yale University nor of any
;;;    adaptation thereof in any advertising, promotional, or sales literature
;;;    without prior written consent from Yale in each case.
;;;

(block

(define *orbit-files*
    '((front_end free_stuff)
      (top       orbit_imports)
      ))

(define *top-files*
    '(
;     (top sets)   ; in system now
      (top defs)
      (top util)
      (top primop)
      (top orbit_syntax)        ;** changed 12 July 86  ;** gone March 86
      (top top)
      ))

(define *front-files*
    '((front_end let_nodes)
      (front_end type_sets)
      (front_end types)
      (front_end type)
      (front_end envs)
      (front_end nodestuff)
      (front_end shape)
      (front_end expand)
      (front_end alpha)
      (front_end declare)
      (front_end node)
      (front_end assign)

      (front_end simplify)
      (front_end simplify_call)
      (front_end simplify_let)
      (front_end param)
      (front_end simplifiers)
      (front_end simplify_y)
      (front_end fx_const)

      (front_end safe)
      (front_end inf_files)
      (front_end gen_interface)
      (front_end fixup)
      (front_end user)
      (front_end user_error)
      (front_end module)
      (front_end analyze)
      (front_end front)
      ))

(define *back-end-files*
    '((back_end strategy)
      (back_end live)
      (back_end closure)
      (back_end comex)
      (back_end bookkeep)
      (back_end generate)
      (back_end generate_y)
      (back_end parassign)
      (back_end reg)
      (back_end lookup)))

(define *orbit-m68-files*
    '((back_end m68emit)
      (back_end m68bookkeep)
      (back_end m68gen)
      (back_end m68locgen)
      (back_end m68arithgen)
      (back_end m68rep)
      ))

(define *orbit-vax-files*
    '((back_end vaxemit)
      (back_end vaxbookkeep)
      (back_end vaxgen)
      (back_end vaxlocgen)
      (back_end vaxarithgen)
      (back_end vaxrep)
      ))

(define *tas-files*
    '((assembler as_open)      ;; for assembler & machine descriptions
      (assembler as_utils)     ;; utilities for the assembler
      (assembler as)           ;; client compiler interface
      ;; the assembler
      (assembler fg)
      (assembler ib)
      (assembler count)
      (assembler mark)
      (assembler mini)
      (assembler bits)
      (assembler listing)
      ;; lap user interface
      (assembler lap)
      ))

(define *tas-m68-files*
    '((assembler as_m68)
      (assembler m68am)
      (assembler m68is1)
      (assembler m68is2)
      (assembler alis)			; Alliant instructions.
      ))

(define *tas-vax-files*
    '((assembler as_vax)
      (assembler vaxam)
      (assembler vmodes)
      (assembler vaxi)
      (assembler vaxis)
      ))

nil)
SHAR_EOF
fi # end of overwriting check
if test -f 'sources/system/sun2al.t'
then
	echo shar: will not over-write existing file "'sources/system/sun2al.t'"
else
cat << \SHAR_EOF > 'sources/system/sun2al.t'
(herald sun2al)

;; Load into orbit-env.

;;; A procedural description of how to generate T for the Alliant
;;; when a Sun is available.  April 1987.
;;; Authors: John Ramsdell of The MITRE Corporation and
;;;          David Kranz of Yale University.
;;; Distributed under the same conditions as is T project software.

;;; Copyright (c) 1985 Yale University
;;;     Authors: N Adams, R Kelsey, D Kranz, J Philbin, J Rees.
;;; This material was developed by the T Project at the Yale University Computer 
;;; Science Department.  Permission to copy this software, to redistribute it, 
;;; and to use it for any purpose is granted, subject to the following restric-
;;; tions and understandings.
;;; 1. Any copy made of this software must include this copyright notice in full.
;;; 2. Users of this software agree to make their best efforts (a) to return
;;;    to the T Project at Yale any improvements or extensions that they make,
;;;    so that these may be included in future releases; and (b) to inform
;;;    the T Project of noteworthy uses of this software.
;;; 3. All materials developed as a consequence of the use of this software
;;;    shall duly acknowledge such use, in accordance with the usual standards
;;;    of acknowledging credit in academic research.
;;; 4. Yale has made no warrantee or representation that the operation of
;;;    this software will be error-free, and Yale is under no obligation to
;;;    provide any services, by way of maintenance, update, or otherwise.
;;; 5. In conjunction with products arising from the use of this material,
;;;    there shall be no use of the name of the Yale University nor of any
;;;    adaptation thereof in any advertising, promotional, or sales literature
;;;    without prior written consent from Yale in each case.
;;;

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Instructions:

;;; On the Sun:

;;; Define the directories:
;;; BACK_END ASSEMBLER T3_PRIMOPS PRIMOP_SOURCE PRIMOP_DEST 
;;; BUILD TOP ORBIT_TOP FRONT_END TSCHEME OSYS and LINK.
;;;
;;; setenv BUILD $TSOURCES/orbit/build
;;; setenv TOP $TSOURCES/orbit/top
;;; setenv ORBIT_TOP $TSOURCES/orbit/top
;;; setenv FRONT_END $TSOURCES/orbit/front_end
;;; setenv BACK_END $TSOURCES/orbit/back_end
;;; setenv ASSEMBLER $TSOURCES/orbit/assembler
;;; setenv T3_PRIMOPS $TSOURCES/orbit/primops
;;; setenv PRIMOP_SOURCE $TSOURCES/orbit/primops
;;; setenv PRIMOP_DEST $TSOURCES/orbit/primops
;;; setenv OSYS $TSOURCES/system
;;; setenv LINK $TSOURCES/link
;;; setenv TSCHEME $TSOURCES/scheme
;;; setenv HACKS $TSOURCES/hacks
;;;

;;; Load this file into orbit-env.  (See $OSYS/sun2al.sh).

;;; Run sun->alliant (defined in this file) to produce
;;; sun2alt.o, a Sun object file.

;;; On the Alliant:

;;; copy sun2alt.o, al_start_t.s, *.c, sun2almakefile and al.sh
;;; from $OSYS to the Alliant.

;;; "make -f sun2almakefile" will construct xt.

;;; move xt to t and sun2alt.o to sun2alt.o.0.

;;; Load compiler and suspend T with:
;;; t -h 8000000
;;; (set (repl-env) t-implementation-env)
;;; (load-and-suspend-system '(osys sun2alt))
;;; (exit)
;;; This is the contents of al.sh.

;;; "make -f sun2almakefile" will construct xt.

;;; This xt should be moved to t and used to compile
;;; (osys alkernel) and any fix files you want preloaded.
;;; You must (set (tc-syntax-table) (env-syntax-table t-implementation-env))
;;; before compiling (osys alkernel).
;;; Exit t.

;;; Suspend T with
;;; T -h 8000000
;;; ... your loads, if any ...
;;; (set (repl-env) orbit-env)
;;; (set *object-file-extension* 'aobj)
;;; (set *information-file-extension* 'ainf)
;;; (set *noise-file-extension* 'anoi)
;;; (set (repl-env) t-implementation-env)
;;; (load '(osys alkernel))
;;; (system-suspend '(osys sun2alt) '#f)
;;; (exit)

;;; "make -f sun2almakefile" will construct xt.

;;; This xt is the final product.  Install this as t
;;; after testing it.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;??? Bug here?
(*define user-env 'make-empty-support-env
	 make-empty-early-binding-locale)
(*define user-env 'make-empty-early-binding-locale
	 make-empty-early-binding-locale)
(define (com-sun-primops)
;;; Taken from primops_build.doc
;Below is the procedure for compiling the primops.

;;; To compile system files that contain primops set *COMPILE-PRIMOPS?* to #F
;;; and ignore the "primops not compiled for this system" messages.

;;; 68000
;;; Run this in a 68000 compiler.

(load '(t3_primops m68constants) orbit-env)
(orbit-m68-setup 'primop_dest)
(orbit-init 'base)
(set (orbit-syntax-table) primop-syntax-table)
(set *compile-primops?* nil)
(create-support '(primop_source m68constants) '(primop_dest m68constants))
(create-support '(primop_source m68primops)   '(primop_dest m68primops))
(create-support '(primop_source m68arith)     '(primop_dest m68arith))
(create-support '(primop_source locations)    '(primop_dest locations))
(create-support '(primop_source m68low)       '(primop_dest m68low))
(create-support '(primop_source predicates)   '(primop_dest predicates))
(orbit-init 'base 'constants 'primops 'arith 'locations 'low 'predicates)
(comfile2 '(primop_source open)    '(primop_dest open))
(comfile2 '(primop_source aliases) '(primop_dest aliases))
(comfile2 '(primop_source carcdr)  '(primop_dest carcdr))
(orbit-init 'base  
            'constants 'primops 'arith 'locations 'low 'predicates  
            'open 'aliases 'carcdr)

;;; To compile the primop code in the MINF files do the following:
(compile-primop-source '(primop_dest m68constants minf))
(compile-primop-source '(primop_dest m68primops   minf))
(compile-primop-source '(primop_dest m68arith     minf))
(compile-primop-source '(primop_dest locations    minf))
(compile-primop-source '(primop_dest m68low       minf))
(set *compile-primops?* '#t)
(walk comfile
      (del (lambda (x y) (not (eq? x (car y))))
	   't3_primops *t-system*))
)

(define *t-linker* '((link defs)
		     (link sunlink)
		     (link linker)))

(define (com-sun-linker)
  (walk comfile *loader-modules*)
  (walk comfile *t-linker*))
  

(define (make-alliant-comp)
  (load '(assembler compile_as) orbit-env)
  (load '(assembler alis) orbit-env)	; Get new instructions.
  (load '(back_end unalgen) orbit-env)	; Get new code generator.
  )

(define (com-sun->alliant)
  (set (tc-syntax-table) (env-syntax-table t-implementation-env))
  (set (table-entry (*value orbit-env '*modules*) 'bignum) '(osys m68_bignum))
  (walk comfile
	(del (lambda (x y) (not (eq? x (car y))))
	     'osys *t-system*)))

(define *link-env* (make-locale t-implementation-env '*link-env*))

(define (link-sun->alliant)
  (walk (lambda (x) (load x *link-env*)) *t-linker*)	; Load linker.
  ((*value *link-env* 'link)
   *t-system*
   '(osys sun2alt)))

(define (com-sun-tscheme)
  (walk (lambda (name)
	  (compile-file (list 'tscheme name)))
	'(syntax system runtime compiler)))

(define (sun->alliant)
  (load '(osys unix_bsd4_2_files))
  (com-sun-linker)
  (load '(build ocomp) user-env)	; Make orbit.
  (make-alliant-comp)
  ;;; Now the sun T3 compiler is generating Alliant code.
  (load '(build ocomp) user-env)	; Make orbit for the Alliant.
  (com-sun-primops)
  (walk comfile '((link lp_table)	; Make suspender.
		  (link suspend)
		  (link sunsuspend)))
  (com-sun-tscheme)
  (com-sun->alliant)
  (link-sun->alliant))

		  
SHAR_EOF
fi # end of overwriting check
if test -f 'sources/system/sun2al.c'
then
	echo shar: will not over-write existing file "'sources/system/sun2al.c'"
else
cat << \SHAR_EOF > 'sources/system/sun2al.c'
/* Translates object files from the Suns into
   object files for the Alliant.  Only the header
   must be changed.  Use on the Alliant only.  Just
   change the a_magic field back to the Unix standard.
   Command: sun2al < {sun.o} > {alliant.o} */

#include <stdio.h>

#include <a.out.h>

struct exec object_hdr;

char buf[BUFSIZ];

main()
{
  register int n;
  /* Get Sun header. */
  n = fread ((char *) &object_hdr, sizeof(struct oexec), 1, stdin);
  if (n != 1) {
    fprintf (stderr, "Bad read of Sun header\n");
    exit (1);
  }
  /*  Make Alliant header. */
  object_hdr.a_magic = OMAGIC;
  object_hdr.a_flags = 0;
  /*  Write new header. */
  n = fwrite ((char *) &object_hdr, sizeof(struct oexec), 1, stdout);
  if (n != 1) {
    fprintf (stderr, "Bad write of Alliant header\n");
    exit (1);
  }
  /* Copy data. */
  while ((n = fread (buf, 1, BUFSIZ, stdin)) != 0) {
    if (n < 0) {
      perror ("Bad read copying.\n");
      exit (1);
    }
    if (0 == fwrite (buf, 1, n, stdout)) {
      perror ("Bad write copying.\n");
      exit (1);
    }
  }
}
SHAR_EOF
fi # end of overwriting check
if test -f 'sources/system/sun2almakefile'
then
	echo shar: will not over-write existing file "'sources/system/sun2almakefile'"
else
cat << \SHAR_EOF > 'sources/system/sun2almakefile'
all:		xt

map:		xt.map

sun2al:	sun2al.c
		cc -o $@ sun2al.c

t.o:		sun2al sun2alt.o
		sun2al < sun2alt.o > /tmp/t407.o
		ld -r /tmp/t407.o -o t.out 
		mv t.out $@
		rm /tmp/t407.o

unassist.o:	unassist.c
	   	cc -c unassist.c

expand.o:	expand.c
	   	cc -c expand.c

float.o:	float.c
	   	cc -c float.c

al_start_t.o:	al_start_t.s
	   	cc -c al_start_t.s

xt.map:		xt
		nm -n xt > $@

xt:		t.o unassist.o expand.o al_start_t.o float.o
		ld -nxp -nc -e start t.o al_start_t.o /lib/crt0.o \
		unassist.o expand.o float.o -lm -lc -o xt
SHAR_EOF
fi # end of overwriting check
if test -f 'sources/system/al_start_t.s'
then
	echo shar: will not over-write existing file "'sources/system/al_start_t.s'"
else
cat << \SHAR_EOF > 'sources/system/al_start_t.s'
        .globl	_start_t
        .globl	interrupt_dispatcher
        .globl	_hack_divide
        .text

_start_t:
# On Alliant, overwrite parameter descriptor with return address,
# and pop the stack.  This fixes the stack for big-bang.
	movl	sp@,a1 
	movl	a0,sp
	pea	a1@
# Flush instruction cache.
	link	a6,#-8
	movl	a0,a6@(-4)
	movw	#0,a0	| call _flushicache
	jsr	_flushicache
	unlk	a6
# What follows is the same as is done on the Suns.
        lea	interrupt_xenoid+2,a0
        movl	a0,d0
        lea	big_bang,a0     
        movl	a0@(-2),a5
        jmp	a5@

        .data
        .align	2
interrupt_xenoid:
        .long	49
        .long	L1
        .text
# code in S0, context in A1 (at least that is what the comment said.)
# I think code really means the signal.
L1:	movl	a0@,d0		| signal
        movl	a0@(8),a1	| context
	movl	a6,sp@-		| save frame pointer
        lea	interrupt_dispatcher,a0
        movl	a0@(-2),a5
        jsr	a5@
	movl	sp@+,a6		| pop frame pointer
        rts
_hack_divide:
# M68K code:
#       movl	sp@(4),d0
#       divsl	sp@(8),d0
# Duplicate the top of the stack which allocates four
# bytes for temporary storage for ldiv.
	movl	sp@,a1
	pea	a1@		| Allocate stack space.
	jmp	ldiv		| Let ldiv do the return.
SHAR_EOF
fi # end of overwriting check
if test -f 'sources/system/al.sh'
then
	echo shar: will not over-write existing file "'sources/system/al.sh'"
else
cat << \SHAR_EOF > 'sources/system/al.sh'
#!/bin/sh
# Remember to move xt to t.
date > 'al.log'
t -h 8000000 >> 'al.log' <<\T_EOF
(set (repl-env) t-implementation-env)
(load-and-suspend-system '(ali sun2alt))
(exit)
T_EOF
date >> 'al.log'
SHAR_EOF
fi # end of overwriting check
if test -f 'sources/system/almachine.t'
then
	echo shar: will not over-write existing file "'sources/system/almachine.t'"
else
cat << \SHAR_EOF > 'sources/system/almachine.t'
(herald almachine
  (env tsys))

;;; Modifications to Sun sources for the Alliant.  April 1987.
;;; Authors: John Ramsdell of The MITRE Corporation.
;;; Distributed under the same conditions as is T project software.

;;; Copyright (c) 1985 Yale University
;;;     Authors: N Adams, R Kelsey, D Kranz, J Philbin, J Rees.
;;; This material was developed by the T Project at the Yale University Computer 
;;; Science Department.  Permission to copy this software, to redistribute it, 
;;; and to use it for any purpose is granted, subject to the following restric-
;;; tions and understandings.
;;; 1. Any copy made of this software must include this copyright notice in full.
;;; 2. Users of this software agree to make their best efforts (a) to return
;;;    to the T Project at Yale any improvements or extensions that they make,
;;;    so that these may be included in future releases; and (b) to inform
;;;    the T Project of noteworthy uses of this software.
;;; 3. All materials developed as a consequence of the use of this software
;;;    shall duly acknowledge such use, in accordance with the usual standards
;;;    of acknowledging credit in academic research.
;;; 4. Yale has made no warrantee or representation that the operation of
;;;    this software will be error-free, and Yale is under no obligation to
;;;    provide any services, by way of maintenance, update, or otherwise.
;;; 5. In conjunction with products arising from the use of this material,
;;;    there shall be no use of the name of the Yale University nor of any
;;;    adaptation thereof in any advertising, promotional, or sales literature
;;;    without prior written consent from Yale in each case.
;;;


;;; Modification to (osys sunkernel).
(define (local-machine)
  (object nil                               
      ((machine-type self)          'alliant)
      ((page-size self)             4096)
      ((source-file-type self)      't)
      ((object-file-type self)      'aobj)
      ((information-file-type self) 'ainf)
      ((noise-file-type self)       'anoi)
      ((print-type-string self)     "Machine")))

;;; The orbit extension should be set for the Alliant by evaluating 
;;; an unquoted version of the form below in the orbit-env.
`(block
  (set *object-file-extension* 'aobj)
  (set *information-file-extension* 'ainf)
  (set *noise-file-extension* 'anoi)
  )
SHAR_EOF
fi # end of overwriting check
#	End of shell archive
exit 0