From d2f5be2a1235061b46c51d7530264d086eca46ef Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 8 Sep 1995 17:02:25 +0000 Subject: Document new files for Linux i386/ELF port. Fri Sep 8 16:32:12 1995 Ulrich Drepper * sysdeps/unix/sysv/linux/Implies, sysdeps/unix/sysv/linux/Makefile, sysdeps/unix/sysv/linux/Subdirs, sysdeps/unix/sysv/linux/accept.S, sysdeps/unix/sysv/linux/adjtime.c, sysdeps/unix/sysv/linux/adjtimex.S, sysdeps/unix/sysv/linux/bind.S, sysdeps/unix/sysv/linux/connect.S, sysdeps/unix/sysv/linux/direct.h, sysdeps/unix/sysv/linux/dl-machine.h, sysdeps/unix/sysv/linux/errnos.h, sysdeps/unix/sysv/linux/fork.S, sysdeps/unix/sysv/linux/gethostid.c, sysdeps/unix/sysv/linux/gethostname.C, sysdeps/unix/sysv/linux/getpeername.S, sysdeps/unix/sysv/linux/getpgid.S, sysdeps/unix/sysv/linux/getpgrp.S, sysdeps/unix/sysv/linux/getsockname.S, sysdeps/unix/sysv/linux/getsockopt.S, sysdeps/unix/sysv/linux/gtty.S, sysdeps/unix/sysv/linux/listen.S, sysdeps/unix/sysv/linux/local_lim.h, sysdeps/unix/sysv/linux/madvise.c, sysdeps/unix/sysv/linux/msgctl.c, sysdeps/unix/sysv/linux/msgget.c, sysdeps/unix/sysv/linux/msgrcv.c, sysdeps/unix/sysv/linux/msgsnd.c, sysdeps/unix/sysv/linux/pipe.S, sysdeps/unix/sysv/linux/poll.c, sysdeps/unix/sysv/linux/readv.c, sysdeps/unix/sysv/linux/recv.S, sysdeps/unix/sysv/linux/recvfrom.S, sysdeps/unix/sysv/linux/recvmsg.S, sysdeps/unix/sysv/linux/semctl.c, sysdeps/unix/sysv/linux/semget.c, sysdeps/unix/sysv/linux/semop.c, sysdeps/unix/sysv/linux/send.S, sysdeps/unix/sysv/linux/sendmsg.S, sysdeps/unix/sysv/linux/sendto.S, sysdeps/unix/sysv/linux/setegid.c, sysdeps/unix/sysv/linux/seteuid.c, sysdeps/unix/sysv/linux/sethostid.c, sysdeps/unix/sysv/linux/setpgid.c, sysdeps/unix/sysv/linux/setpgrp.c, sysdeps/unix/sysv/linux/setsid.S, sysdeps/unix/sysv/linux/setsockopt.S, sysdeps/unix/sysv/linux/settimeofday.S, sysdeps/unix/sysv/linux/shmat.c, sysdeps/unix/sysv/linux/shmctl.c, sysdeps/unix/sysv/linux/shmdt.c, sysdeps/unix/sysv/linux/shmget.c, sysdeps/unix/sysv/linux/shutdown.S, sysdeps/unix/sysv/linux/sigaction.S, sysdeps/unix/sysv/linux/signal.S, sysdeps/unix/sysv/linux/sigpending.S, sysdeps/unix/sysv/linux/sigset.h, sysdeps/unix/sysv/linux/sockaddrcom.h, sysdeps/unix/sysv/linux/socketpair.S, sysdeps/unix/sysv/linux/speed.c, sysdeps/unix/sysv/linux/statbuf.h, sysdeps/unix/sysv/linux/stty.S, sysdeps/unix/sysv/linux/syscall.h, sysdeps/unix/sysv/linux/sysconf.c, sysdeps/unix/sysv/linux/tcdrain.c, sysdeps/unix/sysv/linux/tcflow.c, sysdeps/unix/sysv/linux/tcflush.c, sysdeps/unix/sysv/linux/tcgetattr.c, sysdeps/unix/sysv/linux/tcsetattr.c, sysdeps/unix/sysv/linux/termbits.h, sysdeps/unix/sysv/linux/ualarm.c, sysdeps/unix/sysv/linux/ulimit.c, sysdeps/unix/sysv/linux/usleep.c, sysdeps/unix/sysv/linux/utsnamelen.h, sysdeps/unix/sysv/linux/vfork.c, sysdeps/unix/sysv/linux/wait.c, sysdeps/unix/sysv/linux/wait4.S, sysdeps/unix/sysv/linux/waitpid.c, sysdeps/unix/sysv/linux/writev.c: New Linux/ELF specific, architecture independent files. sysdeps/unix/sysv/linux/i386/Dist, sysdeps/unix/sysv/linux/i386/Makefile, sysdeps/unix/sysv/linux/i386/brk.S, sysdeps/unix/sysv/linux/i386/fcntlbits.h, sysdeps/unix/sysv/linux/i386/fpu_control.c, sysdeps/unix/sysv/linux/i386/fpu_control.h, sysdeps/unix/sysv/linux/i386/fstat.S, sysdeps/unix/sysv/linux/i386/fxstat.S, sysdeps/unix/sysv/linux/i386/ieee_fpu.c, sysdeps/unix/sysv/linux/i386/init-first.S, sysdeps/unix/sysv/linux/i386/ipc.S, sysdeps/unix/sysv/linux/i386/lstat.S, sysdeps/unix/sysv/linux/i386/lxstat.S, sysdeps/unix/sysv/linux/i386/mknod.S, sysdeps/unix/sysv/linux/i386/mmap.S, sysdeps/unix/sysv/linux/i386/sbrk.S, sysdeps/unix/sysv/linux/i386/setfpucw.c, sysdeps/unix/sysv/linux/i386/signum.h, sysdeps/unix/sysv/linux/i386/socket.S, sysdeps/unix/sysv/linux/i386/stat.S, sysdeps/unix/sysv/linux/i386/syscall.S, sysdeps/unix/sysv/linux/i386/sysdep.S, sysdeps/unix/sysv/linux/i386/sysdep.h, sysdeps/unix/sysv/linux/i386/xmknod.S, sysdeps/unix/sysv/linux/i386/xstat.S: New Linux i386/ELF specific files. sysdeps/unix/sysv/linux/sys/ipc_buf.h, sysdeps/unix/sysv/linux/sys/mman.h, sysdeps/unix/sysv/linux/sys/msq_buf.h, sysdeps/unix/sysv/linux/sys/sem_buf.h, sysdeps/unix/sysv/linux/sys/shm_buf.h, sysdeps/unix/sysv/linux/sys/socketcall.h, sysdeps/unix/sysv/linux/sys/timex.h: New Linux/ELF specific, architecture independent header files. --- sysdeps/unix/sysv/linux/i386/Dist | 1 + sysdeps/unix/sysv/linux/i386/Makefile | 7 ++ sysdeps/unix/sysv/linux/i386/brk.S | 60 +++++++++++++ sysdeps/unix/sysv/linux/i386/fcntlbits.h | 26 ++++++ sysdeps/unix/sysv/linux/i386/fpu_control.c | 20 +++++ sysdeps/unix/sysv/linux/i386/fpu_control.h | 100 +++++++++++++++++++++ sysdeps/unix/sysv/linux/i386/fstat.S | 4 + sysdeps/unix/sysv/linux/i386/fxstat.S | 4 + sysdeps/unix/sysv/linux/i386/ieee_fpu.c | 22 +++++ sysdeps/unix/sysv/linux/i386/init-first.S | 84 ++++++++++++++++++ sysdeps/unix/sysv/linux/i386/ipc.S | 22 +++++ sysdeps/unix/sysv/linux/i386/lstat.S | 4 + sysdeps/unix/sysv/linux/i386/lxstat.S | 4 + sysdeps/unix/sysv/linux/i386/mknod.S | 39 +++++++++ sysdeps/unix/sysv/linux/i386/mmap.S | 45 ++++++++++ sysdeps/unix/sysv/linux/i386/sbrk.S | 82 ++++++++++++++++++ sysdeps/unix/sysv/linux/i386/setfpucw.c | 43 +++++++++ sysdeps/unix/sysv/linux/i386/signum.h | 66 ++++++++++++++ sysdeps/unix/sysv/linux/i386/socket.S | 60 +++++++++++++ sysdeps/unix/sysv/linux/i386/stat.S | 38 ++++++++ sysdeps/unix/sysv/linux/i386/syscall.S | 31 +++++++ sysdeps/unix/sysv/linux/i386/sysdep.S | 40 +++++++++ sysdeps/unix/sysv/linux/i386/sysdep.h | 135 +++++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/i386/xmknod.S | 49 +++++++++++ sysdeps/unix/sysv/linux/i386/xstat.S | 51 +++++++++++ 25 files changed, 1037 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/i386/Dist create mode 100644 sysdeps/unix/sysv/linux/i386/Makefile create mode 100644 sysdeps/unix/sysv/linux/i386/brk.S create mode 100644 sysdeps/unix/sysv/linux/i386/fcntlbits.h create mode 100644 sysdeps/unix/sysv/linux/i386/fpu_control.c create mode 100644 sysdeps/unix/sysv/linux/i386/fpu_control.h create mode 100644 sysdeps/unix/sysv/linux/i386/fstat.S create mode 100644 sysdeps/unix/sysv/linux/i386/fxstat.S create mode 100644 sysdeps/unix/sysv/linux/i386/ieee_fpu.c create mode 100644 sysdeps/unix/sysv/linux/i386/init-first.S create mode 100644 sysdeps/unix/sysv/linux/i386/ipc.S create mode 100644 sysdeps/unix/sysv/linux/i386/lstat.S create mode 100644 sysdeps/unix/sysv/linux/i386/lxstat.S create mode 100644 sysdeps/unix/sysv/linux/i386/mknod.S create mode 100644 sysdeps/unix/sysv/linux/i386/mmap.S create mode 100644 sysdeps/unix/sysv/linux/i386/sbrk.S create mode 100644 sysdeps/unix/sysv/linux/i386/setfpucw.c create mode 100644 sysdeps/unix/sysv/linux/i386/signum.h create mode 100644 sysdeps/unix/sysv/linux/i386/socket.S create mode 100644 sysdeps/unix/sysv/linux/i386/stat.S create mode 100644 sysdeps/unix/sysv/linux/i386/syscall.S create mode 100644 sysdeps/unix/sysv/linux/i386/sysdep.S create mode 100644 sysdeps/unix/sysv/linux/i386/sysdep.h create mode 100644 sysdeps/unix/sysv/linux/i386/xmknod.S create mode 100644 sysdeps/unix/sysv/linux/i386/xstat.S (limited to 'sysdeps/unix/sysv/linux/i386') diff --git a/sysdeps/unix/sysv/linux/i386/Dist b/sysdeps/unix/sysv/linux/i386/Dist new file mode 100644 index 0000000000..91365adfc4 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/Dist @@ -0,0 +1 @@ +fxstat.S lxstat.S xmknod.S xstat.S diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile new file mode 100644 index 0000000000..76d295e048 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/Makefile @@ -0,0 +1,7 @@ +ifeq ($(subdir), misc) +sysdep_routines := $(sysdep_routines) fpu_control setfpucw + +extra-libs := $(extra-libs) libieee +libieee-routines := ieee_fpu +libieee-inhibit-o := .so .po +endif diff --git a/sysdeps/unix/sysv/linux/i386/brk.S b/sysdeps/unix/sysv/linux/i386/brk.S new file mode 100644 index 0000000000..ef2f55db97 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/brk.S @@ -0,0 +1,60 @@ +/* Copyright (C) 1991, 1992, 1993, 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +.data +.globl C_SYMBOL_NAME(__curbrk) +C_LABEL(__curbrk) +#ifdef PIC + .long 0 +#else +# ifdef HAVE_GNU_LD + .long C_SYMBOL_NAME(_end) +# else + .long C_SYMBOL_NAME(end) +# endif +#endif + +.text +.globl C_SYMBOL_NAME(syscall_error) + +ENTRY (__brk) + movl %ebx, %edx + movl $SYS_ify(brk), %eax + movl 4(%esp), %ebx + int $0x80 + movl %edx, %ebx + + cmpl 4(%esp), %eax + jne JUMPTARGET(syscall_error) + +#ifdef PIC + /* Standard PIC nonsense to store into `__curbrk' through the GOT. */ + call here +here: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-here], %ecx + movl C_SYMBOL_NAME(__curbrk@GOT)(%ecx), %ecx + movl %eax, (%ecx) +#else + movl %eax, C_SYMBOL_NAME(__curbrk) +#endif + xorl %eax, %eax + ret + +weak_alias (__brk, brk) diff --git a/sysdeps/unix/sysv/linux/i386/fcntlbits.h b/sysdeps/unix/sysv/linux/i386/fcntlbits.h new file mode 100644 index 0000000000..8d92ac02b0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/fcntlbits.h @@ -0,0 +1,26 @@ +/* O_*, F_*, FD_* bit values for Linux. +Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#ifndef _FCNTLBITS_H +#define _FCNTLBITS_H 1 + +#include +#include + +#endif /* fcntlbits.h */ diff --git a/sysdeps/unix/sysv/linux/i386/fpu_control.c b/sysdeps/unix/sysv/linux/i386/fpu_control.c new file mode 100644 index 0000000000..79933b90eb --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/fpu_control.c @@ -0,0 +1,20 @@ +/* Default control word for ix86 FPU. +Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +unsigned short ___fpu_control = 0; diff --git a/sysdeps/unix/sysv/linux/i386/fpu_control.h b/sysdeps/unix/sysv/linux/i386/fpu_control.h new file mode 100644 index 0000000000..28f3eeba7b --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/fpu_control.h @@ -0,0 +1,100 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Olaf Flebbe. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#ifndef _FPU_CONTROL_H +#define _FPU_CONTROL_H + +/* Here is the dirty part. Settup up your 387 through the control word + * (cw) register. + * + * 15-13 12 11-10 9-8 7-6 5 4 3 2 1 0 + * | reserved | IC | RC | PC | reserved | PM | UM | OM | ZM | DM | IM + * + * IM: Invalid operation mask + * DM: Denormalized operand mask + * ZM: Zero-divide mask + * OM: Overflow mask + * UM: Underflow mask + * PM: Precision (inexact result) mask + * + * Mask bit is 1 means no interrupt. + * + * PC: Precision control + * 11 - round to extended precision + * 10 - round to double precision + * 00 - round to single precision + * + * RC: Rounding control + * 00 - rounding to nearest + * 01 - rounding down (toward - infinity) + * 10 - rounding up (toward + infinity) + * 11 - rounding toward zero + * + * IC: Infinity control + * That is for 8087 and 80287 only. + * + * The hardware default is 0x037f. I choose 0x1372. + */ + +#include + +/* masking of interrupts */ +#define _FPU_MASK_IM 0x01 +#define _FPU_MASK_DM 0x02 +#define _FPU_MASK_ZM 0x04 +#define _FPU_MASK_OM 0x08 +#define _FPU_MASK_UM 0x10 +#define _FPU_MASK_PM 0x20 + +/* precision control */ +#define _FPU_EXTENDED 0x300 /* RECOMMENDED */ +#define _FPU_DOUBLE 0x200 +#define _FPU_SINGLE 0x0 /* DO NOT USE */ + +/* rounding control */ +#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */ +#define _FPU_RC_DOWN 0x400 +#define _FPU_RC_UP 0x800 +#define _FPU_RC_ZERO 0xC00 + +#define _FPU_RESERVED 0xF0C0 /* Reserved bits in cw */ + + +/* Now two recommended cw */ + +/* Linux default: + - extended precision + - rounding to nearest + - exceptions on overflow, zero divide and NaN */ +#define _FPU_DEFAULT 0x1372 + +/* IEEE: same as above, but exceptions */ +#define _FPU_IEEE 0x137f + +/* private namespace. It should only be used in init-first.o. */ +extern unsigned short __fpu_control; + +__BEGIN_DECLS + +/* called in init-first.o. It can be used to manipulate 387 control word. */ +extern void __setfpucw __P ((unsigned short)); + +__END_DECLS + +#endif /* fpu_control.h */ diff --git a/sysdeps/unix/sysv/linux/i386/fstat.S b/sysdeps/unix/sysv/linux/i386/fstat.S new file mode 100644 index 0000000000..434ad4ad64 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/fstat.S @@ -0,0 +1,4 @@ +#define __stat __fstat +#define stat fstat +#define __xstat __fxstat +#include "stat.S" diff --git a/sysdeps/unix/sysv/linux/i386/fxstat.S b/sysdeps/unix/sysv/linux/i386/fxstat.S new file mode 100644 index 0000000000..c4db088abe --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/fxstat.S @@ -0,0 +1,4 @@ +#define __xstat __fxstat +#define _xstat _fxstat +#define stat fstat +#include "xstat.S" diff --git a/sysdeps/unix/sysv/linux/i386/ieee_fpu.c b/sysdeps/unix/sysv/linux/i386/ieee_fpu.c new file mode 100644 index 0000000000..4a0bf31e7c --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/ieee_fpu.c @@ -0,0 +1,22 @@ +/* Default control word for ix86 FPU. +Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include + +unsigned short ___fpu_control = _FPU_IEEE; diff --git a/sysdeps/unix/sysv/linux/i386/init-first.S b/sysdeps/unix/sysv/linux/i386/init-first.S new file mode 100644 index 0000000000..3c0c185fb7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/init-first.S @@ -0,0 +1,84 @@ +/* Initialization code run first thing by the ELF startup code. + For i386/Linux. +Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include + + .text + + /* Called from start.S. Not: there is no value in %ebx. */ + +ENTRY (__libc_init_first) + + /* Make sure we are not using iBSC2 personality. */ + movl $SYS_ify (personality), %eax + xorl %ebx, %ebx + int $0x80 + +#ifdef PIC + /* Set control work of FPU. */ + call .L0 +.L0: popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-.L0], %ebx + movzwl C_SYMBOL_NAME(___fpu_control@GOT)(%ebx), %eax +#else + movzwl ___fpu_control, %eax +#endif + pushl %eax + call JUMPTARGET(__setfpucw) + addl $4, %esp + + /* That is all for now. */ + ret + + + /* This is only a dummy function for the list below. */ + .type _dummy_exit, @function +C_LABEL(_dummy_exit) + ret + + + .section .init,"ax",@progbits + movl 16(%ebp), %edx /* envp */ + movl 12(%ebp), %ecx /* argv */ + movl 8(%ebp), %eax /* argc */ + pushl %edx + pushl %ecx + pushl %eax + + call JUMPTARGET(__libc_init) + + addl $12, %esp + + + /* Make sure __libc_subinit section is always present. */ + .section __libc_subinit, "a", @progbits + .align 4 + .type __elf_set___libc_subinit_element__dummy_exit__, @object + .size __elf_set___libc_subinit_element__dummy_exit__, 4 +__elf_set___libc_subinit_element__dummy_exit__: + .long _dummy_exit + + /* Make sure __libc_atexit section is always present. */ + .section __libc_atexit, "a", @progbits + .align 4 + .type __elf_set___libc_atexit_element__dummy_exit__, @object + .size __elf_set___libc_atexit_element__dummy_exit__, 4 +__elf_set___libc_atexit_element__dummy_exit__: + .long _dummy_exit diff --git a/sysdeps/unix/sysv/linux/i386/ipc.S b/sysdeps/unix/sysv/linux/i386/ipc.S new file mode 100644 index 0000000000..bb523a20dc --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/ipc.S @@ -0,0 +1,22 @@ +/* Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +SYSCALL__ (ipc, 5) + ret diff --git a/sysdeps/unix/sysv/linux/i386/lstat.S b/sysdeps/unix/sysv/linux/i386/lstat.S new file mode 100644 index 0000000000..9135c6bfe1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/lstat.S @@ -0,0 +1,4 @@ +#define __stat __lstat +#define stat lstat +#define __xstat __lxstat +#include "stat.S" diff --git a/sysdeps/unix/sysv/linux/i386/lxstat.S b/sysdeps/unix/sysv/linux/i386/lxstat.S new file mode 100644 index 0000000000..fee635be78 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/lxstat.S @@ -0,0 +1,4 @@ +#define __xstat __lxstat +#define _xstat _lxstat +#define stat lstat +#include "xstat.S" diff --git a/sysdeps/unix/sysv/linux/i386/mknod.S b/sysdeps/unix/sysv/linux/i386/mknod.S new file mode 100644 index 0000000000..7faf89d74b --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/mknod.S @@ -0,0 +1,39 @@ +/* Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +/* In Linux the `mknod' call is actually done by a emulation of the + `xmknod' system call, which takes an additional first argument + giving a version number for the interface. This macro gives the + Linux version number that corresponds to the modern interface. */ +#define _MKNOD_VER 1 + +ENTRY (__mknod) + movl 12(%esp), %edx + movl 8(%esp), %ecx + movl 4(%esp), %eax + pushl %edx + pushl %ecx + pushl %eax + pushl $_MKNOD_VER /* Push extra first arg to syscall. */ + call JUMPTARGET(__xmknod) + addl $16, %esp /* Correct version parameter offset. */ + ret + +weak_alias (__mknod, mknod) diff --git a/sysdeps/unix/sysv/linux/i386/mmap.S b/sysdeps/unix/sysv/linux/i386/mmap.S new file mode 100644 index 0000000000..96ea870846 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/mmap.S @@ -0,0 +1,45 @@ +/* Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +.globl syscall_error + +ENTRY (__mmap) + + /* Save registers. */ + movl %ebx, %edx + + movl $SYS_ify(mmap), %eax /* System call number in %eax. */ + + lea 4(%esp), %ebx /* Address of args is 1st arg. */ + + /* Do the system call trap. */ + int $0x80 + + /* Restore registers. */ + movl %edx, %ebx + + /* %eax is < 0 if there was an error. */ + testl %eax, %eax + jl JUMPTARGET(syscall_error) + + /* Successful; return the syscall's value. */ + ret + +weak_alias (__mmap, mmap) diff --git a/sysdeps/unix/sysv/linux/i386/sbrk.S b/sysdeps/unix/sysv/linux/i386/sbrk.S new file mode 100644 index 0000000000..7a0e940cfe --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/sbrk.S @@ -0,0 +1,82 @@ +/* Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +.data +.globl C_SYMBOL_NAME(__curbrk) + +.text +.globl C_SYMBOL_NAME(syscall_error) + +ENTRY (__sbrk) + + movl %ebx, %edx + +#ifdef PIC + /* Standard PIC nonsense to access `__curbrk' through the GOT. */ + call .L0 +.L0: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-.L0], %ecx + + movl C_SYMBOL_NAME(__curbrk@GOT)(%ecx), %ecx + movl (%ecx), %ebx + movl %ebx, %eax + testl %ebx, %ebx + jne .L1 + + /* We have to initialize `__curbrk' first. */ + movl $SYS_ify(brk), %eax + int $0x80 + + movl %eax, (%ecx) + movl %eax, %ebx + .align 16, 0x90 + +.L1: +#else + movl C_SYMBOL_NAME(__curbrk), %ebx + movl %ebx, %eax +#endif + + addl 4(%esp), %ebx + cmpl %ebx, %eax + je .L2 + + movl $SYS_ify(brk), %eax + int $0x80 + + cmpl %eax, %ebx + jne .L3 + +#ifdef PIC + xchgl %eax, (%ecx) +#else + xchgl %eax, C_SYMBOL_NAME(__curbrk) +#endif + +.L2: + movl %edx, %ebx + ret + + .align 16 +.L3: + movl %edx, %ebx + jmp JUMPTARGET(syscall_error) + +weak_alias (__sbrk, sbrk) diff --git a/sysdeps/unix/sysv/linux/i386/setfpucw.c b/sysdeps/unix/sysv/linux/i386/setfpucw.c new file mode 100644 index 0000000000..329573df6a --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/setfpucw.c @@ -0,0 +1,43 @@ +/* Copyright (C) 1993 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Olaf Flebbe. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include + +void +__setfpucw (fpu_control) + unsigned short fpu_control; +{ + volatile unsigned short cw; + + /* If user supplied _fpu_control, use it ! */ + if (!fpu_control) + { + /* use linux defaults */ + fpu_control = _FPU_DEFAULT; + } + /* Get Control Word */ + __asm__ volatile ("fnstcw %0" : "=m" (cw) : ); + + /* mask in */ + cw &= _FPU_RESERVED; + cw = cw | (fpu_control & ~_FPU_RESERVED); + + /* set cw */ + __asm__ volatile ("fldcw %0" :: "m" (cw)); +} diff --git a/sysdeps/unix/sysv/linux/i386/signum.h b/sysdeps/unix/sysv/linux/i386/signum.h new file mode 100644 index 0000000000..8e4f270204 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/signum.h @@ -0,0 +1,66 @@ +/* Signal number definitions. Linux version. +Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifdef _SIGNAL_H + +/* Fake signal functions. */ +#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ +#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ +#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ + + +/* Signals. */ +#define SIGHUP 1 /* Hangup (POSIX). */ +#define SIGINT 2 /* Interrupt (ANSI). */ +#define SIGQUIT 3 /* Quit (POSIX). */ +#define SIGILL 4 /* Illegal instruction (ANSI). */ +#define SIGTRAP 5 /* Trace trap (POSIX). */ +#define SIGABRT SIGIOT /* Abort (ANSI). */ +#define SIGIOT 6 /* IOT trap (4.2 BSD). */ +#define SIGBUS 7 /* BUS error (4.2 BSD). */ +#define SIGFPE 8 /* Floating-point exception (ANSI). */ +#define SIGKILL 9 /* Kill, unblockable (POSIX). */ +#define SIGUSR1 10 /* User-defined signal 1 (POSIX). */ +#define SIGSEGV 11 /* Segmentation violation (ANSI). */ +#define SIGUSR2 12 /* User-defined signal 2 (POSIX). */ +#define SIGPIPE 13 /* Broken pipe (POSIX). */ +#define SIGALRM 14 /* Alarm clock (POSIX). */ +#define SIGTERM 15 /* Termination (ANSI). */ +#define SIGSTKFLT 16 /* ??? */ +#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ +#define SIGCHLD 17 /* Child status has changed (POSIX). */ +#define SIGCONT 18 /* Continue (POSIX). */ +#define SIGSTOP 19 /* Stop, unblockable (POSIX). */ +#define SIGTSTP 20 /* Keyboard stop (POSIX). */ +#define SIGTTIN 21 /* Background read from tty (POSIX). */ +#define SIGTTOU 22 /* Background write to tty (POSIX). */ +#define SIGURG 23 /* Urgent condition on socket (4.2 BSD). */ +#define SIGXCPU 24 /* CPU limit exceeded (4.2 BSD). */ +#define SIGXFSZ 25 /* File size limit exceeded (4.2 BSD). */ +#define SIGVTALRM 26 /* Virtual alarm clock (4.2 BSD). */ +#define SIGPROF 27 /* Profiling alarm clock (4.2 BSD). */ +#define SIGWINCH 28 /* Window size change (4.3 BSD, Sun). */ +#define SIGPOLL SIGIO /* Pollable event occured (System V). */ +#define SIGIO 29 /* I/O now possible (4.2 BSD). */ +#define SIGPWR 30 /* Power failure restart (System V). */ +#define SIGUNUSED 31 + +#endif /* included. */ + +#define _NSIG 32 /* Biggest signal number + 1. */ diff --git a/sysdeps/unix/sysv/linux/i386/socket.S b/sysdeps/unix/sysv/linux/i386/socket.S new file mode 100644 index 0000000000..3d3a67213b --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/socket.S @@ -0,0 +1,60 @@ +/* Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include + +#define P(a, b) P2(a, b) +#define P2(a, b) a##b + +.globl syscall_error + +/* The socket-oriented system calls are handled unusally in Linux. + They are all gated through the single `socketcall' system call number. + `socketcall' takes two arguments: the first is the subcode, specifying + which socket function is being called; and the second is a pointer to + the arguments to the specific function. + + The .S files for the other calls just #define socket and #include this. */ + +.globl P(__,socket) +ENTRY (P(__,socket)) + + /* Save registers. */ + movl %ebx, %edx + + movl $SYS_ify(socketcall), %eax /* System call number in %eax. */ + + /* Use ## so `socket' is a separate token that might be #define'd. */ + movl $P(SOCKOP_,socket), %ebx /* Subcode is first arg to syscall. */ + lea 8(%esp), %ecx /* Address of args is 2nd arg. */ + + /* Do the system call trap. */ + int $0x80 + + /* Restore registers. */ + movl %edx, %ebx + + /* %eax is < 0 if there was an error. */ + testl %eax, %eax + jl JUMPTARGET(syscall_error) + + /* Successful; return the syscall's value. */ + ret + +weak_alias (P(__,socket), socket) diff --git a/sysdeps/unix/sysv/linux/i386/stat.S b/sysdeps/unix/sysv/linux/i386/stat.S new file mode 100644 index 0000000000..73204bf254 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/stat.S @@ -0,0 +1,38 @@ +/* Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +/* In Linux the `stat' call is actually done by emulating a `xstat' system + call, which takes an additional first argument giving a version number + for `struct stat'. Likewise for `fstat' and `lstat' there are `fxstat' + and `lxstat' emulations. This macro gives the Linux version number that + corresponds to the definition of `struct stat' in . */ +#define _STAT_VER 1 + +ENTRY (__stat) + movl 8(%esp), %eax + movl 4(%esp), %ecx + pushl %eax + pushl %ecx + pushl $_STAT_VER /* Push extra first arg to syscall. */ + call JUMPTARGET(__xstat)/* Jump to xstat implementation. */ + addl $12, %esp + ret + +weak_alias (__stat, stat) diff --git a/sysdeps/unix/sysv/linux/i386/syscall.S b/sysdeps/unix/sysv/linux/i386/syscall.S new file mode 100644 index 0000000000..6e6aa5d3c8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/syscall.S @@ -0,0 +1,31 @@ +/* Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include + +.globl syscall_error +ENTRY (syscall) + popl %ecx /* Pop return address into %ecx. */ + popl %eax /* Pop syscall number into %eax. */ + pushl %ecx /* Push back return address. */ + DO_CALL (5) /* Frob the args and do the system call. */ + movl (%esp), %ecx + pushl %ecx + testl %eax, %eax /* Check %eax for error. */ + jl JUMPTARGET(syscall_error) /* Jump to error handler if negative. */ + ret /* Return to caller. */ diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.S b/sysdeps/unix/sysv/linux/i386/sysdep.S new file mode 100644 index 0000000000..b873c958bb --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/sysdep.S @@ -0,0 +1,40 @@ +/* Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* The syscall stubs jump here when they detect an error. + The code for Linux is almost identical to the canonical Unix/i386 + code, except that the error number in %eax is negated. */ + +.globl __syscall_error +__syscall_error: + negl %eax + +#define __syscall_error __syscall_error_1 +#include + +/* Because the Linux version is in fact i386/ELF and the start.? file + for this system (sysdeps/i386/elf/start.S) is also used by The Hurd + and therefore this files must not contain the definition of the + `errno' variable (I don't know why, ask Roland), we have to define + it somewhere else. + + ...and this please is here. */ + .data + .globl errno +errno: + .long 0 diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h new file mode 100644 index 0000000000..7fe4d414e3 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -0,0 +1,135 @@ +/* Copyright (C) 1992, 1993, 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper, , August 1995. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* In the Linux/ELF world, C symbols are asm symbols. */ +#define NO_UNDERSCORES + +/* There is some commonality. */ +#include + +/* For Linux we can use the system call table in the header file + /usr/include/asm/unistd.h + of the kernel. But these symbols do not follow the SYS_* syntax + so we have to redefine the `SYS_ify' macro here. */ +#undef SYS_ify +#ifdef __STDC__ +# define SYS_ify(syscall_name) __NR_##syscall_name +#else +# define SYS_ify(syscall_name) __NR_/**/syscall_name +#endif + + +#ifdef ASSEMBLER + +/* Linux uses a negative return value to indicate syscall errors, unlike + most Unices, which use the condition codes' carry flag. */ +#undef PSEUDO +#define PSEUDO(name, syscall_name, args) \ + .text; \ + .globl syscall_error; \ + ENTRY (name) \ + movl $SYS_ify (syscall_name), %eax; \ + DO_CALL (args); \ + testl %eax, %eax; \ + jl JUMPTARGET (syscall_error) + +/* We define our own ENTRY macro because the alignment should be 16 for ELF. */ +#undef ENTRY +#define ENTRY(name) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME (name); \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME (name), @function) \ + .align 16; \ + C_LABEL (name) + +/* Linux takes system call arguments in registers: + + syscall number %eax call-clobbered + arg 1 %ebx call-saved + arg 2 %ecx call-clobbered + arg 3 %edx call-clobbered + arg 4 %esi call-saved + arg 5 %edi call-saved + + The stack layout upon entering the function is: + + 20(%esp) Arg# 5 + 16(%esp) Arg# 4 + 12(%esp) Arg# 3 + 8(%esp) Arg# 2 + 4(%esp) Arg# 1 + (%esp) Return address + + (Of course a function with say 3 arguments does not have entries for + arguments 4 and 5.) + + The following code tries hard to be optimal. A general assuption + (which is true accoriding to the data books I have) is that + + 2 * xchg is more expensive than pushl + movl + popl + + Beside this a neat trick is used. The calling conventions for Linux + tell that among the registers used for parameters %ecx and %edx need + not be saved. Beside this we may clobber this registers even when + they are not used for parameter passing. + + As a result one can see below that we save the content of the %ebx + register in the %edx register when we have less than 3 arguments + (2 * movl is less expensive than pushl + popl). + + Second unlike for the other registers we don't save the content of + %ecx and %edx when we have than 1 and 2 registers resp. */ + +#undef DO_CALL +#define DO_CALL(args) \ + DOARGS_##args \ + int $0x80; \ + UNDOARGS_##args + +#define DOARGS_0 /* No arguments to frob. */ +#define UNDOARGS_0 /* No arguments to unfrob. */ +#define _DOARGS_0(n) /* No arguments to frob. */ +#define _UNDOARGS_0 /* No arguments to unfrob. */ + +#define DOARGS_1 movl %ebx, %edx; movl 4(%esp), %ebx; DOARGS_0 +#define UNDOARGS_1 UNDOARGS_0; movl %edx, %ebx +#define _DOARGS_1(n) pushl %ebx; movl n+4(%esp), %ebx; _DOARGS_0 (n) +#define _UNDOARGS_1 _UNDOARGS_0; popl %ebx + +#define DOARGS_2 movl 8(%esp), %ecx; DOARGS_1 +#define UNDOARGS_2 UNDOARGS_1 +#define _DOARGS_2(n) movl n(%esp), %ecx; _DOARGS_1 (n-4) +#define _UNDOARGS_2 _UNDOARGS_1 + +#define DOARGS_3 _DOARGS_3 (12) +#define UNDOARGS_3 _UNDOARGS_3 +#define _DOARGS_3(n) movl n(%esp), %edx; _DOARGS_2 (n-4) +#define _UNDOARGS_3 _UNDOARGS_2 + +#define DOARGS_4 _DOARGS_4 (16) +#define UNDOARGS_4 _UNDOARGS_4 +#define _DOARGS_4(n) pushl %esi; movl n+4(%esp), %esi; _DOARGS_3 (n) +#define _UNDOARGS_4 _UNDOARGS_3; popl %esi + +#define DOARGS_5 _DOARGS_5 (20) +#define UNDOARGS_5 _UNDOARGS_5 +#define _DOARGS_5(n) pushl %edi; movl n+4(%esp), %edi; _DOARGS_4 (n) +#define _UNDOARGS_5 _UNDOARGS_4; popl %edi + + +#endif /* ASSEMBLER */ diff --git a/sysdeps/unix/sysv/linux/i386/xmknod.S b/sysdeps/unix/sysv/linux/i386/xmknod.S new file mode 100644 index 0000000000..fde3165d01 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/xmknod.S @@ -0,0 +1,49 @@ +/* Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include + +.globl syscall_error +ENTRY (__xmknod) + popl %ecx /* Pop return address into %eax. */ + popl %edx /* Pop version number into %edx. */ + pushl %ecx /* Push back the return address. */ + + movl $SYS_ify(mknod), %eax + /* Load syscall number for prev_stat in %eax. */ + cmpl $1, %edx /* Version 1 xstat call? */ + je .L1 /* Yes, do syscall. */ + + movl $-EINVAL, %eax /* Load error code into %eax. */ + jmp .L2 + +.L1: DO_CALL (3) /* Do the syscall. */ + + movl (%esp), %ecx + testl %eax, %eax /* Check for error. */ + jl .L2 + + jmp *%ecx /* Return success. */ + +.L2: pushl %ecx + jmp JUMPTARGET(syscall_error) + /* Yes, then branch to error handling. */ + +/* For compatibility with Linux libc. */ +weak_alias (__xmknod, _xmknod) diff --git a/sysdeps/unix/sysv/linux/i386/xstat.S b/sysdeps/unix/sysv/linux/i386/xstat.S new file mode 100644 index 0000000000..34822beda6 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/xstat.S @@ -0,0 +1,51 @@ +/* Copyright (C) 1995 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include + +#define SYS_expand(name) SYS_ify(name) + +.globl syscall_error +ENTRY (__xstat) + popl %ecx /* Pop return address into %eax. */ + popl %edx /* Pop version number into %edx. */ + pushl %ecx /* Push back the return address. */ + + movl $SYS_expand(stat), %eax + /* Load syscall number for prev_stat in %eax. */ + cmpl $1, %edx /* Version 1 xstat call? */ + je .L1 /* Yes, do syscall. */ + + movl $-EINVAL, %eax /* Load error code into %eax. */ + jmp .L2 + +.L1: DO_CALL (2) /* Do the syscall. */ + + movl (%esp), %ecx + testl %eax, %eax /* Check for error. */ + jl .L2 + + jmp *%ecx /* Return success. */ + +.L2: pushl %ecx + jmp JUMPTARGET(syscall_error) + /* Yes, then branch to error handling. */ + +/* For compatibility with Linux libc. */ +weak_alias (__xstat, _xstat) -- cgit v1.2.3