summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/alpha
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/dietlibc/alpha')
-rw-r--r--mdk-stage1/dietlibc/alpha/Makefile.add6
-rw-r--r--mdk-stage1/dietlibc/alpha/__time.c11
-rw-r--r--mdk-stage1/dietlibc/alpha/accept.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/clone.S6
-rw-r--r--mdk-stage1/dietlibc/alpha/connect.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/divl.S101
-rw-r--r--mdk-stage1/dietlibc/alpha/msgctl.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/msgget.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/msgrcv.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/msgsnd.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/recv.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/recvfrom.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/recvmsg.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/reml.S101
-rw-r--r--mdk-stage1/dietlibc/alpha/remq.S97
-rw-r--r--mdk-stage1/dietlibc/alpha/semctl.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/semget.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/semop.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/send.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/sendmsg.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/sendto.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/seteuid.c7
-rw-r--r--mdk-stage1/dietlibc/alpha/shmat.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/shmctl.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/shmdt.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/shmget.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/shutdown.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/sigprocmask.S6
-rw-r--r--mdk-stage1/dietlibc/alpha/time.S3
-rw-r--r--mdk-stage1/dietlibc/alpha/waitpid.S5
30 files changed, 375 insertions, 28 deletions
diff --git a/mdk-stage1/dietlibc/alpha/Makefile.add b/mdk-stage1/dietlibc/alpha/Makefile.add
index da3791eb6..10ff0faef 100644
--- a/mdk-stage1/dietlibc/alpha/Makefile.add
+++ b/mdk-stage1/dietlibc/alpha/Makefile.add
@@ -1,5 +1,5 @@
-CFLAGS+=-Os -fno-builtin -Iinclude -fomit-frame-pointer -fstrict-aliasing
-override VPATH=alpha:syscalls.s:lib
+CFLAGS+=-Os -Iinclude -fomit-frame-pointer -fstrict-aliasing
+VPATH:=alpha:syscalls.s:$(VPATH)
-LIBOBJ+=divq.o
+LIBOBJ+=$(patsubst %,$(OBJDIR)/%,divq.o divl.o remq.o reml.o seteuid.o __time.o)
diff --git a/mdk-stage1/dietlibc/alpha/__time.c b/mdk-stage1/dietlibc/alpha/__time.c
new file mode 100644
index 000000000..07275e0e3
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/__time.c
@@ -0,0 +1,11 @@
+#include <time.h>
+#include <sys/time.h>
+
+time_t time(time_t *foo) {
+ struct timeval tv;
+ time_t tmp=(time_t)-1;
+ if (gettimeofday(&tv,0)==0)
+ tmp=(time_t)tv.tv_sec;
+ if (foo) *foo=tmp;
+ return tmp;
+}
diff --git a/mdk-stage1/dietlibc/alpha/accept.S b/mdk-stage1/dietlibc/alpha/accept.S
index 43a40ee6f..459c45d7a 100644
--- a/mdk-stage1/dietlibc/alpha/accept.S
+++ b/mdk-stage1/dietlibc/alpha/accept.S
@@ -1,4 +1,3 @@
#include "syscalls.h"
-.weak __libc_accept
-syscall(accept,accept)
+syscall_weak(accept,accept,__libc_accept)
diff --git a/mdk-stage1/dietlibc/alpha/clone.S b/mdk-stage1/dietlibc/alpha/clone.S
index f01620595..b7e32d707 100644
--- a/mdk-stage1/dietlibc/alpha/clone.S
+++ b/mdk-stage1/dietlibc/alpha/clone.S
@@ -7,7 +7,7 @@
clone:
.global __clone
.type __clone,@function
-clone:
+__clone:
ldiq $0, EINVAL
beq $16, .Lerror
beq $17, .Lerror
@@ -17,7 +17,7 @@ clone:
stq $19, 8($17)
mov $18, $16
- lda $0, __NR_pipe($31)
+ lda $0, __NR_clone($31)
callsys
bne $19, .Lerror
@@ -38,5 +38,5 @@ clone:
ldgp $gp, 0($26)
mov $0, $16
- jsr $26, _exit
+ jsr $26, exit
diff --git a/mdk-stage1/dietlibc/alpha/connect.S b/mdk-stage1/dietlibc/alpha/connect.S
index da3675760..c191ca808 100644
--- a/mdk-stage1/dietlibc/alpha/connect.S
+++ b/mdk-stage1/dietlibc/alpha/connect.S
@@ -1,4 +1,3 @@
#include "syscalls.h"
-.weak __libc_connect
-syscall(connect,connect)
+syscall_weak(connect,connect,__libc_connect)
diff --git a/mdk-stage1/dietlibc/alpha/divl.S b/mdk-stage1/dietlibc/alpha/divl.S
new file mode 100644
index 000000000..3af22a5e8
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/divl.S
@@ -0,0 +1,101 @@
+/* taken from glibc 2.2 */
+
+ .set noreorder
+ .set noat
+
+ .ent __divlu
+ .globl __divlu
+
+ .align 3
+__divlu :
+ lda $30 , - 48 ($30 )
+ .frame $30 , 48 , $23 , 0
+ .prologue 0
+.Ludiv:
+ stq $1 , 0($30 )
+ zapnot $25 ,15, $1
+ stq $2 , 8($30 )
+ zapnot $24 ,15, $2
+ stq $0 , 16($30 )
+ clr $27
+ stq $3 , 24($30 )
+ ldiq $0 , 1
+ stq $4 ,32($30 )
+ beq $1 , .Ldivbyzero
+
+ .align 3
+
+
+1: cmpult $1 , $2 , $at
+ s8addq $1 , $31 , $1
+ s8addq $0 , $31 , $0
+ bne $at , 1b
+
+
+
+3: addq $27 ,$0 , $4
+ srl $0 , 1, $0
+ cmpule $1 , $2 , $at
+ subq $2 , $1 , $3
+ cmovne $at ,$4 , $27
+ srl $1 , 1, $1
+ cmovne $at , $3 , $2
+ bne $0 , 3b
+
+.Ldone: ldq $1 , 0($30 )
+ ldq $2 , 8($30 )
+ ldq $0 , 16($30 )
+ ldq $3 , 24($30 )
+ ldq $4 ,32($30 )
+ lda $30 , 48 ($30 )
+ ret $31 , ($23 ), 1
+
+.Ldivbyzero:
+ mov $16 , $3
+ ldiq $16 , -2
+ call_pal 170
+ mov $3 , $16
+ clr $27
+ br .Ldone
+
+ .end __divlu
+
+ .ent __divl
+ .globl __divl
+
+ .align 3
+__divl :
+ lda $30 , - 48 ($30 )
+ .frame $30 , 48 , $23 , 0
+ .prologue 0
+ or $24 , $25 , $at
+ sextl $at , $at
+ bge $at , .Ludiv
+
+
+ stq $24 , 0($30 )
+ negl $24 , $at
+ stq $25 , 8($30 )
+ cmovge $at , $at , $24
+ stq $23 , 16($30 )
+ negl $25 , $at
+ stq $3 , 24($30 )
+ cmovge $at , $at , $25
+
+
+ bsr $23 , __divlu
+
+
+ ldq $24 , 0($30 )
+ ldq $25 , 8($30 )
+ xor $24 , $25 , $at
+ negl $27 , $3
+ sextl $at , $at
+ ldq $23 , 16($30 )
+ cmovlt $at , $3 , $27
+ ldq $3 , 24($30 )
+
+ lda $30 , 48 ($30 )
+ ret $31 , ($23 ), 1
+
+ .end __divl
diff --git a/mdk-stage1/dietlibc/alpha/msgctl.S b/mdk-stage1/dietlibc/alpha/msgctl.S
new file mode 100644
index 000000000..d7caed2cc
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/msgctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgctl,msgctl)
diff --git a/mdk-stage1/dietlibc/alpha/msgget.S b/mdk-stage1/dietlibc/alpha/msgget.S
new file mode 100644
index 000000000..518d67ac4
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/msgget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgget,msgget)
diff --git a/mdk-stage1/dietlibc/alpha/msgrcv.S b/mdk-stage1/dietlibc/alpha/msgrcv.S
new file mode 100644
index 000000000..ab62e6c30
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/msgrcv.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgrcv,msgrcv)
diff --git a/mdk-stage1/dietlibc/alpha/msgsnd.S b/mdk-stage1/dietlibc/alpha/msgsnd.S
new file mode 100644
index 000000000..890a996a2
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/msgsnd.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(msgsnd,msgsnd)
diff --git a/mdk-stage1/dietlibc/alpha/recv.S b/mdk-stage1/dietlibc/alpha/recv.S
index 71b2e37dc..17664f2e2 100644
--- a/mdk-stage1/dietlibc/alpha/recv.S
+++ b/mdk-stage1/dietlibc/alpha/recv.S
@@ -1,4 +1,3 @@
#include "syscalls.h"
-.weak __libc_recv
-syscall(recv,recv)
+syscall_weak(recv,recv,__libc_recv)
diff --git a/mdk-stage1/dietlibc/alpha/recvfrom.S b/mdk-stage1/dietlibc/alpha/recvfrom.S
index 64779cbb8..d8e3922af 100644
--- a/mdk-stage1/dietlibc/alpha/recvfrom.S
+++ b/mdk-stage1/dietlibc/alpha/recvfrom.S
@@ -1,4 +1,3 @@
#include "syscalls.h"
-.weak __libc_recvfrom
-syscall(recvfrom,recvfrom)
+syscall_weak(recvfrom,recvfrom,__libc_recvfrom)
diff --git a/mdk-stage1/dietlibc/alpha/recvmsg.S b/mdk-stage1/dietlibc/alpha/recvmsg.S
new file mode 100644
index 000000000..6ce87eebb
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/recvmsg.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(recvmsg,recvmsg)
diff --git a/mdk-stage1/dietlibc/alpha/reml.S b/mdk-stage1/dietlibc/alpha/reml.S
new file mode 100644
index 000000000..2d89e3280
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/reml.S
@@ -0,0 +1,101 @@
+/* taken from glibc 2.2 */
+
+ .set noreorder
+ .set noat
+
+ .ent __remlu
+ .globl __remlu
+
+ .align 3
+__remlu :
+ lda $30 , -32($30)
+ .frame $30 , 32 , $23 , 0
+ .prologue 0
+.Ludiv:
+ stq $1 , 0($30)
+ zapnot $25 , 15 , $1
+ stq $2 , 8($30)
+ zapnot $24 , 15 , $27
+ stq $0 , 16($30)
+ clr $2
+ stq $3 , 24($30)
+ ldiq $0 , 1
+
+ beq $1 , .Ldivbyzero
+
+ .align 3
+
+
+1: cmpult $1 , $27 , $at
+ s8addq $1 , $31 , $1
+ s8addq $0 , $31 , $0
+ bne $at , 1b
+
+
+
+3:
+ srl $0 , 1 , $0
+ cmpule $1 , $27 , $at
+ subq $27 , $1 , $3
+
+ srl $1 , 1 , $1
+ cmovne $at , $3 , $27
+ bne $0 , 3b
+
+.Ldone: ldq $1 , 0($30)
+ ldq $2 , 8($30)
+ ldq $0 , 16($30)
+ ldq $3 , 24($30)
+
+ lda $30 , 32($30)
+ ret $31 , ($23), 1
+
+.Ldivbyzero:
+ mov $16 , $3
+ ldiq $16 , -2
+ call_pal 170
+ mov $3 , $16
+ clr $27
+ br .Ldone
+
+ .end __remlu
+
+ .ent __reml
+ .globl __reml
+
+ .align 3
+__reml :
+ lda $30 , - 32 ($30 )
+ .frame $30 , 32 , $23 , 0
+ .prologue 0
+ or $24 , $25 , $at
+ sextl $at , $at
+ bge $at , .Ludiv
+
+
+ stq $24 , 0($30 )
+ negl $24 , $at
+ stq $25 , 8($30 )
+ cmovge $at , $at , $24
+ stq $23 , 16($30 )
+ negl $25 , $at
+ stq $3 , 24($30 )
+ cmovge $at , $at , $25
+
+
+ bsr $23 , __remlu
+
+
+ ldq $24 , 0($30 )
+ ldq $25 , 8($30 )
+ mov $24 , $at
+ negl $27 , $3
+ sextl $at , $at
+ ldq $23 , 16($30 )
+ cmovlt $at , $3 , $27
+ ldq $3 , 24($30 )
+
+ lda $30 , 32 ($30 )
+ ret $31 , ($23 ), 1
+
+ .end __reml
diff --git a/mdk-stage1/dietlibc/alpha/remq.S b/mdk-stage1/dietlibc/alpha/remq.S
new file mode 100644
index 000000000..713484da3
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/remq.S
@@ -0,0 +1,97 @@
+/* taken from glibc 2.2 */
+
+ .set noreorder
+ .set noat
+
+ .ent __remqu
+ .globl __remqu
+
+ .align 3
+__remqu :
+ lda $30 , - 32 ($30 )
+ .frame $30 , 32 , $23 , 0
+ .prologue 0
+.Ludiv:
+ stq $1 , 0($30 )
+ mov $25 , $1
+ stq $2 , 8($30 )
+ mov $24 , $27
+ stq $0 , 16($30 )
+ clr $2
+ stq $3 , 24($30 )
+ ldiq $0 , 1
+
+ beq $1 , .Ldivbyzero
+
+ .align 3
+
+1: cmpult $1 , $27 , $at
+ blt $1 , 2f
+ addq $1 , $1 , $1
+ addq $0 , $0 , $0
+ bne $at , 1b
+ unop
+2:
+3:
+ srl $0 , 1, $0
+ cmpule $1 , $27 , $at
+ subq $27 , $1 , $3
+
+ srl $1 , 1, $1
+ cmovne $at , $3 , $27
+ bne $0 , 3b
+
+.Ldone: ldq $1 , 0($30 )
+ ldq $2 , 8($30 )
+ ldq $0 , 16($30 )
+ ldq $3 , 24($30 )
+
+ lda $30 , 32 ($30 )
+ ret $31 , ($23 ), 1
+
+.Ldivbyzero:
+ mov $16 , $3
+ ldiq $16 , -2
+ call_pal 170
+ mov $3 , $16
+ clr $27
+ br .Ldone
+
+ .end __remqu
+
+ .ent __remq
+ .globl __remq
+
+ .align 3
+__remq :
+ lda $30 , - 32 ($30 )
+ .frame $30 , 32 , $23 , 0
+ .prologue 0
+ or $24 , $25 , $at
+
+ bge $at , .Ludiv
+
+ stq $24 , 0($30 )
+ negq $24 , $at
+ stq $25 , 8($30 )
+ cmovge $at , $at , $24
+ stq $23 , 16($30 )
+ negq $25 , $at
+ stq $3 , 24($30 )
+ cmovge $at , $at , $25
+
+ bsr $23 , __remqu
+
+ ldq $24 , 0($30 )
+ ldq $25 , 8($30 )
+ mov $24 , $at
+ negq $27 , $3
+
+ ldq $23 , 16($30 )
+ cmovlt $at , $3 , $27
+ ldq $3 , 24($30 )
+
+ lda $30 , 32 ($30 )
+ ret $31 , ($23 ), 1
+
+ .end __remq
diff --git a/mdk-stage1/dietlibc/alpha/semctl.S b/mdk-stage1/dietlibc/alpha/semctl.S
new file mode 100644
index 000000000..e215ed955
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/semctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semctl,semctl)
diff --git a/mdk-stage1/dietlibc/alpha/semget.S b/mdk-stage1/dietlibc/alpha/semget.S
new file mode 100644
index 000000000..67f488546
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/semget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semget,semget)
diff --git a/mdk-stage1/dietlibc/alpha/semop.S b/mdk-stage1/dietlibc/alpha/semop.S
new file mode 100644
index 000000000..81b6fc606
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/semop.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(semop,semop)
diff --git a/mdk-stage1/dietlibc/alpha/send.S b/mdk-stage1/dietlibc/alpha/send.S
index baed3b173..cfd11be2a 100644
--- a/mdk-stage1/dietlibc/alpha/send.S
+++ b/mdk-stage1/dietlibc/alpha/send.S
@@ -1,4 +1,3 @@
#include "syscalls.h"
-.weak __libc_send
-syscall(send,send)
+syscall_weak(send,send,__libc_send)
diff --git a/mdk-stage1/dietlibc/alpha/sendmsg.S b/mdk-stage1/dietlibc/alpha/sendmsg.S
new file mode 100644
index 000000000..14646ad68
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/sendmsg.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(sendmsg,sendmsg)
diff --git a/mdk-stage1/dietlibc/alpha/sendto.S b/mdk-stage1/dietlibc/alpha/sendto.S
index 19169b26b..17a033011 100644
--- a/mdk-stage1/dietlibc/alpha/sendto.S
+++ b/mdk-stage1/dietlibc/alpha/sendto.S
@@ -1,4 +1,3 @@
#include "syscalls.h"
-.weak __libc_sendto
-syscall(sendto,sendto)
+syscall_weak(sendto,sendto,__libc_sendto)
diff --git a/mdk-stage1/dietlibc/alpha/seteuid.c b/mdk-stage1/dietlibc/alpha/seteuid.c
new file mode 100644
index 000000000..a7cf47893
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/seteuid.c
@@ -0,0 +1,7 @@
+#include <sys/types.h>
+#include <unistd.h>
+
+#undef seteuid
+int seteuid(uid_t euid) {
+ return setreuid(-1,euid);
+}
diff --git a/mdk-stage1/dietlibc/alpha/shmat.S b/mdk-stage1/dietlibc/alpha/shmat.S
new file mode 100644
index 000000000..51248173d
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/shmat.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmat,shmat)
diff --git a/mdk-stage1/dietlibc/alpha/shmctl.S b/mdk-stage1/dietlibc/alpha/shmctl.S
new file mode 100644
index 000000000..d56caace4
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/shmctl.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmctl,shmctl)
diff --git a/mdk-stage1/dietlibc/alpha/shmdt.S b/mdk-stage1/dietlibc/alpha/shmdt.S
new file mode 100644
index 000000000..d9812a799
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/shmdt.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmdt,shmdt)
diff --git a/mdk-stage1/dietlibc/alpha/shmget.S b/mdk-stage1/dietlibc/alpha/shmget.S
new file mode 100644
index 000000000..82914223f
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/shmget.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shmget,shmget)
diff --git a/mdk-stage1/dietlibc/alpha/shutdown.S b/mdk-stage1/dietlibc/alpha/shutdown.S
new file mode 100644
index 000000000..9b5139325
--- /dev/null
+++ b/mdk-stage1/dietlibc/alpha/shutdown.S
@@ -0,0 +1,3 @@
+#include "syscalls.h"
+
+syscall(shutdown,shutdown)
diff --git a/mdk-stage1/dietlibc/alpha/sigprocmask.S b/mdk-stage1/dietlibc/alpha/sigprocmask.S
index 8255a739a..d9da836c2 100644
--- a/mdk-stage1/dietlibc/alpha/sigprocmask.S
+++ b/mdk-stage1/dietlibc/alpha/sigprocmask.S
@@ -1,7 +1,3 @@
#include "syscalls.h"
-.text
-.align 2
-.weak sigprocmask
-sigprocmask:
-syscall(osf_sigprocmask,__sigprocmask)
+syscall_weak(osf_sigprocmask,sigprocmask,__sigprocmask)
diff --git a/mdk-stage1/dietlibc/alpha/time.S b/mdk-stage1/dietlibc/alpha/time.S
index 56a4f9b38..e69de29bb 100644
--- a/mdk-stage1/dietlibc/alpha/time.S
+++ b/mdk-stage1/dietlibc/alpha/time.S
@@ -1,3 +0,0 @@
-#include "syscalls.h"
-
-syscall(osf_gettimeofday,time)
diff --git a/mdk-stage1/dietlibc/alpha/waitpid.S b/mdk-stage1/dietlibc/alpha/waitpid.S
index 0ff429e17..6dc1c99db 100644
--- a/mdk-stage1/dietlibc/alpha/waitpid.S
+++ b/mdk-stage1/dietlibc/alpha/waitpid.S
@@ -2,8 +2,9 @@
.text
.align 2
-.weak __libc_waitpid
-.global waitpid
+.weak waitpid
waitpid:
+.global __libc_waitpid
+__libc_waitpid:
clr $19
br wait4