システムコールと引数

linux-2.4.18 のソースからシステムコール番号とシステムコールの引数をまとめてみました。
レジスタに値をセットして、

       mov    r0, #0
       swi    #0x900001    @ sys_exit

のようにして呼び出します。

EABI の場合は、r7 にシステムコール番号を指定します。

       mov    r0, #0
       mov    r7, #1       @ sys_exit
       swi    #0    

返り値も引数の型もいろいろありますが、結局32ビットの値かアドレスです。

sys#SWI#typeNAMEarg1 (r0)arg2 (r1)arg3 (r2)arg4 (r3)arg5 (r4)arg6 (r5)
1900001longsys_exitint error_code
2900002intsys_forkstruct pt_regs *regs
3900003ssize_tsys_readunsigned int fdchar * bufsize_t count
4900004ssize_tsys_writeunsigned int fdconst char * bufsize_t count
5900005longsys_openconst char * filenameint flagsint mode
6900006longsys_closeunsigned int fd
8900008longsys_creatconst char * pathnameint mode
9900009longsys_linkconst char * oldnameconst char * newname
1090000Alongsys_unlinkconst char * pathname
1190000Bintsys_execvechar *filenameichar **argvchar **envpstruct pt_regs *regs
1290000Clongsys_chdirconst char * filename
1390000Dlongsys_timeint * tloc
1490000Elongsys_mknodconst char * filenameint modedev_t dev
1590000Flongsys_chmodconst char * filenamemode_t mode
16900010longsys_lchown16const char * filenameold_uid_t userold_gid_t group
19900013off_tsys_lseekunsigned int fdoff_t offsetunsigned int origin
20900014longsys_getpidvoid
21900015longsys_mprotectunsigned long startsize_t lenunsigned long prot
22900016longsys_oldumountchar * name
23900017longsys_setuid16old_uid_t uid
24900018longsys_getuid16void
25900019longsys_stimeint * tptr
2690001Aintsys_ptracelong requestlong pidlong addrlong data
2790001Bunsigned longsys_alarmunsigned int seconds
2990001Dintsys_pausevoid
3090001Elongsys_utimechar * filenamestruct utimbuf * times
33900021longsys_accessconst char * filenameint mode
34900022longsys_niceint increment
36900024longsys_syncvoid
37900025longsys_killint pidint sig
38900026longsys_renameconst char * oldnameconst char * newname
39900027longsys_mkdirconst char * pathnameint mode
40900028longsys_rmdirconst char * pathname
41900029longsys_dupunsigned int fildes
4290002Aintsys_pipeunsigned long * fildes
4390002Blongsys_timesstruct tms * tbuf
4590002Dunsigned longsys_brkunsigned long brk
4690002Elongsys_setgid16old_gid_t gid
4790002Flongsys_getgid16void
49900031longsys_geteuid16void
50900032longsys_getegid16void
51900033longsys_acctconst char *name
52900034longsys_umountchar * nameint flags
54900036longsys_ioctlunsigned int fdunsigned int cmdunsigned long arg
55900037longsys_fcntlunsigned int fdunsigned int cmdunsigned long arg
57900039longsys_setpgidpid_t pidpid_t pgid
6090003Clongsys_umaskint mask
6190003Dlongsys_chrootconst char * filename
6290003Elongsys_ustatdev_t devstruct ustat * ubuf
6390003Flongsys_dup2unsigned int oldfdunsigned int newfd
64900040longsys_getppidvoid
65900041longsys_getpgrpvoid
66900042longsys_setsidvoid
67900043longsys_sgetmaskvoid
70900046longsys_setreuid16old_uid_t ruidold_uid_t euid
71900047longsys_setregid16old_gid_t rgidold_gid_t egid
72900048intsys_sigsuspendint restartunsigned long oldmaskold_sigset_t maskstruct pt_regs *regs
73900049longsys_sigpendingold_sigset_t *set
7490004Alongsys_sethostnamechar *nameint len
7590004Blongsys_setrlimitunsigned int resourcestruct rlimit *rlim
7690004Clongsys_old_getrlimitunsigned int resourcestruct rlimit *rlim
7790004Dlongsys_getrusageint whostruct rusage *ru
7890004Elongsys_gettimeofdaystruct timeval *tvstruct timezone *tz
7990004Flongsys_settimeofdaystruct timeval *tvstruct timezone *tz
80900050longsys_getgroups16int gidsetsizeold_gid_t *grouplist
81900051longsys_setgroups16int gidsetsizeold_gid_t *grouplist
82900052intold_selectstruct sel_arg_struct *arg
83900053longsys_symlinkconst char * oldnameconst char * newname
85900055longsys_readlinkconst char * pathchar * bufint bufsiz
86900056longsys_uselibconst char * library
87900057longsys_swaponconst char * specialfileint swap_flags
88900058longsys_rebootint magic1int magic2unsigned int cmdvoid * arg
89900059intold_readdirunsigned int fdvoid * direntunsigned int count
9090005Aintold_mmapstruct mmap_arg_struct *arg
9190005Blongsys_munmapunsigned long addrsize_t len
9290005Clongsys_truncateconst char * pathunsigned long length
9390005Dlongsys_ftruncateunsigned int fdunsigned long length
9490005Elongsys_fchmodunsigned int fdmode_t mode
9590005Flongsys_fchown16unsigned int fdold_uid_t userold_gid_t group
96900060longsys_getpriorityint whichint who
97900061longsys_setpriorityint whichint whoint niceval
99900063longsys_statfsconst char * pathstruct statfs * buf
100900064longsys_fstatfsunsigned int fdstruct statfs * buf
102900066longsys_socketcallint callunsigned long *args
103900067longsys_syslogint typechar * bufint len
104900068longsys_setitimerint whichstruct itimerval *valuestruct itimerval *ovalue
105900069longsys_getitimerint whichstruct itimerval *value
10690006Alongsys_newstatchar * filenamestruct stat * statbuf
10790006Blongsys_newlstatchar * filenamestruct stat * statbuf
10890006Clongsys_newfstatunsigned int fdstruct stat * statbuf
11190006Fintsys_vforkstruct pt_regs *regs
114900072longsys_wait4pid_t pidunsigned int * stat_addrint optionsstruct rusage * ru
115900073longsys_swapoffconst char * specialfile
116900074longsys_sysinfostruct sysinfo *info
117900075intsys_ipcuint callint firstint secondint thirdvoid *ptrlong fifth
118900076longsys_fsyncunsigned int fd
119900077intsys_sigreturnstruct pt_regs *regs
120900078intsys_cloneunsigned long clone_flagsunsigned long newspstruct pt_regs *regs
121900079longsys_setdomainnamechar *nameint len
12290007Alongsys_newunamestruct new_utsname * name
12490007Clongsys_adjtimexstruct timex *txc_p
12590007Dunsigned longsys_mremapunsigned long addrunsigned long old_lenunsigned long new_lenunsigned long flagsunsigned long new_addr
12690007Elongsys_sigprocmaskint howold_sigset_t *setold_sigset_t *oset
12790007Funsigned longsys_create_moduleconst char *name_usersize_t size
128900080longsys_init_moduleconst char *name_userstruct module *mod_user
129900081longsys_delete_moduleconst char *name_user
130900082longsys_get_kernel_symsstruct kernel_sym *table
131900083longsys_quotactlint cmdconst char *specialint idcaddr_t addr
132900084longsys_getpgidpid_t pid
133900085longsys_fchdirunsigned int fd
134900086longsys_bdflushint funclong data
135900087longsys_sysfsint optionunsigned long arg1unsigned long arg2
136900088longsys_personalityu_long personality
13890008Alongsys_setfsuid16old_uid_t uid
13990008Blongsys_setfsgid16old_gid_t gid
14090008Clongsys_llseekunsigned int fdunsigned long offset_highunsigned long offset_lowloff_t * resultunsigned int origin
14190008Dlongsys_getdentsunsigned int fdvoid * direntunsigned int count
14290008Elongsys_selectint nfd_set *inpfd_set *outpfd_set *expstruct timeval *tvp
14390008Flongsys_flockunsigned int fdunsigned int cmd
144900090longsys_msyncunsigned long startsize_t lenint flags
145900091ssize_tsys_readvunsigned long fdconst struct iovec * vectorunsigned long count
146900092ssize_tsys_writevunsigned long fdconst struct iovec * vectorunsigned long count
147900093longsys_getsidpid_t pid
148900094longsys_fdatasyncunsigned int fd
150900096longsys_mlockunsigned long startsize_t len
151900097longsys_munlockunsigned long startsize_t len
152900098longsys_mlockallint flags
153900099longsys_munlockallvoid
15490009Alongsys_sched_setparampid_t pidstruct sched_param *param
15590009Blongsys_sched_getparampid_t pidstruct sched_param *param
15690009Clongsys_sched_setschedulerpid_t pidint policystruct sched_param *param
15790009Dlongsys_sched_getschedulerpid_t pid
15890009Elongsys_sched_yieldvoid
15990009Flongsys_sched_get_priority_maxint policy
1609000A0longsys_sched_get_priority_minint policy
1619000A1longsys_sched_rr_get_intervalpid_t pidstruct timespec *interval
1629000A2longsys_nanosleepstruct timespec *rqtpstruct timespec *rmtp
1639000A3unsigned longsys_arm_mremapunsigned long addrunsigned long old_lenunsigned long new_lenunsigned long flags
1649000A4longsys_setresuid16old_uid_t ruidold_uid_t euidold_uid_t suid
1659000A5longsys_getresuid16old_uid_t *ruidold_uid_t *euidold_uid_t *suid
1679000A7longsys_query_moduleconst char *name_userint whichchar *bufsize_t bufsizesize_t *ret
1689000A8longsys_pollstruct pollfd * ufdsunsigned int nfdslong timeout
1699000A9intsys_nfsservctlint cmdvoid *argpvoid *resp
1709000AAlongsys_setresgid16old_gid_t rgidold_gid_t egidold_gid_t sgid
1719000ABlongsys_getresgid16old_gid_t *rgidold_gid_t *egidold_gid_t *sgid
1729000AClongsys_prctlint optionunsigned long arg2unsigned long arg3unsigned long arg4unsigned long arg5
1739000ADintsys_rt_sigreturnstruct pt_regs *regs
1749000AElongsys_rt_sigactionint sigconst struct sigaction *actstruct sigaction *oactsize_t sigsetsize
1759000AFlongsys_rt_sigprocmaskint howsigset_t *setsigset_t *osetsize_t sigsetsize
1769000B0longsys_rt_sigpendingsigset_t *setsize_t sigsetsize
1779000B1longsys_rt_sigtimedwaitconst sigset_t *uthesesiginfo_t *uinfoconst struct timespec *utssize_t sigsetsize
1789000B2longsys_rt_sigqueueinfoint pidint sigsiginfo_t *uinfo
1799000B3intsys_rt_sigsuspendsigset_t *unewsetsize_t sigsetsizestruct pt_regs *regs
1809000B4ssize_tsys_preadunsigned int fdchar * bufsize_t countloff_t pos
1819000B5ssize_tsys_pwriteunsigned int fdconst char * bufsize_t countloff_t pos
1829000B6longsys_chown16const char * filenameold_uid_t userold_gid_t group
1839000B7longsys_getcwdchar *bufunsigned long size
1849000B8longsys_capgetcap_user_header_t headercap_user_data_t dataptr
1859000B9longsys_capsetcap_user_header_t headerconst cap_user_data_t data
1869000BAintsys_sigactionint sigconst struct old_sigaction *actstruct old_sigaction *oact
1879000BBssize_tsys_sendfileint out_fdint in_fdoff_t *offsetsize_t count
1909000BElongsys_utimeschar * filenamestruct timeval * utimes
1919000BFlongsys_getrlimitunsigned int resourcestruct rlimit *rlim
1929000C0longsys_mmap2unsigned long addrunsigned long lenunsigned long protunsigned long flagsunsigned long fdunsigned long pgoff
1939000C1longsys_truncate64const char * pathloff_t length
1949000C2longsys_ftruncate64unsigned int fdloff_t length
1959000C3longsys_stat64char * filenamestruct stat64 * statbuflong flags
1969000C4longsys_lstat64char * filenamestruct stat64 * statbuflong flags
1979000C5longsys_fstat64unsigned long fdstruct stat64 * statbuflong flags
1989000C6longsys_lchownconst char * filenameuid_t usergid_t group
1999000C7longsys_getuidvoid
2009000C8longsys_getgidvoid
2019000C9longsys_geteuidvoid
2029000CAlongsys_getegidvoid
2039000CBlongsys_setreuiduid_t ruiduid_t euid
2049000CClongsys_setregidgid_t rgidgid_t egid
2059000CDlongsys_getgroupsint gidsetsizegid_t *grouplist
2069000CElongsys_setgroupsint gidsetsizegid_t *grouplist
2079000CFlongsys_fchownunsigned int fduid_t usergid_t group
2089000D0longsys_setresuiduid_t ruiduid_t euiduid_t suid
2099000D1longsys_getresuiduid_t *ruiduid_t *euiduid_t *suid
2109000D2longsys_setresgidgid_t rgidgid_t egidgid_t sgid
2119000D3longsys_getresgidgid_t *rgidgid_t *egidgid_t *sgid
2129000D4longsys_chownconst char * filenameuid_t usergid_t group
2139000D5longsys_setuiduid_t uid
2149000D6longsys_setgidgid_t gid
2159000D7longsys_setfsuiduid_t uid
2169000D8longsys_setfsgidgid_t gid
2179000D9longsys_getdents64unsigned int fdvoid * direntunsigned int count
2189000DAlongsys_pivot_rootconst char *new_rootconst char *put_old
2199000DBlongsys_mincoreunsigned long startsize_t lenunsigned char * vec
2209000DClongsys_madviseunsigned long startsize_t lenint behavior
2219000DDlongsys_fcntl64unsigned int fdunsigned int cmdunsigned long arg
2249000E0longsys_gettidvoid
2259000E1ssize_tsys_readaheadint fdloff_t offsetsize_t count
S1longsys_socketint familyint typeint protocol
S2longsys_bindint fdstruct sockaddr *umyaddrint addrlen
S3longsys_connectint fdstruct sockaddr *uservaddrint addrlen
S4longsys_listenint fdint backlog
S5longsys_acceptint fdstruct sockaddr *upeer_sockaddrint *upeer_addrlen
S6longsys_getsocknameint fdstruct sockaddr *usockaddrint *usockaddr_len
S7longsys_getpeernameint fdstruct sockaddr *usockaddrint *usockaddr_len
S8longsys_socketpairint familyint typeint protocolint usockvec[2]
S9longsys_sendint fdvoid * buffsize_t lenunsigned flags
S10longsys_recvint fdvoid * ubufsize_t sizeunsigned flags
S11longsys_sendtoint fdvoid * buffsize_t lenunsigned flagsstruct sockaddr *addrint addr_len
S12longsys_recvfromint fdvoid * ubufsize_t sizeunsigned flagsstruct sockaddr *addrint *addr_len
S13longsys_shutdownint fdint how
S14longsys_setsockoptint fdint levelint optnamechar *optvalint optlen
S15longsys_getsockoptint fdint levelint optnamechar *optvalint *optlen
S16longsys_sendmsgint fdstruct msghdr *msgunsigned flags
S17longsys_recvmsgint fdstruct msghdr *msgunsigned int flags

先頭が S でとなっている行は、ネットワーク関連のシステムコールで sys_socketcall (102) の第1引数に次の列の番号 (10進) を設定して呼び出します。 引数はメモリに格納して先頭アドレスを sys_socketcall の第2引数に設定します。