On i386, the parameters of a system call are transported via registers. The system call number goes into %eax, the first parameter in %ebx, the second in %ecx, the third in %edx, the fourth in %esi, the fifth in %edi, the sixth in %ebp.

Ancient history

Earlier versions of Linux could handle only four or five system call parameters, and therefore the system calls select() (5 parameters) and mmap() (6 parameters) used to have a single parameter that was a pointer to a parameter block in memory. Since Linux 1.3.0 five parameters are supported (and the earlier select with memory block was renamed old_select), and since Linux 2.3.31 six parameters are supported (and the earlier mmap with memory block was succeeded by the new mmap2). 


�� �� arcturus (��拾��山��) �拇������到: ��
: ��  ��: Re: 系统���������源�5������么��
: ����站: BBS 水木�华站 (Thu Mar 10 10:29:08 2005), 转��
: 
: ���诳��源�6���耍�x86��:
: 
: #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
:           type5,arg5,type6,arg6) \
: type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
: { \
: long __res; \
: __asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \
:         : "=a" (__res) \
:         : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
:           "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \
:           "0" ((long)(arg6))); \
: __syscall_return(type,__res); \
: }
: 
: �� �� wangyxcti (���吖���) �拇������到: ��
: : 系统���������源�5������么?���牵�
: : void  *  mmap(void *start, size_t length, int prot , int flags, int fd,
: :        off_t offset);��么���停�
: : ...................
: 
: --
: 
: �� ��源:��BBS 水木�华站 smth.org��[FROM: 202.108.132.*]


--

�� ��源:��BBS 水木�华站 smth.org��[FROM: 202.108.132.*]