summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysdeps/unix/sysv/linux/i386/Makefile9
-rw-r--r--sysdeps/unix/sysv/linux/i386/epoll_pwait.S78
-rw-r--r--sysdeps/unix/sysv/linux/i386/mmap.S79
-rw-r--r--sysdeps/unix/sysv/linux/i386/mmap.c37
-rw-r--r--sysdeps/unix/sysv/linux/i386/mmap64.S116
-rw-r--r--sysdeps/unix/sysv/linux/i386/semtimedop.S73
6 files changed, 46 insertions, 346 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index e10d133db4..b4842173e9 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -3,6 +3,15 @@ default-abi := 32
ifeq ($(subdir),misc)
sysdep_routines += ioperm iopl vm86
+# %ebp may be used to pass the 6th argument to syscall.
+CFLAGS-epoll_pwait.c += -fomit-frame-pointer
+CFLAGS-mmap.c += -fomit-frame-pointer
+CFLAGS-mmap64.c += -fomit-frame-pointer
+endif
+
+ifeq ($(subdir),sysvipc)
+# %ebp may be used to pass the 6th argument to syscall.
+CFLAGS-semtimedop.c += -fomit-frame-pointer
endif
ifeq ($(subdir),elf)
diff --git a/sysdeps/unix/sysv/linux/i386/epoll_pwait.S b/sysdeps/unix/sysv/linux/i386/epoll_pwait.S
deleted file mode 100644
index 65cfb984b6..0000000000
--- a/sysdeps/unix/sysv/linux/i386/epoll_pwait.S
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright (C) 2007-2015 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#define _ERRNO_H
-#include <bits/errno.h>
-#define _SIGNAL_H
-#include <bits/signum.h>
-
-
- .text
-ENTRY (epoll_pwait)
-
-#ifdef __NR_epoll_pwait
-
- /* Save registers. */
- pushl %ebp
- cfi_adjust_cfa_offset (4)
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- pushl %esi
- cfi_adjust_cfa_offset (4)
- pushl %edi
- cfi_adjust_cfa_offset (4)
- cfi_rel_offset (edi, 0)
- cfi_rel_offset (esi, 4)
- cfi_rel_offset (ebx, 8)
- cfi_rel_offset (ebp, 12)
-
- movl 20(%esp), %ebx
- movl 24(%esp), %ecx
- movl 28(%esp), %edx
- movl 32(%esp), %esi
- movl 36(%esp), %edi
- movl $_NSIG/8, %ebp
- movl $__NR_epoll_pwait, %eax
-
- ENTER_KERNEL
-
- /* Restore registers. */
- popl %edi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (edi)
- popl %esi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (esi)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
- popl %ebp
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebp)
-
- /* If 0 > %eax > -4096 there was an error. */
- cmpl $-4096, %eax
- ja SYSCALL_ERROR_LABEL
-
- /* Successful; return the syscall's value. */
-#else
- movl $-ENOSYS, %eax
- jmp SYSCALL_ERROR_LABEL
-#endif
- ret
-PSEUDO_END (epoll_pwait)
diff --git a/sysdeps/unix/sysv/linux/i386/mmap.S b/sysdeps/unix/sysv/linux/i386/mmap.S
deleted file mode 100644
index daf807ac75..0000000000
--- a/sysdeps/unix/sysv/linux/i386/mmap.S
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Copyright (C) 1995-2015 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
-#define EINVAL 22
-
- .text
-
-ENTRY (__mmap)
-
- /* Save registers. */
- pushl %ebp
- cfi_adjust_cfa_offset (4)
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- pushl %esi
- cfi_adjust_cfa_offset (4)
- pushl %edi
- cfi_adjust_cfa_offset (4)
-
- movl 20(%esp), %ebx
- cfi_rel_offset (ebx, 8)
- movl 24(%esp), %ecx
- movl 28(%esp), %edx
- movl 32(%esp), %esi
- cfi_rel_offset (esi, 4)
- movl 36(%esp), %edi
- cfi_rel_offset (edi, 0)
- movl 40(%esp), %ebp
- cfi_rel_offset (ebp, 12)
- testl $0xfff, %ebp
- movl $-EINVAL, %eax
- jne L(skip)
- shrl $12, %ebp /* mmap2 takes the offset in pages. */
-
- movl $SYS_ify(mmap2), %eax /* System call number in %eax. */
-
- /* Do the system call trap. */
- ENTER_KERNEL
-L(skip):
- /* Restore registers. */
- popl %edi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (edi)
- popl %esi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (esi)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
- popl %ebp
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebp)
-
- /* If 0 > %eax > -4096 there was an error. */
- cmpl $-4096, %eax
- ja SYSCALL_ERROR_LABEL
-
- /* Successful; return the syscall's value. */
- ret
-
-PSEUDO_END (__mmap)
-
-weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/i386/mmap.c b/sysdeps/unix/sysv/linux/i386/mmap.c
new file mode 100644
index 0000000000..e5e344cb26
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/i386/mmap.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2015 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, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <sysdep.h>
+
+#ifndef MMAP_PAGE_SHIFT
+#define MMAP_PAGE_SHIFT 12
+#endif
+
+__ptr_t
+__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
+{
+ if (offset & ((1 << MMAP_PAGE_SHIFT) - 1))
+ return INLINE_SYSCALL_ERROR_RETURN (-EINVAL, __ptr_t, );
+
+ return INLINE_SYSCALL_RETURN (mmap2, 6, __ptr_t, addr, len, prot,
+ flags, fd, offset >> MMAP_PAGE_SHIFT);
+}
+
+weak_alias (__mmap, mmap)
diff --git a/sysdeps/unix/sysv/linux/i386/mmap64.S b/sysdeps/unix/sysv/linux/i386/mmap64.S
deleted file mode 100644
index 3cf6eb9a35..0000000000
--- a/sysdeps/unix/sysv/linux/i386/mmap64.S
+++ /dev/null
@@ -1,116 +0,0 @@
-/* Copyright (C) 1995-2015 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
-#define EINVAL 22
-#define ENOSYS 38
-
-#define SVRSP 16 /* saved register space */
-#define PARMS 4+SVRSP /* space for 4 saved regs */
-#define ADDR PARMS
-#define LEN ADDR+4
-#define PROT LEN+4
-#define FLAGS PROT+4
-#define FD FLAGS+4
-#define OFFLO FD+4
-#define OFFHI OFFLO+4
-
- .text
-ENTRY (__mmap64)
-
- /* Save registers. */
- pushl %ebp
- cfi_adjust_cfa_offset (4)
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- pushl %esi
- cfi_adjust_cfa_offset (4)
- pushl %edi
- cfi_adjust_cfa_offset (4)
-
- movl OFFLO(%esp), %edx
- movl OFFHI(%esp), %ecx
- testl $0xfff, %edx
- jne L(einval)
- shrdl $12, %ecx, %edx /* mmap2 takes the offset in pages. */
- shrl $12, %ecx
- jne L(einval)
- movl %edx, %ebp
- cfi_rel_offset (ebp, 12)
-
- movl ADDR(%esp), %ebx
- cfi_rel_offset (ebx, 8)
- movl LEN(%esp), %ecx
- movl PROT(%esp), %edx
- movl FLAGS(%esp), %esi
- cfi_rel_offset (esi, 4)
- movl FD(%esp), %edi
- cfi_rel_offset (edi, 0)
-
- movl $SYS_ify(mmap2), %eax /* System call number in %eax. */
-
- /* Do the system call trap. */
-L(do_syscall):
- ENTER_KERNEL
-
- /* Restore registers. */
- popl %edi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (edi)
- popl %esi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (esi)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
- popl %ebp
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebp)
-
- /* If 0 > %eax > -4096 there was an error. */
- cmpl $-4096, %eax
- ja SYSCALL_ERROR_LABEL
-
- /* Successful; return the syscall's value. */
- ret
-
- cfi_adjust_cfa_offset (16)
- cfi_rel_offset (ebp, 12)
- cfi_rel_offset (ebx, 8)
- cfi_rel_offset (esi, 4)
- cfi_rel_offset (edi, 0)
- /* This means the offset value is too large. */
-L(einval):
- popl %edi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (edi)
- popl %esi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (esi)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
- popl %ebp
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebp)
- movl $-EINVAL, %eax
- jmp SYSCALL_ERROR_LABEL
-
-PSEUDO_END (__mmap64)
-
-weak_alias (__mmap64, mmap64)
diff --git a/sysdeps/unix/sysv/linux/i386/semtimedop.S b/sysdeps/unix/sysv/linux/i386/semtimedop.S
deleted file mode 100644
index 80477b7b63..0000000000
--- a/sysdeps/unix/sysv/linux/i386/semtimedop.S
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (C) 2003-2015 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
- 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-
-#define SYSOP_semtimedop 4
-
-#define SVRSP 12 /* saved register space */
-#define PARMS 4+SVRSP /* space for 3 saved regs */
-#define SEMID PARMS
-#define SOPS SEMID+4
-#define NSOPS SOPS+4
-#define TIMEOUT NSOPS+4
-
- .text
-ENTRY (semtimedop)
-
- pushl %ebp
- cfi_adjust_cfa_offset (4)
- pushl %ebx
- cfi_adjust_cfa_offset (4)
- pushl %edi
- cfi_adjust_cfa_offset (4)
-
- movl $SYSOP_semtimedop, %ebx
- cfi_rel_offset (ebx, 4)
- movl SEMID(%esp), %ecx
- movl NSOPS(%esp), %edx
- movl SOPS(%esp), %edi
- cfi_rel_offset (edi, 0)
- movl TIMEOUT(%esp), %ebp
- cfi_rel_offset (ebp, 8)
- movl $__NR_ipc, %eax
-
- ENTER_KERNEL
-
- /* Restore registers. */
- popl %edi
- cfi_adjust_cfa_offset (-4)
- cfi_restore (edi)
- popl %ebx
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebx)
- popl %ebp
- cfi_adjust_cfa_offset (-4)
- cfi_restore (ebp)
-
- /* If 0 > %eax > -4096 there was an error. */
- cmpl $-4096, %eax
- ja SYSCALL_ERROR_LABEL
-
- /* Successful; return the syscall's value. */
- ret
-
-#ifdef PIC
- .align 4
-#endif
-PSEUDO_END (semtimedop)