From 02fec4701cee79f875c1d02b8b4aee09380dbcb8 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Thu, 4 Jan 2001 20:04:45 +0000 Subject: integrate dietlibc/stdio per default for cdrom and disk only installs --- mdk-stage1/dietlibc/alpha/Makefile.add | 5 ++ mdk-stage1/dietlibc/alpha/__longjmp.S | 38 ++++++++++++ mdk-stage1/dietlibc/alpha/accept.S | 4 ++ mdk-stage1/dietlibc/alpha/bind.S | 3 + mdk-stage1/dietlibc/alpha/clone.S | 42 +++++++++++++ mdk-stage1/dietlibc/alpha/connect.S | 4 ++ mdk-stage1/dietlibc/alpha/divq.S | 102 ++++++++++++++++++++++++++++++++ mdk-stage1/dietlibc/alpha/getegid.S | 11 ++++ mdk-stage1/dietlibc/alpha/geteuid.S | 11 ++++ mdk-stage1/dietlibc/alpha/getgid.S | 3 + mdk-stage1/dietlibc/alpha/getpeername.S | 3 + mdk-stage1/dietlibc/alpha/getpid.S | 3 + mdk-stage1/dietlibc/alpha/getppid.S | 11 ++++ mdk-stage1/dietlibc/alpha/getsockname.S | 3 + mdk-stage1/dietlibc/alpha/getsockopt.S | 3 + mdk-stage1/dietlibc/alpha/getuid.S | 3 + mdk-stage1/dietlibc/alpha/listen.S | 3 + mdk-stage1/dietlibc/alpha/mmap.S | 3 + mdk-stage1/dietlibc/alpha/pipe.S | 17 ++++++ mdk-stage1/dietlibc/alpha/recv.S | 4 ++ mdk-stage1/dietlibc/alpha/recvfrom.S | 4 ++ mdk-stage1/dietlibc/alpha/send.S | 4 ++ mdk-stage1/dietlibc/alpha/sendto.S | 4 ++ mdk-stage1/dietlibc/alpha/setjmp.S | 46 ++++++++++++++ mdk-stage1/dietlibc/alpha/setsockopt.S | 3 + mdk-stage1/dietlibc/alpha/signal.S | 3 + mdk-stage1/dietlibc/alpha/sigprocmask.S | 7 +++ mdk-stage1/dietlibc/alpha/socket.S | 3 + mdk-stage1/dietlibc/alpha/socketcall.S | 5 ++ mdk-stage1/dietlibc/alpha/start.S | 35 +++++++++++ mdk-stage1/dietlibc/alpha/strlen.c | 32 ++++++++++ mdk-stage1/dietlibc/alpha/time.S | 3 + mdk-stage1/dietlibc/alpha/unified.S | 29 +++++++++ mdk-stage1/dietlibc/alpha/utime.S | 3 + mdk-stage1/dietlibc/alpha/waitpid.S | 9 +++ 35 files changed, 466 insertions(+) create mode 100644 mdk-stage1/dietlibc/alpha/Makefile.add create mode 100644 mdk-stage1/dietlibc/alpha/__longjmp.S create mode 100644 mdk-stage1/dietlibc/alpha/accept.S create mode 100644 mdk-stage1/dietlibc/alpha/bind.S create mode 100644 mdk-stage1/dietlibc/alpha/clone.S create mode 100644 mdk-stage1/dietlibc/alpha/connect.S create mode 100644 mdk-stage1/dietlibc/alpha/divq.S create mode 100644 mdk-stage1/dietlibc/alpha/getegid.S create mode 100644 mdk-stage1/dietlibc/alpha/geteuid.S create mode 100644 mdk-stage1/dietlibc/alpha/getgid.S create mode 100644 mdk-stage1/dietlibc/alpha/getpeername.S create mode 100644 mdk-stage1/dietlibc/alpha/getpid.S create mode 100644 mdk-stage1/dietlibc/alpha/getppid.S create mode 100644 mdk-stage1/dietlibc/alpha/getsockname.S create mode 100644 mdk-stage1/dietlibc/alpha/getsockopt.S create mode 100644 mdk-stage1/dietlibc/alpha/getuid.S create mode 100644 mdk-stage1/dietlibc/alpha/listen.S create mode 100644 mdk-stage1/dietlibc/alpha/mmap.S create mode 100644 mdk-stage1/dietlibc/alpha/pipe.S create mode 100644 mdk-stage1/dietlibc/alpha/recv.S create mode 100644 mdk-stage1/dietlibc/alpha/recvfrom.S create mode 100644 mdk-stage1/dietlibc/alpha/send.S create mode 100644 mdk-stage1/dietlibc/alpha/sendto.S create mode 100644 mdk-stage1/dietlibc/alpha/setjmp.S create mode 100644 mdk-stage1/dietlibc/alpha/setsockopt.S create mode 100644 mdk-stage1/dietlibc/alpha/signal.S create mode 100644 mdk-stage1/dietlibc/alpha/sigprocmask.S create mode 100644 mdk-stage1/dietlibc/alpha/socket.S create mode 100644 mdk-stage1/dietlibc/alpha/socketcall.S create mode 100644 mdk-stage1/dietlibc/alpha/start.S create mode 100644 mdk-stage1/dietlibc/alpha/strlen.c create mode 100644 mdk-stage1/dietlibc/alpha/time.S create mode 100644 mdk-stage1/dietlibc/alpha/unified.S create mode 100644 mdk-stage1/dietlibc/alpha/utime.S create mode 100644 mdk-stage1/dietlibc/alpha/waitpid.S (limited to 'mdk-stage1/dietlibc/alpha') diff --git a/mdk-stage1/dietlibc/alpha/Makefile.add b/mdk-stage1/dietlibc/alpha/Makefile.add new file mode 100644 index 000000000..da3791eb6 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/Makefile.add @@ -0,0 +1,5 @@ + +CFLAGS+=-Os -fno-builtin -Iinclude -fomit-frame-pointer -fstrict-aliasing +override VPATH=alpha:syscalls.s:lib + +LIBOBJ+=divq.o diff --git a/mdk-stage1/dietlibc/alpha/__longjmp.S b/mdk-stage1/dietlibc/alpha/__longjmp.S new file mode 100644 index 000000000..d86d76717 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/__longjmp.S @@ -0,0 +1,38 @@ +#ifdef __alpha__ + +#include + +.text +.align 2 + +.global __longjmp +__longjmp: + mov $17, $0 /* a1 -> v0 */ + + ldq $9, (JB_S0*8) ($16) /* s0 */ + ldq $10, (JB_S1*8) ($16) /* s1 */ + ldq $11, (JB_S2*8) ($16) /* s2 */ + ldq $12, (JB_S3*8) ($16) /* s3 */ + ldq $13, (JB_S4*8) ($16) /* s4 */ + ldq $14, (JB_S5*8) ($16) /* s5 */ + + ldq $26, (JB_PC*8) ($16) /* ra */ + ldq $fp, (JB_FP*8) ($16) /* fp */ + ldq $1, (JB_SP*8) ($16) /* sp */ + + ldt $f2, (JB_F2*8) ($16) /* f2 */ + ldt $f3, (JB_F3*8) ($16) /* f3 */ + ldt $f4, (JB_F4*8) ($16) /* f4 */ + ldt $f5, (JB_F5*8) ($16) /* f5 */ + ldt $f6, (JB_F6*8) ($16) /* f6 */ + ldt $f7, (JB_F7*8) ($16) /* f7 */ + ldt $f8, (JB_F8*8) ($16) /* f8 */ + ldt $f9, (JB_F9*8) ($16) /* f9 */ + + cmoveq $0, 0x1, $0 + mov $1, $sp + + ret $31, ($26), 1 + + +#endif diff --git a/mdk-stage1/dietlibc/alpha/accept.S b/mdk-stage1/dietlibc/alpha/accept.S new file mode 100644 index 000000000..43a40ee6f --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/accept.S @@ -0,0 +1,4 @@ +#include "syscalls.h" + +.weak __libc_accept +syscall(accept,accept) diff --git a/mdk-stage1/dietlibc/alpha/bind.S b/mdk-stage1/dietlibc/alpha/bind.S new file mode 100644 index 000000000..86a04cb70 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/bind.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(bind,bind) diff --git a/mdk-stage1/dietlibc/alpha/clone.S b/mdk-stage1/dietlibc/alpha/clone.S new file mode 100644 index 000000000..f01620595 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/clone.S @@ -0,0 +1,42 @@ +#include "syscalls.h" +#include + +.text +.align 2 +.weak clone +clone: +.global __clone +.type __clone,@function +clone: + ldiq $0, EINVAL + beq $16, .Lerror + beq $17, .Lerror + + subq $17, 16, $17 + stq $16, 0($17) + stq $19, 8($17) + mov $18, $16 + + lda $0, __NR_pipe($31) + callsys + bne $19, .Lerror + + beq $0, .Lstart_thread + + ret $31, ($26), 0x01 + +.Lerror: + jmp error_unified_syscall + +.Lstart_thread: + clr $fp + + ldq $27, 0($sp) + ldq $16, 8($sp) + + jsr $26, ($27), 0x04 + + ldgp $gp, 0($26) + mov $0, $16 + jsr $26, _exit + diff --git a/mdk-stage1/dietlibc/alpha/connect.S b/mdk-stage1/dietlibc/alpha/connect.S new file mode 100644 index 000000000..da3675760 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/connect.S @@ -0,0 +1,4 @@ +#include "syscalls.h" + +.weak __libc_connect +syscall(connect,connect) diff --git a/mdk-stage1/dietlibc/alpha/divq.S b/mdk-stage1/dietlibc/alpha/divq.S new file mode 100644 index 000000000..cf70862c4 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/divq.S @@ -0,0 +1,102 @@ +/* taken from glibc 2.2 */ + + .set noreorder + .set noat + + .ent __divqu + .globl __divqu + + .align 3 +__divqu : + lda $30 , - 48 ($30 ) + .frame $30 , 48 , $23 , 0 + .prologue 0 +$udiv: + stq $1 , 0($30 ) + mov $25 , $1 + stq $2 , 8($30 ) + mov $24 , $2 + stq $0 , 16($30 ) + clr $27 + stq $3 , 24($30 ) + ldiq $0 , 1 + stq $4 ,32($30 ) + beq $1 , $divbyzero + + .align 3 + + +1: cmpult $1 , $2 , $at + blt $1 , 2f + addq $1 , $1 , $1 + addq $0 , $0 , $0 + bne $at , 1b + unop +2: +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 + +$done: 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 + +$divbyzero: + mov $16 , $3 + ldiq $16 , -2 + call_pal 170 + mov $3 , $16 + clr $27 + br $done + + .end __divqu + + .ent __divq + .globl __divq + + .align 3 +__divq : + lda $30 , - 48 ($30 ) + .frame $30 , 48 , $23 , 0 + .prologue 0 + or $24 , $25 , $at + + bge $at , $udiv + + + 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 , __divqu + + + ldq $24 , 0($30 ) + ldq $25 , 8($30 ) + xor $24 , $25 , $at + negq $27 , $3 + + ldq $23 , 16($30 ) + cmovlt $at , $3 , $27 + ldq $3 , 24($30 ) + + lda $30 , 48 ($30 ) + ret $31 , ($23 ), 1 + + .end __divq + diff --git a/mdk-stage1/dietlibc/alpha/getegid.S b/mdk-stage1/dietlibc/alpha/getegid.S new file mode 100644 index 000000000..89c35d45e --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/getegid.S @@ -0,0 +1,11 @@ +.text +.align 2 +.global getegid +getegid: + lda $sp,-8($sp) + stq $26, 0($sp) + jsr getgid + ldq $26, 0($sp) + lda $sp, 8($sp) + cmovge $0, $20, $0 + ret diff --git a/mdk-stage1/dietlibc/alpha/geteuid.S b/mdk-stage1/dietlibc/alpha/geteuid.S new file mode 100644 index 000000000..087ca7348 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/geteuid.S @@ -0,0 +1,11 @@ +.text +.align 2 +.global geteuid +geteuid: + lda $sp,-8($sp) + stq $26, 0($sp) + jsr getuid + ldq $26, 0($sp) + lda $sp, 8($sp) + cmovge $0, $20, $0 + ret diff --git a/mdk-stage1/dietlibc/alpha/getgid.S b/mdk-stage1/dietlibc/alpha/getgid.S new file mode 100644 index 000000000..7350082f3 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/getgid.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(getxgid,getgid) diff --git a/mdk-stage1/dietlibc/alpha/getpeername.S b/mdk-stage1/dietlibc/alpha/getpeername.S new file mode 100644 index 000000000..3b3f48b1a --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/getpeername.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(getpeername,getpeername) diff --git a/mdk-stage1/dietlibc/alpha/getpid.S b/mdk-stage1/dietlibc/alpha/getpid.S new file mode 100644 index 000000000..d8b3523b2 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/getpid.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(getxpid,getpid) diff --git a/mdk-stage1/dietlibc/alpha/getppid.S b/mdk-stage1/dietlibc/alpha/getppid.S new file mode 100644 index 000000000..e181268c3 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/getppid.S @@ -0,0 +1,11 @@ +.text +.align 2 +.global getppid +getppid: + lda $sp,-8($sp) + stq $26, 0($sp) + jsr getpid + ldq $26, 0($sp) + lda $sp, 8($sp) + cmovge $0, $20, $0 + ret diff --git a/mdk-stage1/dietlibc/alpha/getsockname.S b/mdk-stage1/dietlibc/alpha/getsockname.S new file mode 100644 index 000000000..2727d88da --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/getsockname.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(getsockname,getsockname) diff --git a/mdk-stage1/dietlibc/alpha/getsockopt.S b/mdk-stage1/dietlibc/alpha/getsockopt.S new file mode 100644 index 000000000..44b4a910a --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/getsockopt.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(getsockopt,getsockopt) diff --git a/mdk-stage1/dietlibc/alpha/getuid.S b/mdk-stage1/dietlibc/alpha/getuid.S new file mode 100644 index 000000000..fcb5570c2 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/getuid.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(getxuid,getuid) diff --git a/mdk-stage1/dietlibc/alpha/listen.S b/mdk-stage1/dietlibc/alpha/listen.S new file mode 100644 index 000000000..1102831d4 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/listen.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(listen,listen) diff --git a/mdk-stage1/dietlibc/alpha/mmap.S b/mdk-stage1/dietlibc/alpha/mmap.S new file mode 100644 index 000000000..2e57fbb74 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/mmap.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(mmap,mmap) diff --git a/mdk-stage1/dietlibc/alpha/pipe.S b/mdk-stage1/dietlibc/alpha/pipe.S new file mode 100644 index 000000000..3dfef10bf --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/pipe.S @@ -0,0 +1,17 @@ +#include "syscalls.h" + +.text +.align 2 +.global pipe +.type pipe,@function +pipe: + lda $0, __NR_pipe($31) + callsys + bne $19, .Lerror + stl $0, 0($16) + stl $20, 4($16) + clr $0 + ret $31, ($26), 0x01 +.Lerror: + br error_unified_syscall + diff --git a/mdk-stage1/dietlibc/alpha/recv.S b/mdk-stage1/dietlibc/alpha/recv.S new file mode 100644 index 000000000..71b2e37dc --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/recv.S @@ -0,0 +1,4 @@ +#include "syscalls.h" + +.weak __libc_recv +syscall(recv,recv) diff --git a/mdk-stage1/dietlibc/alpha/recvfrom.S b/mdk-stage1/dietlibc/alpha/recvfrom.S new file mode 100644 index 000000000..64779cbb8 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/recvfrom.S @@ -0,0 +1,4 @@ +#include "syscalls.h" + +.weak __libc_recvfrom +syscall(recvfrom,recvfrom) diff --git a/mdk-stage1/dietlibc/alpha/send.S b/mdk-stage1/dietlibc/alpha/send.S new file mode 100644 index 000000000..baed3b173 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/send.S @@ -0,0 +1,4 @@ +#include "syscalls.h" + +.weak __libc_send +syscall(send,send) diff --git a/mdk-stage1/dietlibc/alpha/sendto.S b/mdk-stage1/dietlibc/alpha/sendto.S new file mode 100644 index 000000000..19169b26b --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/sendto.S @@ -0,0 +1,4 @@ +#include "syscalls.h" + +.weak __libc_sendto +syscall(sendto,sendto) diff --git a/mdk-stage1/dietlibc/alpha/setjmp.S b/mdk-stage1/dietlibc/alpha/setjmp.S new file mode 100644 index 000000000..3768056be --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/setjmp.S @@ -0,0 +1,46 @@ +#include + +.text +.global __sigsetjmp +__sigsetjmp: + ldgp $gp, 0($gp) + + mov $sp, $1 + lda $sp, -16($sp) + + stq $26, 0($sp) /* save ra */ + + stq $9, (JB_S0*8) ($16) /* s0 */ + stq $10, (JB_S1*8) ($16) /* s1 */ + stq $11, (JB_S2*8) ($16) /* s2 */ + stq $12, (JB_S3*8) ($16) /* s3 */ + stq $13, (JB_S4*8) ($16) /* s4 */ + stq $14, (JB_S5*8) ($16) /* s5 */ + + stq $26, (JB_PC*8) ($16) /* ra */ + stq $fp, (JB_FP*8) ($16) /* fp */ + stq $1, (JB_SP*8) ($16) /* sp */ + + stt $f2, (JB_F2*8) ($16) /* f2 */ + stt $f3, (JB_F3*8) ($16) /* f3 */ + stt $f4, (JB_F4*8) ($16) /* f4 */ + stt $f5, (JB_F5*8) ($16) /* f5 */ + stt $f6, (JB_F6*8) ($16) /* f6 */ + stt $f7, (JB_F7*8) ($16) /* f7 */ + stt $f8, (JB_F8*8) ($16) /* f8 */ + stt $f9, (JB_F9*8) ($16) /* f9 */ + + br $26, __sigjmp_save /* call __sigjmp_save */ + + ldq $26, 0($sp) /* restore ra */ + + lda $sp, 16($sp) + ret $31, ($26), 1 /* back to caller */ + +.weak setjmp +setjmp: +.weak __setjmp +__setjmp: + ldgp $gp, 0($gp) + mov 0, $17 + br __sigsetjmp diff --git a/mdk-stage1/dietlibc/alpha/setsockopt.S b/mdk-stage1/dietlibc/alpha/setsockopt.S new file mode 100644 index 000000000..e3fe1d321 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/setsockopt.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(setsockopt,setsockopt) diff --git a/mdk-stage1/dietlibc/alpha/signal.S b/mdk-stage1/dietlibc/alpha/signal.S new file mode 100644 index 000000000..ceca0f02d --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/signal.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(osf_signal,signal) diff --git a/mdk-stage1/dietlibc/alpha/sigprocmask.S b/mdk-stage1/dietlibc/alpha/sigprocmask.S new file mode 100644 index 000000000..8255a739a --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/sigprocmask.S @@ -0,0 +1,7 @@ +#include "syscalls.h" + +.text +.align 2 +.weak sigprocmask +sigprocmask: +syscall(osf_sigprocmask,__sigprocmask) diff --git a/mdk-stage1/dietlibc/alpha/socket.S b/mdk-stage1/dietlibc/alpha/socket.S new file mode 100644 index 000000000..85401f56e --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/socket.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(socket,socket) diff --git a/mdk-stage1/dietlibc/alpha/socketcall.S b/mdk-stage1/dietlibc/alpha/socketcall.S new file mode 100644 index 000000000..b150bd5d5 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/socketcall.S @@ -0,0 +1,5 @@ +#include "syscalls.h" + +/* + * Doesn't exist on alpha ( accept, bind, ... are SYSCALLS !?! ) + */ diff --git a/mdk-stage1/dietlibc/alpha/start.S b/mdk-stage1/dietlibc/alpha/start.S new file mode 100644 index 000000000..00b8e950d --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/start.S @@ -0,0 +1,35 @@ +#include "start.h" + +#ifdef __alpha__ + +.text +.align 2 + .set noreorder + +.global __start +__start: +.global _start +_start: + clr $fp /* clear frame pointer */ + + br $gp,.Lstart /* set global pointer */ +.Lstart: + ldgp $gp, 0($gp) + +/* prepare to call main */ + ldl $16, 0($sp) /* argc */ + + lda $17, 8($sp) /* argv */ + + addq $16, 1, $18 /* argp */ + s8addq $18, $17, $18 /* (8*(argc+1))+argv -> argp */ + + stq $18, environ + + mov $0, $21 /* mov v0(dynload) to a5 */ + + jsr $26, main + mov $0, $16 + jsr $26, exit /* YES, CALL! for threads and atexit ! (+4 byte) */ + +#endif diff --git a/mdk-stage1/dietlibc/alpha/strlen.c b/mdk-stage1/dietlibc/alpha/strlen.c new file mode 100644 index 000000000..ac532254a --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/strlen.c @@ -0,0 +1,32 @@ +#include + +static const unsigned long long magic = 0x0101010101010101LL; + +size_t strlen(const char *s) +{ + const char *t = s; + unsigned long long word; + + if (!s) return 0; + + /* Byte compare up until 64 bit word boundary */ + for (; ((unsigned long long) t & 7); t++) + if (!*t) return t - s; + + /* Word compare */ + do { + word = *((unsigned long long *) t); t += 8; + word = (word - magic) &~ word; + word &= (magic << 7); + } while (word == 0); + + /* word & 0x8080808080808080 == word */ + word = (word - 1) & (magic << 8); + word += (word << 32); + word += (word << 16); + word += (word << 8); + t += word >> 56; + return ((const char *) t) - 8 - s; +} + + diff --git a/mdk-stage1/dietlibc/alpha/time.S b/mdk-stage1/dietlibc/alpha/time.S new file mode 100644 index 000000000..56a4f9b38 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/time.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(osf_gettimeofday,time) diff --git a/mdk-stage1/dietlibc/alpha/unified.S b/mdk-stage1/dietlibc/alpha/unified.S new file mode 100644 index 000000000..02a1c9bcd --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/unified.S @@ -0,0 +1,29 @@ +#include + +.global __unified_syscall +__unified_syscall: + callsys + bne $19, .Lerror + ret $31, ($26), 0x01 + +.Lerror: +.global error_unified_syscall +error_unified_syscall: +#ifdef WANT_THREAD_SAVE + lda $sp, -16($sp) /* alloc 2 qwords on stack */ + stq $26, 0($sp) /* save ra to stack */ + stq $0, 8($sp) /* save v0 to stack */ + + jsr $26, __errno_location /* call __errno_location */ + + ldq $1, 8($sp) /* write old v0 to errno */ + stl $1, 0($0) + + lda $0, -1($31) /* new return value is -1 */ + ldq $26, 0($sp) /* restore return address */ + lda $sp, 16($sp) /* free 2 qwords on stack */ +#else + lda $1, errno + stl $0, 0($1) +#endif + ret $31, ($26), 0x01 /* return */ diff --git a/mdk-stage1/dietlibc/alpha/utime.S b/mdk-stage1/dietlibc/alpha/utime.S new file mode 100644 index 000000000..a9a8aada6 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/utime.S @@ -0,0 +1,3 @@ +#include "syscalls.h" + +syscall(utimes,utime) diff --git a/mdk-stage1/dietlibc/alpha/waitpid.S b/mdk-stage1/dietlibc/alpha/waitpid.S new file mode 100644 index 000000000..0ff429e17 --- /dev/null +++ b/mdk-stage1/dietlibc/alpha/waitpid.S @@ -0,0 +1,9 @@ +#include + +.text +.align 2 +.weak __libc_waitpid +.global waitpid +waitpid: + clr $19 + br wait4 -- cgit v1.2.1