diff --git a/code/unix-glibc2.lisp b/code/unix-glibc2.lisp
index 013cbde616c1b8ffbd1cb014b0d7a1b837e8040e..faeec949eb62d0557c7c4d0857c66995913ddf9b 100644
--- a/code/unix-glibc2.lisp
+++ b/code/unix-glibc2.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix-glibc2.lisp,v 1.3 1999/02/15 12:05:01 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix-glibc2.lisp,v 1.4 1999/02/20 15:54:39 pw Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -257,12 +257,11 @@
 (def-alien-type daddr-t int)
 (def-alien-type caddr-t (* char))
 (def-alien-type swblk-t long)
-(def-alien-type size-t unsigned-int)
+(def-alien-type size-t #-alpha unsigned-int #+alpha long)
 (def-alien-type time-t long)
 (def-alien-type clock-t long)
 (def-alien-type uid-t unsigned-int)
-(def-alien-type ssize-t int)
-(def-alien-type fd-mask unsigned-long)
+(def-alien-type ssize-t #-alpha int #+alpha long)
 (def-alien-type key-t int)
 (def-alien-type int8-t char)
 (def-alien-type u-int8-t unsigned-char)
@@ -272,27 +271,30 @@
 (def-alien-type u-int32-t unsigned-int)
 (def-alien-type int64-t #+nil long-long #-nil (array long 2))
 (def-alien-type u-int64-t #+nil unsigned-long-long #-nil (array unsigned-long 2))
-(def-alien-type register-t int)
+(def-alien-type register-t #-alpha int #+alpha long)
 
 
-(def-alien-type dev-t uquad-t)
+(def-alien-type dev-t #-alpha uquad-t #+alpha unsigned-long)
 (def-alien-type uid-t unsigned-int)
 (def-alien-type gid-t unsigned-int)
-(def-alien-type ino-t unsigned-long)
+(def-alien-type ino-t #-alpha unsigned-long #+alpha unsigned-int)
 (def-alien-type mode-t unsigned-int)
 (def-alien-type nlink-t unsigned-int)
 (def-alien-type off-t long)
 (def-alien-type loff-t quad-t)
 (def-alien-type pid-t int)
-(def-alien-type ssize-t int)
+(def-alien-type ssize-t #-alpha int #+alpha long)
 
 (def-alien-type fsid-t (array int 2))
 
-(defconstant fd-setsize 1024)
+(def-alien-type fd-mask #-alpha unsigned-long #+alpha unsigned-int)
 
+(defconstant fd-setsize 1024)
+(defconstant nfdbits 32)
+  
 (def-alien-type nil
   (struct fd-set
-	  (fds-bits (array fd-mask #.(/ fd-setsize 32)))))
+	  (fds-bits (array fd-mask #.(/ fd-setsize nfdbits)))))
 
 (def-alien-type key-t int)
 
@@ -465,36 +467,72 @@
 (defconstant o_wronly  1 "Write-only flag.")
 (defconstant o_rdwr    2 "Read-write flag.")
 (defconstant o_accmode 3 "Access mode mask.")
-(defconstant o_creat   #o100 "Create if nonexistant flag. (not fcntl)") 
-(defconstant o_excl    #o200 "Error if already exists. (not fcntl)")
-(defconstant o_noctty  #o400 "Don't assign controlling tty. (not fcntl)")
-(defconstant o_trunc   #o1000 "Truncate flag. (not fcntl)")
-(defconstant o_append  #o2000 "Append flag.")
-(defconstant o_ndelay  #o4000 "Non-blocking I/O")
-(defconstant o_nonblock #o4000 "Non-blocking I/O")
-(defconstant o_ndelay  o_nonblock)
-(defconstant o_sync    #o10000 "Synchronous writes (on ext2)")
-(defconstant o_fsync    o_sync)
-(defconstant o_async   #o20000 "Asynchronous I/O")
+
+#-alpha
+(progn
+  (defconstant o_creat   #o100 "Create if nonexistant flag. (not fcntl)") 
+  (defconstant o_excl    #o200 "Error if already exists. (not fcntl)")
+  (defconstant o_noctty  #o400 "Don't assign controlling tty. (not fcntl)")
+  (defconstant o_trunc   #o1000 "Truncate flag. (not fcntl)")
+  (defconstant o_append  #o2000 "Append flag.")
+  (defconstant o_ndelay  #o4000 "Non-blocking I/O")
+  (defconstant o_nonblock #o4000 "Non-blocking I/O")
+  (defconstant o_ndelay  o_nonblock)
+  (defconstant o_sync    #o10000 "Synchronous writes (on ext2)")
+  (defconstant o_fsync    o_sync)
+  (defconstant o_async   #o20000 "Asynchronous I/O"))
+#+alpha
+(progn
+  (defconstant o_creat   #o1000 "Create if nonexistant flag. (not fcntl)") 
+  (defconstant o_trunc   #o2000 "Truncate flag. (not fcntl)")
+  (defconstant o_excl    #o4000 "Error if already exists. (not fcntl)")
+  (defconstant o_noctty  #o10000 "Don't assign controlling tty. (not fcntl)")
+  (defconstant o_nonblock #o4 "Non-blocking I/O")
+  (defconstant o_append  #o10 "Append flag.")
+  (defconstant o_ndelay  o_nonblock)
+  (defconstant o_sync    #o40000 "Synchronous writes (on ext2)")
+  (defconstant o_fsync    o_sync)
+  (defconstant o_async   #o20000 "Asynchronous I/O"))
 
 (defconstant f-dupfd    0  "Duplicate a file descriptor")
 (defconstant f-getfd    1  "Get file desc. flags")
 (defconstant f-setfd    2  "Set file desc. flags")
 (defconstant f-getfl    3  "Get file flags")
 (defconstant f-setfl    4  "Set file flags")
-(defconstant f-getlk    5   "Get lock")
-(defconstant f-setlk    6   "Set lock")
-(defconstant f-setlkw   7   "Set lock, wait for release")
-(defconstant f-setown   8  "Set owner (for sockets)")
-(defconstant f-getown   9  "Get owner (for sockets)")
+
+#-alpha
+(progn
+  (defconstant f-getlk    5   "Get lock")
+  (defconstant f-setlk    6   "Set lock")
+  (defconstant f-setlkw   7   "Set lock, wait for release")
+  (defconstant f-setown   8  "Set owner (for sockets)")
+  (defconstant f-getown   9  "Get owner (for sockets)"))
+#+alpha
+(progn
+  (defconstant f-getlk    7   "Get lock")
+  (defconstant f-setlk    8   "Set lock")
+  (defconstant f-setlkw   9   "Set lock, wait for release")
+  (defconstant f-setown   5  "Set owner (for sockets)")
+  (defconstant f-getown   6  "Get owner (for sockets)"))
+
+
 
 (defconstant F-CLOEXEC 1 "for f-getfl and f-setfl")
 
-(defconstant F-RDLCK 0 "for fcntl and lockf")
-(defconstant F-WDLCK 1 "for fcntl and lockf")
-(defconstant F-UNLCK 2 "for fcntl and lockf")
-(defconstant F-EXLCK 4 "old bsd flock (depricated)")
-(defconstant F-SHLCK 8 "old bsd flock (depricated)")
+#-alpha
+(progn
+  (defconstant F-RDLCK 0 "for fcntl and lockf")
+  (defconstant F-WDLCK 1 "for fcntl and lockf")
+  (defconstant F-UNLCK 2 "for fcntl and lockf")
+  (defconstant F-EXLCK 4 "old bsd flock (depricated)")
+  (defconstant F-SHLCK 8 "old bsd flock (depricated)"))
+#+alpha
+(progn
+  (defconstant F-RDLCK 1 "for fcntl and lockf")
+  (defconstant F-WDLCK 2 "for fcntl and lockf")
+  (defconstant F-UNLCK 8 "for fcntl and lockf")
+  (defconstant F-EXLCK 16 "old bsd flock (depricated)")
+  (defconstant F-SHLCK 32 "old bsd flock (depricated)"))
 
 (defconstant F-LOCK-SH 1 "Shared lock for bsd flock")
 (defconstant F-LOCK-EX 2 "Exclusive lock for bsd flock")
@@ -1370,25 +1408,30 @@ length LEN and type TYPE."
 (def-alien-type nil
   (struct stat
     (st-dev dev-t)
-    (st-pad1 unsigned-short)
+    #-alpha (st-pad1 unsigned-short)
     (st-ino ino-t)
     (st-mode mode-t)
     (st-nlink  nlink-t)
     (st-uid  uid-t)
     (st-gid  gid-t)
     (st-rdev dev-t)
-    (st-pad2  unsigned-short)
+    #-alpha (st-pad2  unsigned-short)
+    #+alpha (st-pad2  unsigned-int)
     (st-size off-t)
-    (st-blksize unsigned-long)
-    (st-blocks unsigned-long)
+    #-alpha (st-blksize unsigned-long)
+    #-alpha (st-blocks unsigned-long)
     (st-atime time-t)
-    (unused-1 unsigned-long)
+    #-alpha (unused-1 unsigned-long)
     (st-mtime time-t)
-    (unused-2 unsigned-long)
+    #-alpha (unused-2 unsigned-long)
     (st-ctime time-t)
-    (unused-3 unsigned-long)
-    (unused-4 unsigned-long)
-    (unused-5 unsigned-long)))
+    #+alpha (st-blksize unsigned-int)
+    #+alpha (st-blocks int)
+    #+alpha (st-flags unsigned-int)
+    #+alpha (st-gen unsigned-int)
+    #-alpha (unused-3 unsigned-long)
+    #-alpha (unused-4 unsigned-long)
+    #-alpha (unused-5 unsigned-long)))
 
 ;; Encoding of the file mode.
 
@@ -1424,7 +1467,7 @@ length LEN and type TYPE."
 	    (f-bsize int)
 	    (f-blocks int)
 	    (f-bfree int)
-	    (f-babail int)
+	    (f-bavail int)
 	    (f-files int)
 	    (f-ffree int)
 	    (f-fsid fsid-t)
@@ -1621,8 +1664,8 @@ length LEN and type TYPE."
 ;; microsecond but also has a range of years.  
 (def-alien-type nil
   (struct timeval
-	  (tv-sec time-t)		; seconds
-	  (tv-usec time-t)))		; and microseconds
+	  (tv-sec #-alpha time-t #+alpha int)		; seconds
+	  (tv-usec #-alpha time-t #+alpha int)))	; and microseconds
 
 ;;; unistd.h
 
@@ -2505,19 +2548,19 @@ in at a time in poll.")
   `(if (fixnump ,num)
        (progn
 	 (setf (deref (slot ,fdset 'fds-bits) 0) ,num)
-	 ,@(loop for index upfrom 1 below (/ fd-setsize 32)
+	 ,@(loop for index upfrom 1 below (/ fd-setsize nfdbits)
 	     collect `(setf (deref (slot ,fdset 'fds-bits) ,index) 0)))
        (progn
-	 ,@(loop for index upfrom 0 below (/ fd-setsize 32)
+	 ,@(loop for index upfrom 0 below (/ fd-setsize nfdbits)
 	     collect `(setf (deref (slot ,fdset 'fds-bits) ,index)
-			    (ldb (byte 32 ,(* index 32)) ,num))))))
+			    (ldb (byte nfdbits ,(* index nfdbits)) ,num))))))
 
 (defmacro fd-set-to-num (nfds fdset)
-  `(if (<= ,nfds 32)
+  `(if (<= ,nfds nfdbits)
        (deref (slot ,fdset 'fds-bits) 0)
-       (+ ,@(loop for index upfrom 0 below (/ fd-setsize 32)
+       (+ ,@(loop for index upfrom 0 below (/ fd-setsize nfdbits)
 	      collect `(ash (deref (slot ,fdset 'fds-bits) ,index)
-			    ,(* index 32))))))
+			    ,(* index nfdbits))))))
 
 (defun unix-select (nfds rdfds wrfds xpfds to-secs &optional (to-usecs 0))
   "Unix-select examines the sets of descriptors passed as arguments
@@ -2555,9 +2598,9 @@ in at a time in poll.")
 
 (defmacro extract-stat-results (buf)
   `(values T
-           #+nil
+           #+alpha
 	   (slot ,buf 'st-dev)
-           #-nil
+           #-alpha
            (+ (deref (slot ,buf 'st-dev) 0)
 	      (* (+ +max-u-long+  1)
 	         (deref (slot ,buf 'st-dev) 1)))   ;;; let's hope this works..
@@ -2566,9 +2609,9 @@ in at a time in poll.")
 	   (slot ,buf 'st-nlink)
 	   (slot ,buf 'st-uid)
 	   (slot ,buf 'st-gid)
-           #+nil
+           #+alpha
 	   (slot ,buf 'st-rdev)
-           #-nil
+           #-alpha
            (+ (deref (slot ,buf 'st-rdev) 0)
 	      (* (+ +max-u-long+  1)
 	         (deref (slot ,buf 'st-rdev) 1)))   ;;; let's hope this works..
@@ -3403,7 +3446,7 @@ in at a time in poll.")
 (defmacro fd-set (offset fd-set)
   (let ((word (gensym))
 	(bit (gensym)))
-    `(multiple-value-bind (,word ,bit) (floor ,offset 32)
+    `(multiple-value-bind (,word ,bit) (floor ,offset nfdbits)
        (setf (deref (slot ,fd-set 'fds-bits) ,word)
 	     (logior (truly-the (unsigned-byte 32) (ash 1 ,bit))
 		     (deref (slot ,fd-set 'fds-bits) ,word))))))
@@ -3412,7 +3455,7 @@ in at a time in poll.")
 (defmacro fd-clr (offset fd-set)
   (let ((word (gensym))
 	(bit (gensym)))
-    `(multiple-value-bind (,word ,bit) (floor ,offset 32)
+    `(multiple-value-bind (,word ,bit) (floor ,offset nfdbits)
        (setf (deref (slot ,fd-set 'fds-bits) ,word)
 	     (logand (deref (slot ,fd-set 'fds-bits) ,word)
 		     (32bit-logical-not
@@ -3422,13 +3465,13 @@ in at a time in poll.")
 (defmacro fd-isset (offset fd-set)
   (let ((word (gensym))
 	(bit (gensym)))
-    `(multiple-value-bind (,word ,bit) (floor ,offset 32)
+    `(multiple-value-bind (,word ,bit) (floor ,offset nfdbits)
        (logbitp ,bit (deref (slot ,fd-set 'fds-bits) ,word)))))
 
 ;; not checked for linux...
 (defmacro fd-zero (fd-set)
   `(progn
-     ,@(loop for index upfrom 0 below (/ fd-setsize 32)
+     ,@(loop for index upfrom 0 below (/ fd-setsize nfdbits)
 	 collect `(setf (deref (slot ,fd-set 'fds-bits) ,index) 0))))
 
 
diff --git a/compiler/alpha/parms.lisp b/compiler/alpha/parms.lisp
index 929b29ee62919ca5be1be6526289468d78aeb00f..d474cee0487f4021fe1c0f298c38bfccf633c4b3 100644
--- a/compiler/alpha/parms.lisp
+++ b/compiler/alpha/parms.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/alpha/parms.lisp,v 1.4 1998/02/12 17:12:07 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/alpha/parms.lisp,v 1.5 1999/02/20 15:54:41 pw Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -134,9 +134,13 @@
 
 ;;; Where to put the different spaces.
 ;;; 
-(defparameter target-read-only-space-start #x20000000)
-(defparameter target-static-space-start    #x28000000)
-(defparameter target-dynamic-space-start   #x30000000)
+#-linux (defparameter target-read-only-space-start #x20000000)
+#-linux (defparameter target-static-space-start    #x28000000)
+#-linux (defparameter target-dynamic-space-start   #x30000000)
+
+#+linux (defparameter target-read-only-space-start #x10000000)
+#+linux (defparameter target-static-space-start    #x28000000)
+#+linux (defparameter target-dynamic-space-start   #x30000000)
 
 ;; The space-register holding the lisp heap.
 (defconstant lisp-heap-space 4)
diff --git a/lisp/Linux-os.c b/lisp/Linux-os.c
index 71ad1757e4d8a773d40a044a6f111a2990e9b673..5135dea2885d9a2102f2e9d7a429a6aa48b3d66d 100644
--- a/lisp/Linux-os.c
+++ b/lisp/Linux-os.c
@@ -1,6 +1,6 @@
 /*
  * Linux-os.c. 
- * Form FreeBSD-os.c
+ * From FreeBSD-os.c
  * From osf1-os.c,v 1.1 94/03/27 15:30:51 hallgren Exp $
  *
  * OS-dependent routines.  This file (along with os.h) exports an
@@ -14,7 +14,7 @@
  * Morfed from the FreeBSD file by Peter Van Eynde (July 1996)
  * GENCGC support by Douglas Crosher, 1996, 1997.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.5 1999/02/02 10:58:24 dtc Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.c,v 1.6 1999/02/20 15:54:42 pw Exp $
  *
  */
 
@@ -38,8 +38,11 @@
 #include <sys/time.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <sys/resource.h>
+#include <sys/wait.h>
+#include <netdb.h>
 
-#include "x86-validate.h"
+#include "validate.h"
 size_t os_vm_page_size;
 
 #define DPRINTF(t,a) {if(t)fprintf a;}
@@ -97,9 +100,12 @@ os_init(void)
 #else
   os_vm_page_size=getpagesize();
 #endif
+#ifdef i386
   setfpucw(0x1372|4|8|16|32); /*no interrupts */
+#endif
 }
 
+#ifndef __alpha__
 int
 #if (LINUX_VERSION_CODE >= linuxversion(2,1,0)) || (__GNU_LIBRARY__ >= 6)
 sc_reg(struct sigcontext *c, int offset)
@@ -120,6 +126,7 @@ sc_reg(struct sigcontext_struct *c, int offset)
     }
   return 0;
 }
+#endif
 
 void
 os_save_context(void)
@@ -154,7 +161,8 @@ os_vm_address_t
 os_validate(os_vm_address_t addr, os_vm_size_t len)
 {
   int flags = MAP_PRIVATE|MAP_ANONYMOUS;
-  int oa=addr,olen=len;
+  os_vm_address_t oa = addr;
+  os_vm_size_t olen = len;
 
   if(addr) flags|=MAP_FIXED;
   else flags|=MAP_VARIABLE;
@@ -252,7 +260,7 @@ void sigsegv_handler(HANDLER_ARGS)
   GET_CONTEXT
 
   int  fault_addr = ((struct sigcontext_struct *)(&contextstruct))->cr2;
-  int  page_index = find_page_index(fault_addr);
+  int  page_index = find_page_index((void *)fault_addr);
 
   /*signal(sig,sigsegv_handler);  /* Re-install; necessary? */
 
@@ -276,20 +284,49 @@ void sigsegv_handler(HANDLER_ARGS)
 static void
 sigsegv_handler(HANDLER_ARGS)
 {
+  os_vm_address_t addr;
+
+#ifdef i386
   GET_CONTEXT
+#endif
 
-  DPRINTF(1,(stderr,"sigsegv\n"));
+  DPRINTF(0,(stderr,"sigsegv\n"));
+#ifdef i386
   interrupt_handle_now(signal,contextstruct);
+#else
+#define CONTROL_STACK_TOP (((char*)CONTROL_STACK_START)+CONTROL_STACK_SIZE)
+
+  addr = arch_get_bad_addr(signal,code,context);
+
+  if(addr != NULL && context->sc_regs[reg_ALLOC] & (1<<63)) {
+    context->sc_regs[reg_ALLOC] -= (1<<63);
+    interrupt_handle_pending(context);
+  } else if (addr > CONTROL_STACK_TOP && addr < BINDING_STACK_START) {
+    fprintf(stderr, "Possible stack overflow at 0x%08lX!\n", addr);
+    /* try to fix control frame pointer */
+    while ( ! (CONTROL_STACK_START <= *current_control_frame_pointer &&
+	       *current_control_frame_pointer <= CONTROL_STACK_TOP))
+      ((char*)current_control_frame_pointer) -= sizeof(lispobj);
+    ldb_monitor();
+  } else if (!interrupt_maybe_gc(signal, code, context))
+    interrupt_handle_now(signal, code, context);
+#endif
 }
 #endif
 
 static void
 sigbus_handler(HANDLER_ARGS)
 {
+#ifdef i386
   GET_CONTEXT
+#endif
 
   DPRINTF(1,(stderr,"sigbus:\n")); /* there is no sigbus in linux??? */
+#ifdef i386
   interrupt_handle_now(signal,contextstruct);
+#else
+  interrupt_handle_now(signal,code,context);
+#endif  
 }
 
 void 
diff --git a/lisp/Linux-os.h b/lisp/Linux-os.h
index c067461e5f44792c344f0747e0e4a1763dd8223f..d14837dca236ec6726e437cdac8efa02e587997d 100644
--- a/lisp/Linux-os.h
+++ b/lisp/Linux-os.h
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.h,v 1.7 1999/02/02 10:58:24 dtc Exp $
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Linux-os.h,v 1.8 1999/02/20 15:54:42 pw Exp $
 
  This code was written as part of the CMU Common Lisp project at
  Carnegie Mellon University, and has been placed in the public domain.
@@ -32,8 +32,12 @@ typedef int os_vm_prot_t;        /* like hpux */
 #define OS_VM_PROT_READ PROT_READ    /* like hpux */
 #define OS_VM_PROT_WRITE PROT_WRITE  /* like hpux */
 #define OS_VM_PROT_EXECUTE PROT_EXEC /* like hpux */
-     
+
+#ifndef __alpha__     
 #define OS_VM_DEFAULT_PAGESIZE	4096 /* like hpux */ 
+#else
+#define OS_VM_DEFAULT_PAGESIZE	8192 /* like hpux */ 
+#endif
 
 #if (LINUX_VERSION_CODE >= linuxversion(2,1,0)) || (__GNU_LIBRARY__ >= 6)
 int sc_reg(struct sigcontext *,int);
@@ -52,6 +56,12 @@ typedef struct sigcontext_struct sigcontext;
 
 #define POSIX_SIGS
 
+/* Alpha uses OSF/1 signals which are the defaults in os.h,
+   so there is no need to define the following for Alpha 
+   Linux 
+*/
+#ifndef __alpha__ 
+
 #if (LINUX_VERSION_CODE >= linuxversion(2,1,0)) || (__GNU_LIBRARY__ >= 6)
 #define HANDLER_ARGS int signal, struct sigcontext contextstruct
 #define GET_CONTEXT int code=0; struct sigcontext *context=&contextstruct;
@@ -60,7 +70,13 @@ typedef struct sigcontext_struct sigcontext;
 #define GET_CONTEXT int code=0; struct sigcontext_struct *context=&contextstruct;
 #endif
 
+#endif /* __alpha__ */
+
+#ifdef i386
 #define setfpucw(cw)	asm("fldcw %0" : : "m" (cw));
+#endif
+
+#if 0
 
 #define sigvec          sigaction
 #define sv_mask         sa_mask
@@ -90,3 +106,17 @@ typedef struct sigcontext_struct sigcontext;
 #define sc_ebp ebp
 #define sc_esi esi
 #define sc_edi edi
+
+#endif /* 0 */
+
+#ifdef alpha
+#define uc_sigmask	sc_mask
+#else
+#define uc_sigmask 	oldmask
+#define sc_pc		eip
+#define sc_mask		oldmask 
+#define sc_efl		eflags
+#define sc_sp		esp
+#endif
+#define sa_sigaction	sa_handler
+#define SA_SIGINFO	0
diff --git a/lisp/alpha-arch.c b/lisp/alpha-arch.c
index e777ae16710ebbfff1e32827e105bd2812a61367..be8af2fdfbcfb39b4aaf4a9919e42d9b1dc0a07c 100644
--- a/lisp/alpha-arch.c
+++ b/lisp/alpha-arch.c
@@ -1,6 +1,6 @@
 /*
 
- $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/alpha-arch.c,v 1.4 1998/05/22 00:47:30 pw Exp $
+ $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/alpha-arch.c,v 1.5 1999/02/20 15:54:43 pw Exp $
 
  This code was written as part of the CMU Common Lisp project at
  Carnegie Mellon University, and has been placed in the public domain.
@@ -8,6 +8,7 @@
 */
 
 #include <stdio.h>
+#include <string.h>
 
 #include "lisp.h"
 #include "globals.h"
@@ -75,11 +76,13 @@ boolean arch_pseudo_atomic_atomic(struct sigcontext *scp)
   return (scp->sc_regs[reg_ALLOC] & 1);
 }
 
-#define PSEUDO_ATOMIC_INTERRUPTED_BIAS 0x7f000000
-
 void arch_set_pseudo_atomic_interrupted(struct sigcontext *scp)
 {
+#ifdef __linux__
+  scp->sc_regs[reg_ALLOC] |= (1<<63);
+#else
   scp->sc_regs[reg_ALLOC] |= 2;
+#endif
 }
 
 unsigned long arch_install_breakpoint(void *pc)
@@ -102,7 +105,12 @@ void arch_remove_breakpoint(void *pc, unsigned long orig_inst)
 
 static unsigned int *skipped_break_addr, displaced_after_inst,
      after_breakpoint;
+
+#ifdef POSIX_SIGS
+static sigset_t orig_sigmask;
+#else
 static int orig_sigmask;
+#endif
 
 unsigned int
 emulate_branch(struct sigcontext *scp,unsigned long orig_inst)
@@ -183,8 +191,25 @@ void arch_do_displaced_inst(struct sigcontext *scp,
   unsigned int next_inst;
   int op = orig_inst >> 26;;
   
+#ifdef POSIX_SIGS
+#if !defined(__linux__) || (defined(__linux__) && (__GNU_LIBRARY__ < 6))
+  orig_sigmask = context->uc_sigmask;
+  FILLBLOCKSET(&context->uc_sigmask);
+#else
+  {
+    sigset_t temp;
+    sigemptyset(&temp);
+    orig_sigmask.__val[0] = scp->uc_sigmask;
+    temp.__val[0] = scp->uc_sigmask;
+    FILLBLOCKSET(&temp);
+    
+    scp->uc_sigmask = temp.__val[0];
+  }
+#endif
+#else
   orig_sigmask = scp->sc_mask;
   scp->sc_mask = BLOCKABLE;
+#endif
 
   /* Figure out where the displaced inst is going */
   if(op == 0x1a || op&0xf == 0x30) /* branch...ugh */
@@ -252,7 +277,15 @@ static void sigtrap_handler(int signal, int code, struct sigcontext *scp)
 	skipped_break_addr = NULL;
 	*(unsigned int *)scp->sc_pc = displaced_after_inst;
 	os_flush_icache((os_vm_address_t)scp->sc_pc, sizeof(unsigned long));
+#ifdef POSIX_SIGS
+#if  !defined(__linux__) || (defined(__linux__) && (__GNU_LIBRARY__ < 6))
+        scp->sc_mask = orig_sigmask;
+#else
+	scp->sc_mask = orig_sigmask.__val[0];
+#endif
+#else
 	scp->sc_mask = orig_sigmask;
+#endif
         after_breakpoint=NULL;
 	break;
 
diff --git a/lisp/alpha-assem.S b/lisp/alpha-assem.S
index 0417cadf4b5dfa9fa2dddd241d0d9bbf4b327a2f..dcd559665c65f99ca6b8a74f60a0835718887083 100644
--- a/lisp/alpha-assem.S
+++ b/lisp/alpha-assem.S
@@ -1,6 +1,12 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/alpha-assem.S,v 1.7 1998/03/10 20:39:49 dtc Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/alpha-assem.S,v 1.8 1999/02/20 15:54:43 pw Exp $ */
+#ifndef	__linux__
 #include <machine/regdef.h>
 #include <machine/pal.h>
+#else
+#include <asm/reg.h>
+#include <asm/pal.h>
+#include <alpha/regdef.h>
+#endif
 
 #include "internals.h"
 #include "lispregs.h"
@@ -54,7 +60,9 @@ call_into_lisp:
 	ldl	reg_OCFP,current_control_frame_pointer
 	mov	a1,reg_CFP
 
+#ifndef __linux__	
 	.set	noat
+#endif	
 	ldil	reg_L2,0
 	/* End of pseudo-atomic. */
 
diff --git a/lisp/alpha-lispregs.h b/lisp/alpha-lispregs.h
index e527b026c3fbe94bbbd22e66af13af12c96db408..11c9ffbcad94ea3b5d5858ae4a121fad3fb5a854 100644
--- a/lisp/alpha-lispregs.h
+++ b/lisp/alpha-lispregs.h
@@ -1,9 +1,15 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/alpha-lispregs.h,v 1.2 1997/06/18 17:01:22 pw Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/alpha-lispregs.h,v 1.3 1999/02/20 15:54:43 pw Exp $ */
 
 #define NREGS	(32)
 
 #ifdef LANGUAGE_ASSEMBLY
+#ifdef __linux__
+#define R(s) $ ## s
+#define REG(num) $##num
+#else
+#define R(s) s
 #define REG(num) $/**/num
+#endif
 #else
 #define REG(num) num
 #endif
diff --git a/lisp/alpha-validate.h b/lisp/alpha-validate.h
index 58d6e305c5009d74eb2b9eb7dcf6e0369252852e..6968549d05bef27c0232d12db1daabf460f5a753 100644
--- a/lisp/alpha-validate.h
+++ b/lisp/alpha-validate.h
@@ -1,12 +1,13 @@
 /*
 
- $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/alpha-validate.h,v 1.2 1994/10/27 17:13:54 ram Exp $
+ $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/alpha-validate.h,v 1.3 1999/02/20 15:54:43 pw Exp $
 
  This code was written as part of the CMU Common Lisp project at
  Carnegie Mellon University, and has been placed in the public domain.
 
 */
 
+#ifndef linux
 
 #define READ_ONLY_SPACE_START   (0x20000000)
 #define READ_ONLY_SPACE_SIZE    (0x04000000)
@@ -23,3 +24,23 @@
 
 #define BINDING_STACK_START	(0x70000000)
 #define BINDING_STACK_SIZE	(0x00100000)
+
+#else
+
+#define READ_ONLY_SPACE_START   (0x10000000)
+#define READ_ONLY_SPACE_SIZE    (0x15000000)
+
+#define STATIC_SPACE_START	(0x28000000)
+#define STATIC_SPACE_SIZE	(0x04000000)
+
+#define DYNAMIC_0_SPACE_START	(0x30000000)
+#define DYNAMIC_1_SPACE_START	(0x40000000)
+#define DYNAMIC_SPACE_SIZE	(0x0F000000)
+
+#define CONTROL_STACK_START	(0x50000000)
+#define CONTROL_STACK_SIZE	(0x01000000)
+
+#define BINDING_STACK_START	(0x70000000)
+#define BINDING_STACK_SIZE	(0x01000000)
+
+#endif
diff --git a/lisp/interrupt.c b/lisp/interrupt.c
index a53d99b12f87b0ed8d091e2772336921dd0d4d45..7b9a42bd1b418e745549a05ad19414c3c05a6249 100644
--- a/lisp/interrupt.c
+++ b/lisp/interrupt.c
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.16 1999/02/02 10:58:25 dtc Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.17 1999/02/20 15:54:43 pw Exp $ */
 
 /* Interrupt handing magic. */
 
@@ -164,7 +164,7 @@ void
 interrupt_internal_error(HANDLER_ARGS, boolean continuable)
 {
     lispobj context_sap;
-#ifdef __linux__
+#if ( defined( __linux__ ) && defined( i386 ) )
     GET_CONTEXT
 #endif
 
@@ -242,7 +242,7 @@ interrupt_handle_pending(struct sigcontext *context)
 	code = pending_code;
 	pending_signal = 0;
 	/* pending_code = 0; */
-#ifdef __linux__
+#if ( defined( __linux__ ) && defined( i386 ) )
         interrupt_handle_now(signal,*context);
 #else
 	interrupt_handle_now(signal, PASSCODE(code), context);
@@ -259,20 +259,22 @@ interrupt_handle_pending(struct sigcontext *context)
 void 
 interrupt_handle_now(HANDLER_ARGS)
 {
-#ifdef __linux__
+#if ( defined( __linux__ ) && defined( i386 ) )
   GET_CONTEXT
 #endif
 
     int were_in_lisp;
     union interrupt_handler handler;
 
+#ifndef __alpha__
 #ifdef __linux__
     setfpucw(contextstruct.fpstate->cw);
 #endif
-    
+#endif
+
     handler = interrupt_handlers[signal];
 
-    if(handler.c==SIG_IGN)
+    if(handler.c== (void (*)(HANDLER_ARGS)) SIG_IGN)
 	return;
 
     SAVE_CONTEXT(); /**/
@@ -283,7 +285,7 @@ interrupt_handle_now(HANDLER_ARGS)
 #endif
         fake_foreign_function_call(context);
     
-    if (handler.c==SIG_DFL)
+    if (handler.c== (void (*)(HANDLER_ARGS)) SIG_DFL)
 	/* This can happen if someone tries to ignore or default on of the */
 	/* signals we need for runtime support, and the runtime support */
 	/* decides to pass on it.  */
@@ -302,7 +304,7 @@ interrupt_handle_now(HANDLER_ARGS)
 	  sigset_t temp;
 	  sigemptyset(&temp);
 	  temp.__val[0] = &context->uc_sigmask;
-	  sigprocmask(SIG_SETMASK, &context->uc_sigmask, 0);
+	  sigprocmask(SIG_SETMASK, &temp, 0);
 	}
 #endif
 #else
@@ -326,14 +328,14 @@ interrupt_handle_now(HANDLER_ARGS)
 	  sigset_t temp;
 	  sigemptyset(&temp);
 	  temp.__val[0] = &context->uc_sigmask;
-	  sigprocmask(SIG_SETMASK, &context->uc_sigmask, 0);
+	  sigprocmask(SIG_SETMASK, &temp, 0);
 	}
 #endif
 #else
         sigsetmask(context->sc_mask);
 #endif
       
-#ifdef __linux__
+#if ( defined( __linux__ ) && defined( i386 ) )
         (*handler.c)(signal, contextstruct);
 #else
         (*handler.c)(signal, code, context);
@@ -349,14 +351,16 @@ interrupt_handle_now(HANDLER_ARGS)
 static void 
 maybe_now_maybe_later(HANDLER_ARGS)
 {
-#ifdef __linux__
+#if ( defined( __linux__ ) && defined( i386 ) )
   GET_CONTEXT
 #endif
 
     SAVE_CONTEXT(); /**/
 
+#ifndef __alpha
 #ifdef __linux__
     setfpucw(contextstruct.fpstate->cw);
+#endif
 #endif
 
     if (SymbolValue(INTERRUPTS_ENABLED) == NIL) {
@@ -410,7 +414,7 @@ maybe_now_maybe_later(HANDLER_ARGS)
 #endif
 	arch_set_pseudo_atomic_interrupted(context);
     } else
-#ifdef __linux__
+#if ( defined( __linux__ ) && defined( i386 ) )
         interrupt_handle_now(signal,contextstruct);
 #else
         interrupt_handle_now(signal, code, context);
@@ -451,8 +455,20 @@ boolean interrupt_maybe_gc(HANDLER_ARGS)
 	    maybe_gc_pending = TRUE;
 	    if (pending_signal == 0) {
 #ifdef POSIX_SIGS
-		pending_mask = context->uc_sigmask;
+#if !defined(__linux__) || (defined(__linux__) && (__GNU_LIBRARY__ < 6))
+	        pending_mask = context->uc_sigmask;
 		FILLBLOCKSET(&context->uc_sigmask);
+#else
+		{
+		  sigset_t temp;
+		  sigemptyset(&temp);
+		  pending_mask.__val[0] = context->uc_sigmask;
+		  temp.__val[0] = context->uc_sigmask;
+		  FILLBLOCKSET(&temp);
+		  
+		  context->uc_sigmask = temp.__val[0];
+		}
+#endif
 #else
 		pending_mask = context->sc_mask;
 		context->sc_mask |= BLOCKABLE;
@@ -483,7 +499,7 @@ void interrupt_install_low_level_handler
 #ifdef POSIX_SIGS
     struct sigaction sa;
 
-    sa.sa_sigaction=handler;
+    sa.sa_sigaction=(__sighandler_t) handler;
     sigemptyset(&sa.sa_mask);
     FILLBLOCKSET(&sa.sa_mask);
     sa.sa_flags = SA_RESTART | SA_SIGINFO;
@@ -519,7 +535,7 @@ void interrupt_install_low_level_handler
     sigvec(signal,&sv,NULL);
 #endif
 #endif    
-    interrupt_low_level_handlers[signal]=(handler==SIG_DFL ? 0 : handler);
+    interrupt_low_level_handlers[signal]=((__sighandler_t) handler==SIG_DFL ? 0 : handler);
 }
 
 unsigned long install_handler(int signal,
@@ -538,12 +554,12 @@ unsigned long install_handler(int signal,
     FILLBLOCKSET(&new);
 
     if(interrupt_low_level_handlers[signal]==0){
-	if(handler==SIG_DFL || handler==SIG_IGN)
-	    sa.sa_sigaction = handler;
+	if((__sighandler_t) handler==SIG_DFL || (__sighandler_t) handler==SIG_IGN)
+	    sa.sa_sigaction = (__sighandler_t) handler;
 	else if (sigismember(&new, signal))
-	    sa.sa_sigaction = maybe_now_maybe_later;
+	    sa.sa_sigaction = (__sighandler_t) maybe_now_maybe_later;
 	else
-	    sa.sa_sigaction = interrupt_handle_now;
+	    sa.sa_sigaction = (__sighandler_t) interrupt_handle_now;
 
 	sigemptyset(&sa.sa_mask);
 	FILLBLOCKSET(&sa.sa_mask);
diff --git a/lisp/lisp.c b/lisp/lisp.c
index 0cdc978b5fc7c791847ccf35eba6db73549aa2f9..62c22dea021cadf07c9f7aaee8a44e4638a15779 100644
--- a/lisp/lisp.c
+++ b/lisp/lisp.c
@@ -1,7 +1,7 @@
 /*
  * main() entry point for a stand alone lisp image.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.14 1997/11/21 12:23:44 dtc Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.15 1999/02/20 15:54:44 pw Exp $
  *
  */
 
@@ -42,7 +42,7 @@
 
 static void sigint_handler(HANDLER_ARGS)
 {
-#ifdef __linux__
+#if ( defined( __linux__ ) && defined( i386 ) )
   GET_CONTEXT
 #endif
 
diff --git a/lisp/lisp.h b/lisp/lisp.h
index 1b78b1eeb964ee3d2abba2bf803f56f875d95bdc..9be58bd4dcd1cdf9b4dc703963d7428276114a46 100644
--- a/lisp/lisp.h
+++ b/lisp/lisp.h
@@ -1,8 +1,20 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.h,v 1.4 1997/08/23 16:00:21 pw Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.h,v 1.5 1999/02/20 15:54:44 pw Exp $ */
 
 #ifndef _LISP_H_
 #define _LISP_H_
 
+/* sigh */
+#ifdef __alpha__
+#ifndef alpha
+#define alpha
+#endif
+#endif
+#ifdef alpha
+#ifndef __alpha__
+#define __alpha__
+#endif
+#endif
+
 #define lowtag_Bits 3
 #define lowtag_Mask ((1<<lowtag_Bits)-1)
 #define LowtagOf(obj) ((obj)&lowtag_Mask)
diff --git a/lisp/monitor.c b/lisp/monitor.c
index a9eef5ea7c1750e9d749559adf4655591c0d8042..3d569448c3c29c251ec846368b64bfb06e0fe7aa 100644
--- a/lisp/monitor.c
+++ b/lisp/monitor.c
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/monitor.c,v 1.9 1998/12/20 04:19:33 dtc Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/monitor.c,v 1.10 1999/02/20 15:54:44 pw Exp $ */
 
 #include <stdio.h>
 #include <sys/types.h>
@@ -413,7 +413,7 @@ static void catchers_cmd(char **ptr)
 		   catch->entry_pc);
 #endif
             brief_print((lispobj)catch->tag);
-            catch = catch->previous_catch;
+            catch = (struct catch_block *) catch->previous_catch;
         }
     }
 }
diff --git a/lisp/print.c b/lisp/print.c
index b98553c326ea68780aebcd39a2536dd603049821..efd80a14a55af3558224a0d877de7eb42170a209 100644
--- a/lisp/print.c
+++ b/lisp/print.c
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/print.c,v 1.10 1998/12/20 04:19:32 dtc Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/print.c,v 1.11 1999/02/20 15:54:45 pw Exp $ */
 #include <stdio.h>
 
 #include "print.h"
@@ -412,8 +412,13 @@ static void print_otherptr(lispobj obj)
         int count, type, index;
         char *cptr, buffer[16];
 
+#ifndef alpha
 	ptr = (unsigned long *) PTR(obj);
 	if (ptr == (unsigned long *) NULL) {
+#else
+	ptr = (u32 *) PTR(obj);
+	if (ptr == (u32 *) NULL) {
+#endif
 		printf(" (NULL Pointer)");
 		return;
 	}
diff --git a/lisp/undefineds.h b/lisp/undefineds.h
index 0ae4e6c0f59b77db693870ddcc8ef66ddf452ae3..9dc2a5517692bd6e2b063ac5ed2123d6a6733cf2 100644
--- a/lisp/undefineds.h
+++ b/lisp/undefineds.h
@@ -1,5 +1,5 @@
 /* Routines that must be linked into the core for lisp to work. */
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/undefineds.h,v 1.22 1998/09/13 12:15:37 dtc Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/undefineds.h,v 1.23 1999/02/20 15:54:45 pw Exp $ */
 
 /* Pick up all the syscalls. */
 F(accept)
@@ -116,7 +116,7 @@ F(setpgrp)
 #if !defined(SVR4) ||  defined(SOLARIS25)
 F(setpriority)
 #endif
-#if !defined(mach) && !defined(SOLARIS) && !defined(__FreeBSD__) && !defined(SUNOS) && !defined(osf1) && !defined(irix) && !defined(hpux)
+#if !defined(mach) && !defined(SOLARIS) && !defined(__FreeBSD__) && !defined(SUNOS) && !defined(osf1) && !defined(irix) && !defined(hpux) && !(defined(linux) && defined(alpha))
 F(setquota)
 #endif
 #if !defined(hpux) && !defined(SVR4) ||  defined(SOLARIS25)
@@ -244,3 +244,13 @@ F(ttyname)
 #ifdef irix
 F(_getpty)
 #endif
+
+#if ( defined(alpha) && defined(linux) )
+F(dlopen)
+F(dlsym)
+F(dlclose)
+F(dlerror)
+F(cfgetospeed)
+F(cfgetispeed)
+F(cfsetispeed)
+#endif