summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/i386
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/i386
parent9097327dc1c667fc51b8e05cc7c0626fac96665d (diff)
downloaddrakx-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar
drakx-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.gz
drakx-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.bz2
drakx-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.xz
drakx-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.zip
import new version of dietlibc
Diffstat (limited to 'mdk-stage1/dietlibc/i386')
-rw-r--r--mdk-stage1/dietlibc/i386/Makefile.add2
-rw-r--r--mdk-stage1/dietlibc/i386/__longjmp.S4
-rw-r--r--mdk-stage1/dietlibc/i386/__testandset.S8
-rw-r--r--mdk-stage1/dietlibc/i386/clone.S51
-rw-r--r--mdk-stage1/dietlibc/i386/select.S5
-rw-r--r--mdk-stage1/dietlibc/i386/setjmp.S4
-rw-r--r--mdk-stage1/dietlibc/i386/start.S22
-rw-r--r--mdk-stage1/dietlibc/i386/strchr.S47
-rw-r--r--mdk-stage1/dietlibc/i386/unified.S13
9 files changed, 88 insertions, 68 deletions
diff --git a/mdk-stage1/dietlibc/i386/Makefile.add b/mdk-stage1/dietlibc/i386/Makefile.add
index 8d2914e66..b685cc360 100644
--- a/mdk-stage1/dietlibc/i386/Makefile.add
+++ b/mdk-stage1/dietlibc/i386/Makefile.add
@@ -1,3 +1,3 @@
CFLAGS+=-march=i386 -mcpu=i386 -Os -fomit-frame-pointer
-override VPATH=i386:syscalls.s:lib
+VPATH:=i386:syscalls.s:$(VPATH)
diff --git a/mdk-stage1/dietlibc/i386/__longjmp.S b/mdk-stage1/dietlibc/i386/__longjmp.S
index 312e01ed1..098275037 100644
--- a/mdk-stage1/dietlibc/i386/__longjmp.S
+++ b/mdk-stage1/dietlibc/i386/__longjmp.S
@@ -1,6 +1,4 @@
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <setjmp.h>
.text
.global __longjmp
diff --git a/mdk-stage1/dietlibc/i386/__testandset.S b/mdk-stage1/dietlibc/i386/__testandset.S
new file mode 100644
index 000000000..af7b4d5a0
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/__testandset.S
@@ -0,0 +1,8 @@
+.text
+.global __testandset
+__testandset:
+ xorl %eax, %eax
+ movl 0x4(%esp),%edx
+ incl %eax
+ xchgl %eax,(%edx)
+ ret
diff --git a/mdk-stage1/dietlibc/i386/clone.S b/mdk-stage1/dietlibc/i386/clone.S
new file mode 100644
index 000000000..ac02eb468
--- /dev/null
+++ b/mdk-stage1/dietlibc/i386/clone.S
@@ -0,0 +1,51 @@
+#include <asm/unistd.h>
+
+.text
+.weak clone
+clone:
+.global __clone
+__clone:
+ movl 4(%esp), %ecx /* have non null thread_funcion */
+ testl %ecx, %ecx
+ je .Lclone_error
+
+ movl 8(%esp), %ecx /* have non null child_stack pointer */
+ testl %ecx, %ecx
+ je .Lclone_error
+
+ /* put the parameter on thread stack */
+ subl $8, %ecx
+
+ movl 16(%esp), %eax /* arg */
+ movl %eax, 4(%ecx)
+
+ movl 4(%esp), %eax /* thread_func */
+ movl %eax, 0(%ecx)
+
+ /* the syscall */
+ pushl %ebx
+ movl 16(%esp), %ebx /* flags */
+ movl $__NR_clone, %eax
+ int $0x80
+ popl %ebx
+
+ testl %eax, %eax
+ jl .Lclone_error
+ je .Lstart_thread
+ ret
+
+.Lstart_thread:
+ xorl %ebp,%ebp
+ call *%ebx
+ pushl %eax
+ call _exit
+
+.Lclone_error:
+ negl %eax
+ pushl %eax
+ call __errno_location
+ popl %ecx
+ movl %ecx, (%eax)
+ xorl %eax, %eax
+ decl %eax
+ ret
diff --git a/mdk-stage1/dietlibc/i386/select.S b/mdk-stage1/dietlibc/i386/select.S
index 6e9fce8e3..9e7066eae 100644
--- a/mdk-stage1/dietlibc/i386/select.S
+++ b/mdk-stage1/dietlibc/i386/select.S
@@ -1,6 +1,3 @@
#include "syscalls.h"
-.text
-.weak select
-select:
-syscall(_newselect,select)
+syscall_weak(_newselect,select,__libc_select)
diff --git a/mdk-stage1/dietlibc/i386/setjmp.S b/mdk-stage1/dietlibc/i386/setjmp.S
index d7898e58f..9bfecf565 100644
--- a/mdk-stage1/dietlibc/i386/setjmp.S
+++ b/mdk-stage1/dietlibc/i386/setjmp.S
@@ -1,6 +1,4 @@
-#define _ASM
-#define _SETJMP_H
-#include <bits/setjmp.h>
+#include <setjmp.h>
/* setjmp for i386.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
diff --git a/mdk-stage1/dietlibc/i386/start.S b/mdk-stage1/dietlibc/i386/start.S
index 8a2ba7e38..167bb779c 100644
--- a/mdk-stage1/dietlibc/i386/start.S
+++ b/mdk-stage1/dietlibc/i386/start.S
@@ -6,19 +6,33 @@
_start:
#if 0
popl %ecx
- movl %esp, %edx
+ movl %esp, %esi
leal 4(%esp,%ecx,4),%eax
#else
movl (%esp),%ecx /* %ecx = argc */
- leal 4(%esp),%edx /* %edx = argv */
+ leal 4(%esp),%esi /* %esi = argv */
- leal 4(%edx,%ecx,4),%eax /* eax = 4*ecx+4 = envp */
+ leal 4(%esi,%ecx,4),%eax /* eax = 4*ecx+4 = envp */
#endif
pushl %eax
- pushl %edx
+ pushl %esi
pushl %ecx
movl %eax,environ
+#ifdef WANT_DYNAMIC
+/* in %edx we have the dynamic _fini ( register this if non null ) */
+ test %edx, %edx
+ je .Linit
+ push %edx
+ call atexit
+ pop %edx
+.Linit:
+ call _init
+ push $_fini
+ call atexit
+ pop %edx
+#endif
+
call main
pushl %eax
call exit
diff --git a/mdk-stage1/dietlibc/i386/strchr.S b/mdk-stage1/dietlibc/i386/strchr.S
deleted file mode 100644
index 0a2a5aa52..000000000
--- a/mdk-stage1/dietlibc/i386/strchr.S
+++ /dev/null
@@ -1,47 +0,0 @@
-#define NEW
-
-.text
-.global strchr
-strchr:
- mov %esi,%edx
- mov 0x4(%esp,1),%esi
- mov 0x8(%esp,1),%cl
- cld
-.L1:
- lods (%esi),%eax
- cmp %al,%cl
- jz .Lafound
- test %al,%al
- jz .Lnotfound
-
- cmp %ah,%cl
- jz .Lbfound
- test %ah,%ah
- jz .Lnotfound
-
- shr $16,%eax
- cmp %al,%cl
- jz .Lcfound
- test %al,%al
- jz .Lnotfound
-
- cmp %ah,%cl
- jz .Ldfound
- test %ah,%ah
-
- jnz .L1
-.Lnotfound:
- sub %eax,%eax
- mov %edx,%esi
- ret
-.Lafound:
- dec %esi
-.Lbfound:
- dec %esi
-.Lcfound:
- dec %esi
-.Ldfound:
- mov %esi,%eax
- mov %edx,%esi
- dec %eax
- ret
diff --git a/mdk-stage1/dietlibc/i386/unified.S b/mdk-stage1/dietlibc/i386/unified.S
index 740cb0ecc..f182bdb4b 100644
--- a/mdk-stage1/dietlibc/i386/unified.S
+++ b/mdk-stage1/dietlibc/i386/unified.S
@@ -3,15 +3,16 @@
.text
.global __unified_syscall
__unified_syscall:
- and $0xff,%eax
+ movzbl %al, %eax
push %edi
push %esi
push %ebx
- movl 0x10(%esp),%ebx
- movl 0x14(%esp),%ecx
- movl 0x18(%esp),%edx
- movl 0x1c(%esp),%esi
- movl 0x20(%esp),%edi
+ movl %esp,%edi
+ movl 0x10(%edi),%ebx
+ movl 0x14(%edi),%ecx
+ movl 0x18(%edi),%edx
+ movl 0x1c(%edi),%esi
+ movl 0x20(%edi),%edi
int $0x80
cmp $-124,%eax
jbe .Lnoerror