10-24-07 06:31 AM
If I need to make a system call with 6 arguments I can use the code:
" push %esi\n"
" push %edi\n"
" push %ebx\n"
" push %ebp\n"
" movl 16+ 4(%esp),%eax\n" // syscall_num
" movl 16+ 8(%esp),%ebx\n" // arg1
" movl 16+12(%esp),%ecx\n" // arg2
" movl 16+16(%esp),%edx\n" // arg3
" movl 16+20(%esp),%esi\n" // arg4
" movl 16+24(%esp),%edi\n" // arg5
" movl 16+28(%esp),%ebp\n" // arg6
" int $0x80\n"
" popl %ebp\n"
" popl %ebx\n"
" popl %edi\n"
" popl %esi\n"
" ret\n"
But what happens for system calls like 'mmap'?
void * mmap(void *start, size_t length, int prot , int flags, int
fd, off_t offset);
It's last argument is off_t which is 64-bit. Where should the high
part of this offset fit in? There is not enough registers...
Same for lseek:
off_t lseek(int fildes, off_t offset, int whence);
how will the high part of 'offset' argument be passed?
Is there any documentation about this?
[ Post a follow-up to this message ]
|