#include <sysdep.h>
+#include "kernel-features.h"
+
#define EINVAL 22
#define ENOSYS 38
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
L(pseudo_end):
ret
-2:
- cmp $-ENOSYS, %eax
- je 3f
-
/* This means the offset value is too large. */
L(einval):
popl %edi
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
ret
L(einval):
+ movl %edx, %ebx
movl $-EINVAL, %eax
jmp SYSCALL_ERROR_LABEL
+# endif
#endif
PSEUDO_END (__mmap64)