From da1584f1d464c54a6cfcd6f1fecd31f3f8917889 Mon Sep 17 00:00:00 2001 From: toy <toy> Date: Tue, 19 Nov 2002 13:17:15 +0000 Subject: [PATCH] Alpha Linux support from Brian. --- code/alpha-vm.lisp | 22 +++++++++++-- code/unix-glibc2.lisp | 52 ++++++++++++++++++------------- compiler/generic/new-genesis.lisp | 8 +++-- lisp/Config.alpha_linux | 12 +++---- lisp/linux-nm | 2 +- lisp/linux-stubs.S | 19 +++++++++-- lisp/undefineds.h | 10 +++++- 7 files changed, 88 insertions(+), 37 deletions(-) diff --git a/code/alpha-vm.lisp b/code/alpha-vm.lisp index 6c6fff63d..be2ea189c 100644 --- a/code/alpha-vm.lisp +++ b/code/alpha-vm.lisp @@ -5,11 +5,11 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/alpha-vm.lisp,v 1.2 1994/10/31 04:11:27 ram Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/alpha-vm.lisp,v 1.3 2002/11/19 13:17:13 toy Exp $") ;;; ;;; ********************************************************************** ;;; -;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/alpha-vm.lisp,v 1.2 1994/10/31 04:11:27 ram Exp $ +;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/alpha-vm.lisp,v 1.3 2002/11/19 13:17:13 toy Exp $ ;;; ;;; This file contains the Alpha specific runtime stuff. ;;; @@ -210,6 +210,24 @@ (declare (type simple-base-string name)) name) +#+(and (or linux (and freebsd elf)) (not linkage-table)) +(defun lisp::foreign-symbol-address-aux (name flavor) + (declare (ignore flavor)) + (multiple-value-bind (value found) + (gethash name lisp::*foreign-symbols* 0) + (if found + value + (multiple-value-bind (value found) + (gethash + (concatenate 'string "PVE_stub_" name) + lisp::*foreign-symbols* 0) + (if found + value + (let ((value (system:alternate-get-global-address name))) + (when (zerop value) + (error "Unknown foreign symbol: ~S" name)) + value)))))) + ;;; SANCTIFY-FOR-EXECUTION -- Interface. diff --git a/code/unix-glibc2.lisp b/code/unix-glibc2.lisp index fc25aa45e..24986230b 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.17 2002/11/15 15:08:12 toy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/unix-glibc2.lisp,v 1.18 2002/11/19 13:17:14 toy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -294,9 +294,9 @@ (defconstant +max-s-long+ 2147483647) (defconstant +max-u-long+ 4294967295) -(def-alien-type quad-t #+nil long-long #-nil (array long 2)) -(def-alien-type uquad-t #+nil unsigned-long-long - #-nil (array unsigned-long 2)) +(def-alien-type quad-t #+alpha long #-alpha (array long 2)) +(def-alien-type uquad-t #+alpha unsigned-long + #-alpha (array unsigned-long 2)) (def-alien-type qaddr-t (* quad-t)) (def-alien-type daddr-t int) (def-alien-type caddr-t (* char)) @@ -313,21 +313,21 @@ (def-alien-type u-int16-t unsigned-short) (def-alien-type int32-t int) (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 int64-t #+alpha long #-alpha (array long 2)) +(def-alien-type u-int64-t #+alpha unsigned-long #-alpha (array unsigned-long 2)) (def-alien-type register-t #-alpha int #+alpha long) -(def-alien-type dev-t #-alpha uquad-t #+alpha unsigned-long) +(def-alien-type dev-t u-int64-t) (def-alien-type uid-t unsigned-int) (def-alien-type gid-t unsigned-int) -(def-alien-type ino-t #-alpha unsigned-long #+alpha unsigned-int) +(def-alien-type ino-t u-int32-t) (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 #-alpha int #+alpha long) +;(def-alien-type ssize-t #-alpha int #+alpha long) (def-alien-type fsid-t (array int 2)) @@ -1399,20 +1399,20 @@ length LEN and type TYPE." "Unlock password file." (void-syscall ("ulckpwdf"))) -;;; statbuf.h +;;; bits/stat.h (def-alien-type nil (struct stat (st-dev dev-t) #-alpha (st-pad1 unsigned-short) (st-ino ino-t) + #+alpha (st-pad1 unsigned-int) (st-mode mode-t) (st-nlink nlink-t) (st-uid uid-t) (st-gid gid-t) (st-rdev dev-t) #-alpha (st-pad2 unsigned-short) - #+alpha (st-pad2 unsigned-int) (st-size off-t) #-alpha (st-blksize unsigned-long) #-alpha (st-blocks unsigned-long) @@ -1421,12 +1421,16 @@ length LEN and type TYPE." (st-mtime time-t) #-alpha (unused-2 unsigned-long) (st-ctime time-t) - #+alpha (st-blksize unsigned-int) #+alpha (st-blocks int) + #+alpha (st-pad2 unsigned-int) + #+alpha (st-blksize unsigned-int) #+alpha (st-flags unsigned-int) #+alpha (st-gen unsigned-int) - #-alpha (unused-3 unsigned-long) - #-alpha (unused-4 unsigned-long) + #+alpha (st-pad3 unsigned-int) + #+alpha (unused-1 unsigned-long) + #+alpha (unused-2 unsigned-long) + (unused-3 unsigned-long) + (unused-4 unsigned-long) #-alpha (unused-5 unsigned-long))) ;; Encoding of the file mode. @@ -1660,8 +1664,8 @@ length LEN and type TYPE." ;; microsecond but also has a range of years. (def-alien-type nil (struct timeval - (tv-sec #-alpha time-t #+alpha int) ; seconds - (tv-usec #-alpha time-t #+alpha int))) ; and microseconds + (tv-sec time-t) ; seconds + (tv-usec time-t))) ; and microseconds ;;; unistd.h @@ -1845,11 +1849,17 @@ length LEN and type TYPE." "Put the absolute pathname of the current working directory in BUF. If successful, return BUF. If not, put an error message in BUF and return NULL. BUF should be at least PATH_MAX bytes long." - (with-alien ((buf (array char 1024))) - (values (not (zerop (alien-funcall (extern-alien "getwd" - (function int (* char))) - (cast buf (* char))))) - (cast buf c-string)))) + ;; 5120 is some randomly selected maximum size for the buffer for getcwd. + (with-alien ((buf (array c-call:char 5120))) + (let ((result (alien-funcall + (extern-alien "getcwd" + (function (* c-call:char) + (* c-call:char) c-call:int)) + (cast buf (* c-call:char)) + 5120))) + + (values (not (zerop (sap-int (alien-sap result)))) + (cast buf c-call:c-string))))) ;;; Unix-dup returns a duplicate copy of the existing file-descriptor diff --git a/compiler/generic/new-genesis.lisp b/compiler/generic/new-genesis.lisp index b3b77cb13..6147f4350 100644 --- a/compiler/generic/new-genesis.lisp +++ b/compiler/generic/new-genesis.lisp @@ -4,7 +4,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/generic/new-genesis.lisp,v 1.49 2002/10/24 20:38:58 toy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/generic/new-genesis.lisp,v 1.50 2002/11/19 13:17:14 toy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -1872,8 +1872,10 @@ (gethash name *cold-foreign-symbol-table* nil) #+linkage-table (cold-register-foreign-linkage name :code))) - (let ((linux-p (and (eq (c:backend-fasl-file-implementation c:*backend*) - #.c:x86-fasl-file-implementation) + (let ((linux-p (and (or (eq (c:backend-fasl-file-implementation c:*backend*) + #.c:x86-fasl-file-implementation) + (eq (c:backend-fasl-file-implementation c:*backend*) + #.c:alpha-fasl-file-implementation)) (c:backend-featurep :linux))) (bsd-p (and (eq (c:backend-fasl-file-implementation c:*backend*) #.c:x86-fasl-file-implementation) diff --git a/lisp/Config.alpha_linux b/lisp/Config.alpha_linux index 89b0e3aa1..1ecfb1ba7 100644 --- a/lisp/Config.alpha_linux +++ b/lisp/Config.alpha_linux @@ -1,16 +1,16 @@ -P1=/projects/cmucl/src/cvs-latest/src/lisp +P1=../../src/lisp CPPFLAGS = -I. -I/usr/include -I$(P1) -I- CC = gcc LD = ld CPP = cpp -CFLAGS = -g -Wstrict-prototypes -O2 -fno-strength-reduce -Dlinux -Dalpha -ASFLAGS = -g -O2 -Dlinux -Dalpha +CFLAGS = -g -Wstrict-prototypes -Dlinux -Dalpha +ASFLAGS = -g -Dlinux -Dalpha NM = $(P1)/linux-nm UNDEFSYMPATTERN=-Xlinker -u -Xlinker & -ASSEM_SRC = alpha-assem.S +ASSEM_SRC = alpha-assem.S linux-stubs.S ARCH_SRC = alpha-arch.c -OS_SRC = Linux-os.c os-common.c undefineds.c -OS_LINK_FLAGS= -Xlinker -Bstatic +OS_SRC = Linux-os.c os-common.c +OS_LINK_FLAGS = -rdynamic -Xlinker --export-dynamic OS_LIBS= -ldl GC_SRC = gc.c VPATH=$(P1) diff --git a/lisp/linux-nm b/lisp/linux-nm index f85e7e50d..72bcdca84 100755 --- a/lisp/linux-nm +++ b/lisp/linux-nm @@ -1,2 +1,2 @@ #!/bin/sh -nm -p "$@" | grep -v " [FUtdb?] " +nm -p "$@" | grep -v " [FUtdb?w] " | uniq diff --git a/lisp/linux-stubs.S b/lisp/linux-stubs.S index b22e4b502..3ed6122fb 100644 --- a/lisp/linux-stubs.S +++ b/lisp/linux-stubs.S @@ -1,6 +1,6 @@ /* linux-stubs.S - $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/linux-stubs.S,v 1.11 2002/08/27 22:18:32 moore Exp $ + $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/linux-stubs.S,v 1.12 2002/11/19 13:17:15 toy Exp $ These are needed because the locations of the libraries are filled in by ld.so at runtime. @@ -12,7 +12,7 @@ gcc2_compiled.: .text #define doe(fct) \ - .align 16 ;\ + .balign 4 ;\ .globl PVE_stub_ ## fct ;\ .type PVE_stub_ ## fct,@function ;\ PVE_stub_ ## fct: ;\ @@ -88,6 +88,7 @@ PVE_stub_ ## fct: ;\ doe(gettimeofday) doe(getuid) doe(getwd) + doe(getcwd) doe(hypot) doe(ioctl) doe(isatty) @@ -143,7 +144,19 @@ PVE_stub_ ## fct: ;\ doe(utimes) doe(wait3) doe(write) - + +#ifdef alpha + doe(atan) + doe(atan2) + doe(cos) + doe(exp) + doe(log) + doe(log10) + doe(sin) + doe(sqrt) + doe(tan) +#endif + /* doe(abort) */ /* doe(abs) */ /* doe(accept) */ diff --git a/lisp/undefineds.h b/lisp/undefineds.h index 8c6b98ce5..76c26685b 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.28 2002/11/19 12:51:00 toy Exp $ */ +/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/undefineds.h,v 1.29 2002/11/19 13:17:15 toy Exp $ */ /* Pick up all the syscalls. */ F(accept) @@ -256,8 +256,16 @@ F(dlsym) F(dlclose) F(dlerror) F(cfgetospeed) +F(cfsetospeed) F(cfgetispeed) F(cfsetispeed) +F(opendir) +F(closedir) +F(readdir) +F(sched_yield) +F(setpgid) +D(tzname) +D(errno) #endif #if defined(sparc) -- GitLab