Re: How to make system calls having 64-bit arguments using 'int 80h'
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Re: How to make system calls having 64-bit arguments using 'int 80h'




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Re: How to make system calls having 64-bit arguments using 'int 80h'  
Spoon


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-24-07 12:31 PM

Visa Inquirer wrote:

> 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);
> Its last argument is off_t which is 64-bit.

Are you sure the offset really is 64-bits wide?
http://lxr.linux.no/source/arch/i38.../sys_i386.c#L43
asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff)

> 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?

Are you sure the offset really is 64-bits wide?
asmlinkage off_t sys_lseek(unsigned int fd, off_t offset,
unsigned int origin)
typedef __kernel_off_t off_t;
typedef long __kernel_off_t;

llseek explicitly breaks a 64-bit argument into two 32-bit pieces:
http://lxr.linux.no/source/fs/read_write.c#L154
asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
unsigned long offset_low, loff_t __user * result,
unsigned int origin)





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 08:45 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register