| 1 |
/* { dg-do compile { target ia32 } } */ |
| 2 |
/* { dg-options "-w" } */ |
| 3 |
|
| 4 |
typedef unsigned int size_t; |
| 5 |
__extension__ typedef long int __off_t; |
| 6 |
typedef __off_t off_t; |
| 7 |
static void *__sys_mmap(void *addr, size_t length, int prot, int flags, int fd, |
| 8 |
off_t offset) |
| 9 |
{ |
| 10 |
offset >>= 12; |
| 11 |
return (void *)({ long _ret; |
| 12 |
register long _num asm("eax") = (192); |
| 13 |
register long _arg1 asm("ebx") = (long)(addr); |
| 14 |
register long _arg2 asm("ecx") = (long)(length); |
| 15 |
register long _arg3 asm("edx") = (long)(prot); |
| 16 |
register long _arg4 asm("esi") = (long)(flags); |
| 17 |
register long _arg5 asm("edi") = (long)(fd); |
| 18 |
long _arg6 = (long)(offset); |
| 19 |
asm volatile ("pushl %[_arg6]\n\t" |
| 20 |
"pushl %%ebp\n\t" |
| 21 |
"movl 4(%%esp), %%ebp\n\t" |
| 22 |
"int $0x80\n\t" |
| 23 |
"popl %%ebp\n\t" |
| 24 |
"addl $4,%%esp\n\t" |
| 25 |
: "=a"(_ret) |
| 26 |
: "r"(_num), "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4),"r"(_arg5), [_arg6]"m"(_arg6) |
| 27 |
: "memory", "cc" ); |
| 28 |
_ret; }); |
| 29 |
} |
| 30 |
|
| 31 |
int main(void) |
| 32 |
{ |
| 33 |
__sys_mmap(((void *)0), 0x1000, 0x1 | 0x2, 0x20 | 0x02, -1, 0); |
| 34 |
return 0; |
| 35 |
} |