commit 630589dfd6357b2c6218929fa03d18a75f04631b
parent 091df2945f151161cda2ab5aeb73207953887b60
Author: Alexander Burger <abu@software-lab.de>
Date: Mon, 21 Feb 2011 17:35:22 +0100
First build for SunOS
Diffstat:
4 files changed, 210 insertions(+), 5 deletions(-)
diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar
Binary files differ.
diff --git a/src64/Makefile b/src64/Makefile
@@ -1,4 +1,4 @@
-# 12nov10abu
+# 21feb11abu
# (c) Software Lab. Alexander Burger
.SILENT:
@@ -10,20 +10,35 @@ ifeq ($(shell uname), Linux)
OS = Linux
SYS = linux
ARCH = x86-64
+ CC = gcc
+ AS = as
LINK-FLAGS = -rdynamic -lc -lm -ldl
DYNAMIC-LIB-FLAGS = -shared -export-dynamic
STRIP = strip
else
+ifeq ($(shell uname), SunOS)
+ OS = SunOS
+ SYS = sunOs
+ ARCH = x86-64
+ CC = gcc -m64
+ AS = gas --64
+ LINK-FLAGS = -lc -lm -ldl -lsocket -lnsl
+ DYNAMIC-LIB-FLAGS = -shared -export-dynamic
+ STRIP = strip
+else
ifeq ($(shell uname), Darwin)
OS = Darwin
SYS = darwin
ARCH = x86-64
+ CC = gcc
+ AS = as
export MACOSX_DEPLOYMENT_TARGET=10.4
LINK-FLAGS = -lc -lm -ldl
DYNAMIC-LIB-FLAGS = -dynamiclib -undefined dynamic_lookup -export-dynamic
STRIP = :
endif
endif
+endif
baseFiles = version.l glob.l main.l sys/$(SYS).code.l \
gc.l apply.l flow.l sym.l subr.l big.l io.l db.l net.l err.l
@@ -34,19 +49,19 @@ all: picolisp
$(bin)/picolisp: $(ARCH).$(SYS).base.o
mkdir -p $(bin) $(lib)
- gcc -o $(bin)/picolisp $(LINK-FLAGS) $(ARCH).$(SYS).base.o
+ $(CC) -o $(bin)/picolisp $(LINK-FLAGS) $(ARCH).$(SYS).base.o
$(STRIP) $(bin)/picolisp
$(lib)/ext: $(ARCH).$(SYS).ext.o
- gcc -o $(lib)/ext $(DYNAMIC-LIB-FLAGS) $(ARCH).$(SYS).ext.o
+ $(CC) -o $(lib)/ext $(DYNAMIC-LIB-FLAGS) $(ARCH).$(SYS).ext.o
$(STRIP) $(lib)/ext
$(lib)/ht: $(ARCH).$(SYS).ht.o
- gcc -o $(lib)/ht $(DYNAMIC-LIB-FLAGS) $(ARCH).$(SYS).ht.o
+ $(CC) -o $(lib)/ht $(DYNAMIC-LIB-FLAGS) $(ARCH).$(SYS).ht.o
$(STRIP) $(lib)/ht
.s.o:
- as -o $*.o $*.s
+ $(AS) -o $*.o $*.s
$(ARCH).$(SYS).base.s: $(baseFiles)
./mkAsm $(ARCH) $(SYS) $(OS) base $(lib)/tags $(baseFiles)
diff --git a/src64/sys/sunOs.code.l b/src64/sys/sunOs.code.l
@@ -0,0 +1,40 @@
+# 19may10
+# zonick <nikolai@zobnin.ru>
+# (c) Software Lab. Alexander Burger
+
+# System macros
+(code 'errno_A 0)
+ call ___errno # Get address of 'errno'
+ ld A (A) # Load value
+ ret
+
+(code 'errnoC 0)
+ call ___errno # Get address of 'errno'
+ ld (A) C # Store new value
+ ret
+
+(code 's_isdirS_F 0) # S_ISDIR
+ ld4 (S `(+ I ST_MODE)) # Get 'st_mode' from 'stat'
+ and A `S_IFMT
+ cmp A `S_IFDIR
+ ret
+
+(code 'wifstoppedS_F 0) # WIFSTOPPED
+ ld A (S I) # Get status
+ cmp B `(hex "7F") # (((status) & 0xff) == 0x7f)
+ ret
+
+(code 'wifsignaledS_F 0) # WIFSIGNALED
+ ld A (S I) # Get status
+ and B `(hex "7F") # (((status) & 0x7f) + 1) >> 1) > 0)
+ inc B
+ shr B 1
+ ret
+
+(code 'wtermsigS_A 0) # WTERMSIG
+ ld A (S I) # Get status
+ and B `(hex "7F") # ((status) & 0x7f)
+ zxt
+ ret
+
+# vi:et:ts=3:sw=3
diff --git a/src64/sys/sunOs.defs.l b/src64/sys/sunOs.defs.l
@@ -0,0 +1,150 @@
+# 17sep10
+# zonick <nikolai@zobnin.ru>
+# (c) Software Lab. Alexander Burger
+
+# errno
+(equ ENOENT 2) # No such file or directory
+(equ EINTR 4) # Interrupted system call
+(equ EBADF 9) # Bad file number
+(equ EAGAIN 11) # Try again
+(equ EACCES 13) # Permission denied
+(equ EPIPE 32) # Broken pipe
+(equ ECONNRESET 131) # Connection reset by peer
+
+# open/fcntl
+(equ O_RDONLY 0)
+(equ O_WRONLY 1)
+(equ O_RDWR 2)
+(equ O_CREAT 256)
+(equ O_EXCL 1024)
+(equ O_TRUNC 512)
+(equ O_APPEND 8)
+(equ F_GETFD 1)
+(equ F_SETFD 2)
+(equ FD_CLOEXEC 1)
+
+# stdio
+(equ BUFSIZ 8192)
+(equ PIPE_BUF 5120)
+
+(equ stdin "$__iob")
+(equ stdout "$__iob+128")
+(equ stderr "$__iob+256")
+
+(equ MAXPATHLEN 1024)
+
+# dlfcn
+(equ RTLD_LAZY 1)
+(equ RTLD_GLOBAL 256)
+
+# fcntl
+(equ FLOCK 64) # File lock structure
+(equ L_TYPE 0) # 2
+(equ L_WHENCE 2) # 2
+(equ L_START 8)
+(equ L_LEN 16)
+(equ L_PID 28)
+(equ SEEK_SET 0)
+(equ SEEK_CUR 1)
+(equ F_RDLCK 1)
+(equ F_WRLCK 2)
+(equ F_UNLCK 3)
+(equ F_GETFL 3)
+(equ F_SETFL 4)
+(equ F_GETLK 14)
+(equ F_SETLK 6)
+(equ F_SETLKW 7)
+(equ F_SETOWN 24)
+(equ O_NONBLOCK 0)
+(equ O_ASYNC 0)
+
+# stat
+(equ STAT 128) # File status structure
+(equ ST_MODE 16) # 4
+(equ ST_SIZE 40)
+(equ ST_MTIME 64)
+(equ S_IFMT (hex "F000"))
+(equ S_IFDIR (hex "4000"))
+
+# times
+(equ TMS 32) # 'times' structure
+(equ TMS_UTIME 0)
+(equ TMS_STIME 8)
+
+# termios
+(equ TERMIOS 36) # Terminal I/O structure (+ Padding)
+(equ C_IFLAG 0)
+(equ C_LFLAG 12)
+(equ C_CC 16)
+(equ ISIG 1)
+(equ VMIN 4)
+(equ VTIME 5)
+(equ TCSADRAIN 21519)
+
+# signal
+(equ SIGACTION 32) # Sigaction structure
+(equ SIGSET_T 16)
+(equ SA_HANDLER 8)
+(equ SA_MASK 16)
+(equ SA_FLAGS 0)
+
+(equ SIG_DFL 0)
+(equ SIG_IGN 1)
+(equ SIG_UNBLOCK 2)
+
+(equ SIGHUP 1) # Signals
+(equ SIGINT 2)
+(equ SIGUSR1 16)
+(equ SIGUSR2 17)
+(equ SIGPIPE 13)
+(equ SIGALRM 14)
+(equ SIGTERM 15)
+(equ SIGCHLD 18)
+(equ SIGCONT 25)
+(equ SIGSTOP 23)
+(equ SIGTSTP 24)
+(equ SIGTTIN 26)
+(equ SIGTTOU 27)
+(equ SIGIO 22)
+(equ SIGNALS 28) # Highest used signal number plus 1
+
+# wait
+(equ WNOHANG 64)
+(equ WUNTRACED 4)
+
+# select
+(equ FD_SET 8192) # 1024 bit
+
+# time
+(equ TM_SEC 0)
+(equ TM_MIN 4)
+(equ TM_HOUR 8)
+(equ TM_MDAY 12)
+(equ TM_MON 16)
+(equ TM_YEAR 20)
+
+# dir
+(equ D_NAME 18)
+
+# Sockets
+(equ HOSTENT 32)
+(equ H_NAME 0)
+(equ H_LENGTH 20)
+(equ H_ADDR_LIST 24)
+
+(equ IN_ADDR 4)
+(equ S_ADDR 0)
+
+(equ SOCKADDR_IN 16)
+(equ SIN_ADDR 4)
+(equ SIN_ADDR.S_ADDR 4)
+(equ SIN_PORT 2)
+(equ SIN_FAMILY 0)
+(equ AF_INET 2)
+(equ SOCK_STREAM 2)
+(equ SOCK_DGRAM 1)
+(equ INADDR_ANY 0)
+(equ SOL_SOCKET 65535)
+(equ SO_REUSEADDR 4)
+
+# vi:et:ts=3:sw=3