summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/sparc
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-05-14 14:19:32 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-05-14 14:19:32 +0000
commit167217bec15c9c7aa70ba2a3dc9c689b3cd91872 (patch)
tree7c0c62debf8f9f145643102fb52b81afce743594 /mdk-stage1/dietlibc/sparc
parent9097327dc1c667fc51b8e05cc7c0626fac96665d (diff)
downloaddrakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar
drakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.gz
drakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.bz2
drakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.xz
drakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.zip
import new version of dietlibc
Diffstat (limited to 'mdk-stage1/dietlibc/sparc')
-rw-r--r--mdk-stage1/dietlibc/sparc/Makefile.add2
-rw-r--r--mdk-stage1/dietlibc/sparc/__longjmp.S7
-rw-r--r--mdk-stage1/dietlibc/sparc/__testandset.S6
-rw-r--r--mdk-stage1/dietlibc/sparc/clone.S45
-rw-r--r--mdk-stage1/dietlibc/sparc/fork.S20
-rw-r--r--mdk-stage1/dietlibc/sparc/pipe.S12
-rw-r--r--mdk-stage1/dietlibc/sparc/setjmp.S8
-rw-r--r--mdk-stage1/dietlibc/sparc/shmat.c19
-rw-r--r--mdk-stage1/dietlibc/sparc/unified.S2
9 files changed, 103 insertions, 18 deletions
diff --git a/mdk-stage1/dietlibc/sparc/Makefile.add b/mdk-stage1/dietlibc/sparc/Makefile.add
index a12a0446a..0de05b1db 100644
--- a/mdk-stage1/dietlibc/sparc/Makefile.add
+++ b/mdk-stage1/dietlibc/sparc/Makefile.add
@@ -1,3 +1,3 @@
CFLAGS+=-mcpu=supersparc -Os
-override VPATH=sparc:syscalls.s:lib
+VPATH:=sparc:syscalls.s:$(VPATH)
diff --git a/mdk-stage1/dietlibc/sparc/__longjmp.S b/mdk-stage1/dietlibc/sparc/__longjmp.S
index 81dd24af2..72e001a2f 100644
--- a/mdk-stage1/dietlibc/sparc/__longjmp.S
+++ b/mdk-stage1/dietlibc/sparc/__longjmp.S
@@ -1,7 +1,8 @@
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <setjmp.h>
+#define JB_SP 0
+#define JB_FP 1
+#define JB_PC 2
#define ENV(base,reg) [%base + (reg * 4)]
#define ST_FLUSH_WINDOWS 3
diff --git a/mdk-stage1/dietlibc/sparc/__testandset.S b/mdk-stage1/dietlibc/sparc/__testandset.S
new file mode 100644
index 000000000..84f6cf597
--- /dev/null
+++ b/mdk-stage1/dietlibc/sparc/__testandset.S
@@ -0,0 +1,6 @@
+.text
+.align 4
+.global __testandset
+__testandset:
+ retl
+ ldstub [%o0], %o0
diff --git a/mdk-stage1/dietlibc/sparc/clone.S b/mdk-stage1/dietlibc/sparc/clone.S
new file mode 100644
index 000000000..58b438249
--- /dev/null
+++ b/mdk-stage1/dietlibc/sparc/clone.S
@@ -0,0 +1,45 @@
+#include <asm/errno.h>
+#include <asm/unistd.h>
+
+.text
+.align 4
+.weak clone
+clone:
+.global __clone
+__clone:
+ save %sp, -96, %sp
+
+ tst %i0 /* check for function pointer */
+ be .Lerror
+ tst %i1 /* check for stack pointer */
+ be .Lerror
+ nop
+
+ mov %i1, %o1 /* child-stack */
+ mov %i2, %o0 /* clone-flags */
+ mov __NR_clone, %g1
+ ta 0x10 /* syscall: clone */
+ bcs .Lerror
+
+ tst %o1
+ bne .Lstart /* we are the child :) */
+ nop
+ mov %o0, %i0 /* return child pid */
+ ret
+ restore
+
+.Lerror:
+ call __errno_location
+ nop
+ mov EINVAL, %l0
+ st %l0, [%o0]
+ ret
+ restore %g0, -1, %o0
+
+.Lstart:
+ call %i0 /* call child-function */
+ mov %i3, %o0 /* put arg in the right place for the child */
+
+ call _exit /* child returned */
+ nop
+
diff --git a/mdk-stage1/dietlibc/sparc/fork.S b/mdk-stage1/dietlibc/sparc/fork.S
index 150839971..869c9b30c 100644
--- a/mdk-stage1/dietlibc/sparc/fork.S
+++ b/mdk-stage1/dietlibc/sparc/fork.S
@@ -1,19 +1,25 @@
#include "syscalls.h"
.text
-.global fork
+.weak fork
fork:
+.global __libc_fork
+__libc_fork:
mov 2, %g1
ta 0x10
bcc,a 1f
nop
-
- sethi %hi(errno), %o3
- or %o3, %lo(errno), %o3
- st %i0, [%o3]
-
+ save %sp, -96, %sp
+#ifdef WANT_THREAD_SAVE
+ call __errno_location
+ nop
+#else
+ sethi %hi(errno), %o0
+ or %o0, %lo(errno), %o0
+#endif
+ st %i0, [ %o0 ]
retl
- mov -1, %o0
+ restore %g0, -1, %o0
1: dec %o1
retl
and %o0, %o1, %o0
diff --git a/mdk-stage1/dietlibc/sparc/pipe.S b/mdk-stage1/dietlibc/sparc/pipe.S
index b8ad1d251..820da2570 100644
--- a/mdk-stage1/dietlibc/sparc/pipe.S
+++ b/mdk-stage1/dietlibc/sparc/pipe.S
@@ -3,18 +3,24 @@
.text
.global pipe
pipe:
+ mov %o0, %o2
mov __NR_pipe, %g1
ta 0x10
- bcc,a .Lnoerror
+ bcc,a 1f
nop
save %sp, -96, %sp
+#ifdef WANT_THREAD_SAVE
call __errno_location
nop
+#else
+ sethi %hi(errno), %o0
+ or %o0, %lo(errno), %o0
+#endif
st %i0, [ %o0 ]
ret
restore %g0, -1, %o0
-.Lnoerror:
- st %o0, [ %o2 ]
+
+1: st %o0, [ %o2 ]
st %o1, [ %o2 + 4 ]
retl
mov %g0, %o0
diff --git a/mdk-stage1/dietlibc/sparc/setjmp.S b/mdk-stage1/dietlibc/sparc/setjmp.S
index be77af3c4..efc5a7013 100644
--- a/mdk-stage1/dietlibc/sparc/setjmp.S
+++ b/mdk-stage1/dietlibc/sparc/setjmp.S
@@ -1,6 +1,8 @@
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <setjmp.h>
+
+#define JB_SP 0
+#define JB_FP 1
+#define JB_PC 2
#define ST_FLUSH_WINDOWS 0x03
diff --git a/mdk-stage1/dietlibc/sparc/shmat.c b/mdk-stage1/dietlibc/sparc/shmat.c
new file mode 100644
index 000000000..73b2d89a9
--- /dev/null
+++ b/mdk-stage1/dietlibc/sparc/shmat.c
@@ -0,0 +1,19 @@
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <asm/ipc.h>
+
+extern void* __ipc();
+
+#ifndef PAGE_SIZE
+#define PAGE_SIZE 4096
+#endif
+
+void* shmat(int shmid,const void* shmaddr,int shmflg) {
+ void* raddr;
+ register void* result;
+ result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr);
+ if ((unsigned long)result <= -(unsigned long)PAGE_SIZE)
+ result=raddr;
+ return result;
+}
diff --git a/mdk-stage1/dietlibc/sparc/unified.S b/mdk-stage1/dietlibc/sparc/unified.S
index 53b1612a9..3cd609da5 100644
--- a/mdk-stage1/dietlibc/sparc/unified.S
+++ b/mdk-stage1/dietlibc/sparc/unified.S
@@ -22,7 +22,7 @@ __unified_syscall:
or %o0, %lo(errno), %o0
#endif
st %l3, [ %o0 ]
- mov -1, %o0
+ mov -1, %i0
2:
ret
restore