summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/i386
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2006-02-28 00:54:02 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2006-02-28 00:54:02 +0000
commit5eb1fae2a97ffc88d136502ace050662e57ef34a (patch)
treedf1087921ff9a88aa8a47ddfd55dc15a793fec56 /libc/sysdeps/linux/i386
parentdc0e95c67d350ca9e950abb5f75a63833380af9f (diff)
downloaduClibc-alpine-5eb1fae2a97ffc88d136502ace050662e57ef34a.tar.bz2
uClibc-alpine-5eb1fae2a97ffc88d136502ace050662e57ef34a.tar.xz
Merge from trunk.
Diffstat (limited to 'libc/sysdeps/linux/i386')
-rw-r--r--libc/sysdeps/linux/i386/__longjmp.S3
-rw-r--r--libc/sysdeps/linux/i386/__syscall_error.c52
-rw-r--r--libc/sysdeps/linux/i386/bits/syscalls.h46
-rw-r--r--libc/sysdeps/linux/i386/bits/uClibc_arch_features.h46
-rw-r--r--libc/sysdeps/linux/i386/brk.c10
-rw-r--r--libc/sysdeps/linux/i386/clone.S11
-rw-r--r--libc/sysdeps/linux/i386/mmap.S13
-rw-r--r--libc/sysdeps/linux/i386/sigaction.c24
-rw-r--r--libc/sysdeps/linux/i386/vfork.S16
9 files changed, 152 insertions, 69 deletions
diff --git a/libc/sysdeps/linux/i386/__longjmp.S b/libc/sysdeps/linux/i386/__longjmp.S
index 52f53bb68..d73a7cda2 100644
--- a/libc/sysdeps/linux/i386/__longjmp.S
+++ b/libc/sysdeps/linux/i386/__longjmp.S
@@ -17,6 +17,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <features.h>
#define _ASM
#define _SETJMP_H
#include <bits/setjmp.h>
@@ -38,3 +39,5 @@ __longjmp:
/* Jump to saved PC. */
jmp *%edx
.size __longjmp,.-__longjmp
+
+libc_hidden_def(__longjmp)
diff --git a/libc/sysdeps/linux/i386/__syscall_error.c b/libc/sysdeps/linux/i386/__syscall_error.c
index 133500cb6..7509d4409 100644
--- a/libc/sysdeps/linux/i386/__syscall_error.c
+++ b/libc/sysdeps/linux/i386/__syscall_error.c
@@ -1,46 +1,36 @@
/* Wrapper for setting errno.
- Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <features.h>
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
/* This routine is jumped to by all the syscall handlers, to stash
* an error number into errno. */
-/* This version uses a lot of magic and relies heavily on x86
- * calling convention ... The advantage is that this is the same
+/* This version uses a lot of magic and relies heavily on x86
+ * calling convention ... The advantage is that this is the same
* size as the previous __syscall_error() but all the .S functions
* need just one instruction.
*
- * Local .S files have to set %eax to the negative errno value
- * and then jump to this function. The neglected return to caller
- * and return value of -1 is taken care of here so we don't have to
+ * Local .S files have to set %eax to the negative errno value
+ * and then jump to this function. The neglected return to caller
+ * and return value of -1 is taken care of here so we don't have to
* worry about it in the .S functions.
*
- * We have to stash the errno from %eax in a local stack var because
+ * We have to stash the errno from %eax in a local stack var because
* __set_errno will prob call a function thus clobbering %eax on us.
*/
-int attribute_hidden __syscall_error(void)
+
+#include <errno.h>
+#include <features.h>
+
+int __syscall_error(void) attribute_hidden;
+int __syscall_error(void)
{
- register int edx asm("%edx");
- asm("mov %eax, %edx");
- asm("negl %edx");
- __set_errno(edx);
+ register int edx __asm__ ("%edx");
+ __asm__ ("mov %eax, %edx\n\t"
+ "negl %edx");
+ __set_errno (edx);
return -1;
}
diff --git a/libc/sysdeps/linux/i386/bits/syscalls.h b/libc/sysdeps/linux/i386/bits/syscalls.h
index 6ad3b1dd9..857491f06 100644
--- a/libc/sysdeps/linux/i386/bits/syscalls.h
+++ b/libc/sysdeps/linux/i386/bits/syscalls.h
@@ -20,7 +20,13 @@
/* We need some help from the assembler to generate optimal code. We
define some macros here which later will be used. */
-asm (".L__X'%ebx = 1\n\t"
+
+#if defined __SUPPORT_LD_DEBUG__ && defined __DOMULTI__
+#error LD debugging and DOMULTI are incompatible
+#endif
+
+#ifdef __DOMULTI__
+__asm__ (".L__X'%ebx = 1\n\t"
".L__X'%ecx = 2\n\t"
".L__X'%edx = 2\n\t"
".L__X'%eax = 3\n\t"
@@ -56,7 +62,41 @@ asm (".L__X'%ebx = 1\n\t"
".endif\n\t"
".endm\n\t"
".endif\n\t");
-
+#else
+__asm__ (".L__X'%ebx = 1\n\t"
+ ".L__X'%ecx = 2\n\t"
+ ".L__X'%edx = 2\n\t"
+ ".L__X'%eax = 3\n\t"
+ ".L__X'%esi = 3\n\t"
+ ".L__X'%edi = 3\n\t"
+ ".L__X'%ebp = 3\n\t"
+ ".L__X'%esp = 3\n\t"
+ ".macro bpushl name reg\n\t"
+ ".if 1 - \\name\n\t"
+ ".if 2 - \\name\n\t"
+ "pushl %ebx\n\t"
+ ".else\n\t"
+ "xchgl \\reg, %ebx\n\t"
+ ".endif\n\t"
+ ".endif\n\t"
+ ".endm\n\t"
+ ".macro bpopl name reg\n\t"
+ ".if 1 - \\name\n\t"
+ ".if 2 - \\name\n\t"
+ "popl %ebx\n\t"
+ ".else\n\t"
+ "xchgl \\reg, %ebx\n\t"
+ ".endif\n\t"
+ ".endif\n\t"
+ ".endm\n\t"
+ ".macro bmovl name reg\n\t"
+ ".if 1 - \\name\n\t"
+ ".if 2 - \\name\n\t"
+ "movl \\reg, %ebx\n\t"
+ ".endif\n\t"
+ ".endif\n\t"
+ ".endm\n\t");
+#endif
#undef _syscall0
#define _syscall0(type,name) \
@@ -112,7 +152,7 @@ return (type) (INLINE_SYSCALL(name, 6, arg1, arg2, arg3, arg4, arg5, arg6)); \
#define INLINE_SYSCALL(name, nr, args...) \
({ \
unsigned int resultvar; \
- asm volatile ( \
+ __asm__ __volatile__ ( \
LOADARGS_##nr \
"movl %1, %%eax\n\t" \
"int $0x80\n\t" \
diff --git a/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h b/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h
new file mode 100644
index 000000000..718ab2a9c
--- /dev/null
+++ b/libc/sysdeps/linux/i386/bits/uClibc_arch_features.h
@@ -0,0 +1,46 @@
+/*
+ * Track misc arch-specific features that aren't config options
+ */
+
+#ifndef _BITS_UCLIBC_ARCH_FEATURES_H
+#define _BITS_UCLIBC_ARCH_FEATURES_H
+
+/* instruction used when calling abort() to kill yourself */
+#define __UCLIBC_ABORT_INSTRUCTION__ "hlt"
+
+/* can your target use syscall6() for mmap ? */
+#undef __UCLIBC_MMAP_HAS_6_ARGS__
+
+/* does your target use syscall4() for truncate64 ? (32bit arches only) */
+#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
+
+/* does your target have a broken create_module() ? */
+#define __UCLIBC_BROKEN_CREATE_MODULE__
+
+/* does your target have to worry about older [gs]etrlimit() ? */
+#define __UCLIBC_HANDLE_OLDER_RLIMIT__
+
+/* does your target prefix all symbols with an _ ? */
+#define __UCLIBC_NO_UNDERSCORES__
+
+/* does your target have an asm .set ? */
+#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
+
+/* define if target doesn't like .global */
+#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
+
+/* define if target supports .weak */
+#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
+
+/* define if target supports .weakext */
+#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__
+
+/* needed probably only for ppc64 */
+#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__
+
+/* define if target supports IEEE signed zero floats */
+#define __UCLIBC_HAVE_SIGNED_ZERO__
+
+#define internal_function __attribute__ ((regparm (3), stdcall))
+
+#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
diff --git a/libc/sysdeps/linux/i386/brk.c b/libc/sysdeps/linux/i386/brk.c
index 5790e2fca..6a654f0d0 100644
--- a/libc/sysdeps/linux/i386/brk.c
+++ b/libc/sysdeps/linux/i386/brk.c
@@ -21,15 +21,19 @@
#include <unistd.h>
#include <sys/syscall.h>
+libc_hidden_proto(brk)
/* This must be initialized data because commons can't have aliases. */
+extern void *__curbrk;
+libc_hidden_proto(__curbrk)
void *__curbrk = 0;
+libc_hidden_data_def(__curbrk)
-int attribute_hidden __brk (void *addr)
+int brk (void *addr)
{
void *__unbounded newbrk, *__unbounded scratch;
- asm ("movl %%ebx, %1\n" /* Save %ebx in scratch register. */
+ __asm__ ("movl %%ebx, %1\n" /* Save %ebx in scratch register. */
"movl %3, %%ebx\n" /* Put ADDR in %ebx to be syscall arg. */
"int $0x80 # %2\n" /* Perform the system call. */
"movl %1, %%ebx\n" /* Restore %ebx from scratch register. */
@@ -46,4 +50,4 @@ int attribute_hidden __brk (void *addr)
return 0;
}
-strong_alias(__brk,brk)
+libc_hidden_def(brk)
diff --git a/libc/sysdeps/linux/i386/clone.S b/libc/sysdeps/linux/i386/clone.S
index 35a4e5b7f..14fc25ca1 100644
--- a/libc/sysdeps/linux/i386/clone.S
+++ b/libc/sysdeps/linux/i386/clone.S
@@ -42,9 +42,9 @@
#define CTID TLS+PTR_SIZE
.text
-.global __clone
-.type __clone,%function
-__clone:
+.global clone
+.type clone,%function
+clone:
/* Sanity check arguments. */
movl $-EINVAL,%eax
@@ -120,7 +120,4 @@ __clone:
__error:
jmp __syscall_error
-.size __clone,.-__clone
-
-.weak clone
- clone = __clone
+.size clone,.-clone
diff --git a/libc/sysdeps/linux/i386/mmap.S b/libc/sysdeps/linux/i386/mmap.S
index 4c4723dff..fe7a7986c 100644
--- a/libc/sysdeps/linux/i386/mmap.S
+++ b/libc/sysdeps/linux/i386/mmap.S
@@ -21,13 +21,10 @@
#include <bits/errno.h>
#include <sys/syscall.h>
-.global mmap
-.set mmap,__mmap
.text
-.global __mmap
-.hidden __mmap
-.type __mmap,%function
-__mmap:
+.global mmap
+.type mmap,%function
+mmap:
/* Save registers. */
movl %ebx, %edx
@@ -49,4 +46,6 @@ __mmap:
/* Successful; return the syscall's value. */
ret
-.size __mmap,.-__mmap
+.size mmap,.-mmap
+
+libc_hidden_def(mmap)
diff --git a/libc/sysdeps/linux/i386/sigaction.c b/libc/sysdeps/linux/i386/sigaction.c
index 335fc9a27..341c0d16b 100644
--- a/libc/sysdeps/linux/i386/sigaction.c
+++ b/libc/sysdeps/linux/i386/sigaction.c
@@ -27,10 +27,13 @@
#define SA_RESTORER 0x04000000
+extern __typeof(sigaction) __libc_sigaction;
#if defined __NR_rt_sigaction
-extern void restore_rt (void) asm ("__restore_rt") attribute_hidden;
-extern void restore (void) asm ("__restore") attribute_hidden;
+libc_hidden_proto(memcpy)
+
+extern void restore_rt (void) __asm__ ("__restore_rt") attribute_hidden;
+extern void restore (void) __asm__ ("__restore") attribute_hidden;
/* If ACT is not NULL, change the action for SIG to *ACT.
If OACT is not NULL, put the old action for SIG in *OACT. */
@@ -48,7 +51,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
if (act) {
kact.k_sa_handler = act->sa_handler;
- __memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
+ memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
kact.sa_flags = act->sa_flags;
kact.sa_flags = act->sa_flags | SA_RESTORER;
@@ -63,7 +66,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
if (oact && result >= 0) {
oact->sa_handler = koact.k_sa_handler;
- __memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask));
+ memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask));
oact->sa_flags = koact.sa_flags;
oact->sa_restorer = koact.sa_restorer;
}
@@ -72,7 +75,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
#else
-extern void restore (void) asm ("__restore") attribute_hidden;
+extern void restore (void) __asm__ ("__restore") attribute_hidden;
/* If ACT is not NULL, change the action for SIG to *ACT.
If OACT is not NULL, put the old action for SIG in *OACT. */
@@ -95,7 +98,7 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
kact.sa_restorer = &restore;
}
- asm volatile ("pushl %%ebx\n"
+ __asm__ __volatile__ ("pushl %%ebx\n"
"movl %2, %%ebx\n"
"int $0x80\n"
"popl %%ebx"
@@ -121,8 +124,9 @@ int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oa
#endif
#ifndef LIBC_SIGACTION
-hidden_weak_alias(__libc_sigaction,__sigaction)
+libc_hidden_proto(sigaction)
weak_alias(__libc_sigaction,sigaction)
+libc_hidden_weak(sigaction)
#endif
@@ -138,7 +142,7 @@ weak_alias(__libc_sigaction,sigaction)
#define RESTORE(name, syscall) RESTORE2 (name, syscall)
#define RESTORE2(name, syscall) \
-asm \
+__asm__ \
( \
".text\n" \
" .align 16\n" \
@@ -152,10 +156,11 @@ asm \
RESTORE (restore_rt, __NR_rt_sigreturn)
#endif
+#ifdef __NR_sigreturn
/* For the boring old signals. */
# undef RESTORE2
# define RESTORE2(name, syscall) \
-asm \
+__asm__ \
( \
".text\n" \
" .align 8\n" \
@@ -166,3 +171,4 @@ asm \
);
RESTORE (restore, __NR_sigreturn)
+#endif
diff --git a/libc/sysdeps/linux/i386/vfork.S b/libc/sysdeps/linux/i386/vfork.S
index 18a8e5dfa..543da6e90 100644
--- a/libc/sysdeps/linux/i386/vfork.S
+++ b/libc/sysdeps/linux/i386/vfork.S
@@ -1,18 +1,15 @@
/*
- * June 3, 2003 Erik Andersen
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
*
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include <features.h>
#include <sys/syscall.h>
#ifndef __NR_vfork
-
/* No vfork so use fork instead */
-hidden_strong_alias(__fork,__vfork)
-weak_alias(vfork,__libc_fork)
-
-#else
+# define __NR_vfork __NR_fork
+#endif
.text
.global __vfork
@@ -30,5 +27,6 @@ __vfork:
ret
.size __vfork,.-__vfork
-#endif
-strong_alias(__vfork,vfork)
+
+weak_alias(__vfork,vfork)
+libc_hidden_weak(vfork)