From: Ulrich Drepper Date: Tue, 4 Jan 2000 00:38:42 +0000 (+0000) Subject: Fix code for running on kernel without mmap2 syscall. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe203ec1e393191a00e54d7c2c196ac32b34559a;p=thirdparty%2Fglibc.git Fix code for running on kernel without mmap2 syscall. --- diff --git a/sysdeps/unix/sysv/linux/i386/mmap64.S b/sysdeps/unix/sysv/linux/i386/mmap64.S index fbe54577036..22515a11d28 100644 --- a/sysdeps/unix/sysv/linux/i386/mmap64.S +++ b/sysdeps/unix/sysv/linux/i386/mmap64.S @@ -18,6 +18,8 @@ #include +#include "kernel-features.h" + #define EINVAL 22 #define ENOSYS 38 @@ -60,6 +62,12 @@ L(do_syscall): popl %ebx popl %ebp +#ifndef __ASSUME_MMAP2_SYSCALL +2: + cmp $-ENOSYS, %eax + je 3f +#endif + /* If 0 > %eax > -4096 there was an error. */ cmpl $-4096, %eax ja SYSCALL_ERROR_LABEL @@ -68,10 +76,6 @@ L(do_syscall): L(pseudo_end): ret -2: - cmp $-ENOSYS, %eax - je 3f - /* This means the offset value is too large. */ L(einval): popl %edi @@ -82,22 +86,22 @@ L(einval): jmp SYSCALL_ERROR_LABEL #endif +#if !defined __ASSUME_MMAP2_SYSCALL || !defined __NR_mmap2 -#ifndef __NR_mmap2 +3: /* Save registers. */ movl %ebx, %edx -#endif -3: - cmpl $0, 44(%esp) + + cmpl $0, 28(%esp) jne L(einval) movl $SYS_ify(mmap), %eax /* System call number in %eax. */ lea 4(%esp), %ebx /* Address of args is 1st arg. */ -#ifdef __NR_mmap2 +# ifdef __NR_mmap2 jmp L(do_syscall) -#else +# else /* Do the system call trap. */ int $0x80 @@ -114,8 +118,10 @@ L(pseudo_end): ret L(einval): + movl %edx, %ebx movl $-EINVAL, %eax jmp SYSCALL_ERROR_LABEL +# endif #endif PSEUDO_END (__mmap64)