123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #define _ERRNO_H 1
- #include <features.h>
- #include <bits/errno.h>
- #include <sys/syscall.h>
- #if defined __UCLIBC_HAS_LFS__ && defined __NR_mmap2
- #define LINKAGE 4
- #define PTR_SIZE 4
- #define SVRSP 16
- #define PARMS LINKAGE+SVRSP
- #define ADDR PARMS
- #define LEN ADDR+PTR_SIZE
- #define PROT LEN+4
- #define FLAGS PROT+4
- #define FD FLAGS+4
- #define OFFLO FD+4
- #define OFFHI OFFLO+4
- .text
- .globl mmap64
- .type mmap64,@function
- .align 1<<4
- mmap64:
-
- pushl %ebp
- pushl %ebx
- pushl %esi
- pushl %edi
- movl OFFLO(%esp), %edx
- movl OFFHI(%esp), %ecx
- testl $0xfff, %edx
- jne L_einval
- shrdl $12, %ecx, %edx
- shrl $12, %ecx
- jne L_einval
- movl %edx, %ebp
- movl ADDR(%esp), %ebx
- movl LEN(%esp), %ecx
- movl PROT(%esp), %edx
- movl FLAGS(%esp), %esi
- movl FD(%esp), %edi
- movl $__NR_mmap2, %eax
- int $0x80
-
- popl %edi
- popl %esi
- popl %ebx
- popl %ebp
-
- cmpl $-4095,%eax
- jae __syscall_error
- ret
-
- L_einval:
- popl %edi
- popl %esi
- popl %ebx
- popl %ebp
- movl $-EINVAL, %eax
- jmp __syscall_error
- __syscall_error:
- negl %eax
- pushl %eax
- #ifdef __PIC__
- call .Lthere
- .Lthere:
- popl %ebx
- addl $_GLOBAL_OFFSET_TABLE_+[.- .Lthere ], %ebx
- call __errno_location@PLT
- #else
- call __errno_location
- #endif
- popl %ecx
- movl %ecx, (%eax)
- xorl %eax, %eax
- decl %eax
- .Lsize:
- .size mmap64,.Lsize-mmap64
- #endif
|