diff options
author | Roland McGrath <roland@gnu.org> | 1995-02-18 01:27:10 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1995-02-18 01:27:10 +0000 |
commit | 28f540f45bbacd939bfd07f213bcad2bf730b1bf (patch) | |
tree | 15f07c4c43d635959c6afee96bde71fb1b3614ee /sysdeps/unix/i386 | |
download | glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.gz glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.tar.bz2 glibc-28f540f45bbacd939bfd07f213bcad2bf730b1bf.zip |
initial import
Diffstat (limited to 'sysdeps/unix/i386')
-rw-r--r-- | sysdeps/unix/i386/brk.S | 41 | ||||
-rw-r--r-- | sysdeps/unix/i386/fork.S | 30 | ||||
-rw-r--r-- | sysdeps/unix/i386/pipe.S | 28 | ||||
-rw-r--r-- | sysdeps/unix/i386/sigreturn.S | 27 | ||||
-rw-r--r-- | sysdeps/unix/i386/start.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/i386/syscall.S | 28 | ||||
-rw-r--r-- | sysdeps/unix/i386/sysdep.S | 42 | ||||
-rw-r--r-- | sysdeps/unix/i386/sysdep.h | 55 | ||||
-rw-r--r-- | sysdeps/unix/i386/wait.S | 28 |
9 files changed, 281 insertions, 0 deletions
diff --git a/sysdeps/unix/i386/brk.S b/sysdeps/unix/i386/brk.S new file mode 100644 index 0000000000..f55ac7c775 --- /dev/null +++ b/sysdeps/unix/i386/brk.S @@ -0,0 +1,41 @@ +/* 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 <sysdep.h> + +#ifndef SYS_brk +#define SYS_brk 17 +#endif + +.data +.globl C_SYMBOL_NAME(__curbrk) +C_LABEL(__curbrk) +#ifdef HAVE_GNU_LD + .long C_SYMBOL_NAME(_end) +#else + .long C_SYMBOL_NAME(end) +#endif + +.text +SYSCALL__ (brk, 1) + movl 4(%esp), %eax + movl %eax, C_SYMBOL_NAME(__curbrk) + xorl %eax, %eax + ret + +weak_alias (__brk, brk) diff --git a/sysdeps/unix/i386/fork.S b/sysdeps/unix/i386/fork.S new file mode 100644 index 0000000000..4388b04fd4 --- /dev/null +++ b/sysdeps/unix/i386/fork.S @@ -0,0 +1,30 @@ +/* Copyright (C) 1991, 1992, 1994, 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 <sysdep.h> + +SYSCALL__ (fork, 0) + /* R1 is now 0 for the parent and 1 for the child. Decrement it to + make it -1 (all bits set) for the parent, and 0 (no bits set) + for the child. Then AND it with R0, so the parent gets + R0&-1==R0, and the child gets R0&0==0. */ + decl r1 + andl r1, r0 + ret + +weak_alias (__fork, fork) diff --git a/sysdeps/unix/i386/pipe.S b/sysdeps/unix/i386/pipe.S new file mode 100644 index 0000000000..7c7c51aa53 --- /dev/null +++ b/sysdeps/unix/i386/pipe.S @@ -0,0 +1,28 @@ +/* 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 <sysdep.h> + +SYSCALL__ (pipe, 1) + movl 4(%esp), scratch + movl %eax, (scratch) + movl r1, 4(scratch) + xorl %eax, %eax + ret + +weak_alias (__pipe, pipe) diff --git a/sysdeps/unix/i386/sigreturn.S b/sysdeps/unix/i386/sigreturn.S new file mode 100644 index 0000000000..3cf79a5415 --- /dev/null +++ b/sysdeps/unix/i386/sigreturn.S @@ -0,0 +1,27 @@ +/* Copyright (C) 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 <sysdep.h> + +.text +ENTRY (__sigreturn) + addl $4, %esp /* Pop the return PC. */ + DO_CALL (sigreturn, 0) /* Do the system call; it never returns. */ + /* NOTREACHED */ + +weak_alias (__sigreturn, sigreturn) diff --git a/sysdeps/unix/i386/start.c b/sysdeps/unix/i386/start.c new file mode 100644 index 0000000000..e6c89ee3f3 --- /dev/null +++ b/sysdeps/unix/i386/start.c @@ -0,0 +1,2 @@ +#define DUMMIES dummy0 +#include <sysdeps/unix/start.c> diff --git a/sysdeps/unix/i386/syscall.S b/sysdeps/unix/i386/syscall.S new file mode 100644 index 0000000000..5241ee4ac1 --- /dev/null +++ b/sysdeps/unix/i386/syscall.S @@ -0,0 +1,28 @@ +/* Copyright (C) 1993 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 <sysdep.h> + +.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. */ + .byte 0x9a, 0, 0, 0, 0, 7, 0 /* lcall $7, $0 -- gas bug */ + jb syscall_error + ret diff --git a/sysdeps/unix/i386/sysdep.S b/sysdeps/unix/i386/sysdep.S new file mode 100644 index 0000000000..dae7153796 --- /dev/null +++ b/sysdeps/unix/i386/sysdep.S @@ -0,0 +1,42 @@ +/* Copyright (C) 1991, 1992, 1993, 1994 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 <sysdep.h> +#define _ERRNO_H +#include <errnos.h> + +.globl C_SYMBOL_NAME(errno) +.globl syscall_error + +#undef syscall_error +#ifdef NO_UNDERSCORES +__syscall_error: +#else +syscall_error: +#endif +#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN + /* We translate the system's EWOULDBLOCK error into EAGAIN. + The GNU C library always defines EWOULDBLOCK==EAGAIN. + EWOULDBLOCK_sys is the original number. */ + cmpl $EWOULDBLOCK_sys, %eax /* Is it the old EWOULDBLOCK? */ + jne notb /* Branch if not. */ + movl $EAGAIN, %eax /* Yes; translate it to EAGAIN. */ +#endif +notb: movl %eax, C_SYMBOL_NAME(errno) + movl $-1, %eax + ret diff --git a/sysdeps/unix/i386/sysdep.h b/sysdeps/unix/i386/sysdep.h new file mode 100644 index 0000000000..38dd2378b5 --- /dev/null +++ b/sysdeps/unix/i386/sysdep.h @@ -0,0 +1,55 @@ +/* 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 <sysdeps/unix/sysdep.h> + +#ifdef ASSEMBLER + +#define ENTRY(name) \ + .globl C_SYMBOL_NAME(name); \ + .align 4; \ + C_LABEL(name) + +#ifdef NO_UNDERSCORES +/* Since C identifiers are not normally prefixed with an underscore + on this system, the asm identifier `syscall_error' intrudes on the + C name space. Make sure we use an innocuous name. */ +#define syscall_error __syscall_error +#endif + +#define PSEUDO(name, syscall_name, args) \ + .globl syscall_error; \ + ENTRY (name) \ + DO_CALL (syscall_name, args); \ + jb syscall_error + +/* This is defined as a separate macro so that other sysdep.h files + can include this one and then redefine DO_CALL. */ + +#define DO_CALL(syscall_name, args) \ + lea SYS_ify (syscall_name), %eax; \ + /* lcall $7, $0; */ \ + /* Above loses; GAS bug. */ \ + .byte 0x9a, 0, 0, 0, 0, 7, 0 + +#define r0 %eax /* Normal return-value register. */ +#define r1 %edx /* Secondary return-value register. */ +#define scratch %ecx /* Call-clobbered register for random use. */ +#define MOVE(x,y) movl x, y + +#endif /* ASSEMBLER */ diff --git a/sysdeps/unix/i386/wait.S b/sysdeps/unix/i386/wait.S new file mode 100644 index 0000000000..4b2e62ca3b --- /dev/null +++ b/sysdeps/unix/i386/wait.S @@ -0,0 +1,28 @@ +/* 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 <sysdep.h> + +SYSCALL__ (wait, 1) + movl 4(%esp), scratch /* Put status pointer in scratch register. */ + testl scratch, scratch /* Is it non-nil? */ + je null + movl r1, (scratch) /* Yes; store the status there. */ +null: ret + +weak_alias (__wait, wait) |