GEM5中模拟的系统调用(部分没实现)

1.全部系统调用
"syscall", // 0
37 "exit", // 1
38 "fork", // 2
39 "read", // 3
40 "write", // 4
41 "old_open", // 5
42 "close", // 6
43 "wait4", // 7
44 "old_creat", // 8
45 "link", // 9
46 
47 "unlink", // 10
48 "execv", // 11
49 "chdir", // 12
50 "fchdir", // 13
51 "mknod", // 14
52 "chmod", // 15
53 "chown", // 16
54 "obreak", // 17
55 "pre_F64_getfsstat", // 18
56 "lseek", // 19
57 
58 "getpid", // 20
59 "mount", // 21
60 "unmount", // 22
61 "setuid", // 23
62 "getuid", // 24
63 "exec_with_loader", // 25
64 "ptrace", // 26
65 "recvmsg", // 27
66 "sendmsg", // 28
67 "recvfrom", // 29
68 
69 "accept", // 30
70 "getpeername", // 31
71 "getsockname", // 32
72 "access", // 33
73 "chflags", // 34
90 
91 "setlogin", // 50
92 "acct", // 51
93 "sigpending", // 52
94 "classcntl", // 53
95 "ioctl", // 54
96 "reboot", // 55
97 "revoke", // 56
98 "symlink", // 57
99 "readlink", // 58
100 "execve", // 59
101 
102 "umask", // 60
103 "chroot", // 61
104 "old_fstat", // 62
105 "getpgrp", // 63
106 "getpagesize", // 64
107 "mremap", // 65
108 "vfork", // 66
109 "pre_F64_stat", // 67
110 "pre_F64_lstat", // 68
111 "sbrk", // 69
112 
113 "sstk", // 70
114 "mmap", // 71
115 "ovadvise", // 72
116 "munmap", // 73
117 "mprotect", // 74
118 "madvise", // 75
119 "old_vhangup", // 76
120 "kmodcall", // 77
121 "mincore", // 78
122 "getgroups", // 79
123 
124 "setgroups", // 80
125 "old_getpgrp", // 81
126 "setpgrp", // 82
127 "setitimer", // 83
128 "old_wait", // 84
129 "table", // 85
130 "getitimer", // 86
131 "gethostname", // 87
132 "sethostname", // 88
133 "getdtablesize", // 89
134 
135 "dup2", // 90
136 "pre_F64_fstat", // 91
137 "fcntl", // 92
138 "select", // 93
139 "poll", // 94
140 "fsync", // 95
141 "setpriority", // 96
142 "socket", // 97
143 "connect", // 98
144 "old_accept", // 99
145 
146 "getpriority", // 100
147 "old_send", // 101
148 "old_recv", // 102
149 "sigreturn", // 103
150 "bind", // 104
151 "setsockopt", // 105
152 "listen", // 106
153 "plock", // 107
154 "old_sigvec", // 108
155 "old_sigblock", // 109
156 
157 "old_sigsetmask", // 110
158 "sigsuspend", // 111
159 "sigstack", // 112
160 "old_recvmsg", // 113
161 "old_sendmsg", // 114
162 "obsolete_vtrcae", // 115
163 "gettimeofday", // 116
164 "getrusage", // 117
165 "getsockopt", // 118
166 "numa_syscalls", // 119
167 
168 "readv", // 120
169 "writev", // 121
170 "settimeofday", // 122
171 "fchown", // 123
172 "fchmod", // 124
"old_recvfrom", // 125
174 "setreuid", // 126
175 "setregid", // 127
176 "rename", // 128
177 "truncate", // 129
178 
179 "ftruncate", // 130
180 "flock", // 131
181 "setgid", // 132
182 "sendto", // 133
183 "shutdown", // 134
184 "socketpair", // 135
185 "mkdir", // 136
186 "rmdir", // 137
187 "utimes", // 138
188 "obsolete_42_sigreturn", // 139
189 
190 "adjtime", // 140
191 "old_getpeername", // 141
192 "gethostid", // 142
193 "sethostid", // 143
194 "getrlimit", // 144
195 "setrlimit", // 145
196 "old_killpg", // 146
197 "setsid", // 147
198 "quotactl", // 148
199 "oldquota", // 149
"old_getsockname", // 150
202 "pread", // 151
203 "pwrite", // 152
204 "pid_block", // 153
205 "pid_unblock", // 154
206 "signal_urti", // 155
207 "sigaction", // 156
208 "sigwaitprim", // 157
209 "nfssvc", // 158
210 "getdirentries", // 159
211 
212 "pre_F64_statfs", // 160
213 "pre_F64_fstatfs", // 161
214 0, // 162
215 "async_daemon", // 163
216 "getfh", // 164
217 "getdomainname", // 165
218 "setdomainname", // 166
219 0, // 167
220 0, // 168
221 "exportfs", // 169
222 
223 0, // 170
224 0, // 171
225 0, // 172
226 0, // 173
227 0, // 174
0, // 175
229 0, // 176
230 0, // 177
231 0, // 178
232 0, // 179
233 
234 0, // 180
235 "alt_plock", // 181
236 0, // 182
237 0, // 183
238 "getmnt", // 184
239 0, // 185
240 0, // 186
241 "alt_sigpending", // 187
242 "alt_setsid", // 188
243 0, // 189
244 
245 0, // 190
246 0, // 191
247 0, // 192
248 0, // 193
249 0, // 194
250 0, // 195
251 0, // 196
252 0, // 197
253 0, // 198
254 "swapon", // 199
"msgctl", // 200
257 "msgget", // 201
258 "msgrcv", // 202
259 "msgsnd", // 203
260 "semctl", // 204
261 "semget", // 205
262 "semop", // 206
263 "uname", // 207
264 "lchown", // 208
265 "shmat", // 209
266 
267 "shmctl", // 210
268 "shmdt", // 211
269 "shmget", // 212
270 "mvalid", // 213
271 "getaddressconf", // 214
272 "msleep", // 215
273 "mwakeup", // 216
274 "msync", // 217
275 "signal", // 218
276 "utc_gettime", // 219
277 
278 "utc_adjtime", // 220
279 0, // 221
280 "security", // 222
281 "kloadcall", // 223
282 "stat", // 224
"lstat", // 225
284 "fstat", // 226
285 "statfs", // 227
286 "fstatfs", // 228
287 "getfsstat", // 229
288 
289 "gettimeofday64", // 230
290 "settimeofday64", // 231
291 0, // 232
292 "getpgid", // 233
293 "getsid", // 234
294 "sigaltstack", // 235
295 "waitid", // 236
296 "priocntlset", // 237
297 "sigsendset", // 238
298 "set_speculative", // 239
299 
300 "msfs_syscall", // 240
301 "sysinfo", // 241
302 "uadmin", // 242
303 "fuser", // 243
304 "proplist_syscall", // 244
305 "ntp_adjtime", // 245
306 "ntp_gettime", // 246
307 "pathconf", // 247
308 "fpathconf", // 248
309 "sync2", // 249
"uswitch", // 250
312 "usleep_thread", // 251
313 "audcntl", // 252
314 "audgen", // 253
315 "sysfs", // 254
316 "subsys_info", // 255
317 "getsysinfo", // 256
318 "setsysinfo", // 257
319 "afs_syscall", // 258
320 "swapctl", // 259
321 
322 "memcntl", // 260
323 "fdatasync", // 261
324 "oflock", // 262
325 "_F64_readv", // 263
326 "_F64_writev", // 264
327 "cdslxlate", // 265
328 "sendfile", // 266

2. GEM5系统调用相关文件(X86架构)
  • src/sim/syscall_emul.*(具体实现了相关系统调用)
  • src/arch/x86/linux/syscall.*(调用src/sim/syscall_emul.*实现针对X86架构的系统调用)

3. GEM5已经实现的系统调用
(1)X86_64架构(SyscallDesc型数组 X86_64LinuxProcess::syscallDescs)
  • read:读文件,由src/sim/syscal_emul.*中的readFunc实现;
  • write:写文件,由writeFunc实现;
  • open:打开文件,由openFunc<X86Linux64>实现;
  • close:关闭文件,由closeFunc实现;
  • stat:获取文件信息,由stat64Func<X86Linux64>实现;
  • fstat:lstat64Func<X86Linux64>
  • lstat:lstat64Func<X86Linux64>
  • lseek:lseekFunc
  • mmap:mmapFunc<X86Linux64>
  • munmap:munmapFunc
  • brk:brkFunc
  • ioctl:ioctlFunc<X86Linux64>
  • writev:writevFunc<X86Linux64>
  • mremap:mremapFunc<X86Linux64>
  • dup:dupFunc
  • getpid:getpidFunc
  • clone:cloneFunc
  • exit:exitFunc
  • uname:unameFunc
  • fcntl:fcntlFunc
  • truncate:truncateFunc
  • ftruncate:ftruncateFunc
  • getcwd:getcwdFunc
  • rename:renameFunc
  • readlink:readlinkFunc
  • gettimeofday:gettimeofdayFunc<X86Linux64>
  • getrlimit:getrlimitFunc<X86Linux64>
  • getrusage:getrusageFunc<X86Linux64>
  • sysinfo:sysinfoFunc<X86Linux64>
  • times:timesFunc<X86Linux64>
  • getuid:getuidFunc
  • getgid:getgidFunc
  • getppid:getppidFunc
  • arch_prctl:archPrctlFunc
  • time:timeFunc<X86Linux64>
  • futex:futexFunc<X86Linux64>
  • exit_group:exitGroupFunc

(2)I386架构
  • exit:exitFunc
  • read:readFunc
  • write:writeFunc
  • open:openFunc<X86Linux32>
  • close:closeFunc
  • time:timeFunc<X86Linux32>
  • getuid:getuidFunc
  • dup:dupFunc
  • times:timesFunc<X86Linux32>
  • brk:brkFunc
  • getgid:getgidFunc
  • geteuid:geteuidFunc
  • getegid:getegidFunc
  • ioctl:ioctlFunc<X86Linux32>
  • getrlimit: getrlimitFunc<X86Linux32>
  • getrusage:getrusageFunc<X86Linux32>
  • munmap:munmapFunc
  • truncate:truncateFunc
  • ftruncate:ftruncateFunc
  • sysinfo:sysinfoFunc<X86Linux32>
  • uname:unameFunc
  • _llseek:_llseekFunc
  • writev:writevFunc<X86Linux32>
  • getcwd:getcwdFunc
  • mmap2:mmapFunc<X86Linux32>
  • truncate64:truncate64Func
  • ftruncate64:ftruncate64Func
  • stat64:stat64Func<X86Linux32>
  • fstat64:fstat64Func<X86Linux32>
  • getuid32:getuidFunc
  • getgid32:getgidFunc
  • getegid32:geteuidFunc
  • geteuid32:getegidFunc
  • set_thread_area:setThreadArea32Func
  • exit_group:exitFunc

3. GEM5没有实现的系统调用(unimplementedFunc/ignored syscall)
(1) X86_64架构
  • poll:
  • rt_sigreturn:
  • pread64:
  • pwrite64:
  • pipe
  • select:
  • sched_yield:
  • msync:
  • mincore:
  • madvise:
  • shmget:
  • shmat:
  • shmctl:
  • dup2:
  • pause:
  • nanosleep:
  • getitimer:
  • alarm:
  • setitimer:
  • sendfile:
  • socket/connect/accept/sendto/recvfrom/bind/listen/getsockname/getpeername/socketpair/setsockopt/getsockopt:
  • sendmsg/recvmsg:
  • shutdown:
  • fork/vfork/execve/wait4:
  • kill:
  • semget/semop/semctl:
  • shmdt:
  • msgget/msgsnd/msgrcv/msgctl:
  • flock:
  • fsync:
  • fdatasync/getdents:
  • chdir/fchdir/mkdir/rmdir:
  • creat:
  • link/symlink:
  • chmod/fchmod/chown/lchown:
  • umask/ptrace:
  • syslog/setuid/setgid:
  • setpgid:
  • getpgrp/setsid/setreuid/setregid/getgroups/setgroups/setresuid/getresuid/setresgid/getresgid/getpgid/setfsuid/setfsgid/getsid:
  • capget/capset:
  • rt_sigpending/rt_sigtimedwait/rt_sigqueueinfo/rt_sigsuspend:
  • sigaltstack:
  • utime
  • mknod
  • uselib
  • personality
  • ustat
  • statfs
  • fstatfs
  • sysfs
  • getpriority
  • setpriority
  • sched_setparam/sched_getparam/sched_setscheduler/sched_getscheduler/sched_get_priority_max/sched_rr_get_interval:
  • mlock/munlock/mlockall/munlockall:
  • vhangup:
  • modify_ldt
  • pivot_root
  • _sysctl/prctl/arch_prctl
  • adjtimex
  • setrlimit(ignored)
  • chroot
  • sync
  • acct
  • settimeofday
  • mount/umount2/swapon/swapoff:
  • reboot:
  • sethostname/setdomainname
  • iopl/ioperm
  • create_module/init_module/delete_module/query_module
  • get_kernel_syms
  • quotactl/nfsservctl
  • getpmsg/putpmsg:
  • afs_syscall/tuxcall:
  • security:
  • gettid:
  • readahead:
  • setxattr/lsetxattr/fsetxattr/getxattr/lgetxattr/fgetxattr/listxattr/llistxattr/flistxattr/removexattr/lremovexattr/fremovexattr:
  • tkill:
  • sched_setaffinity/sched_getaffinity:
  • set_thread_area/get_thread_area:
  • io_setup/io_destroy/io_getevents/io_submit/io_cancel
  • lookup_dcookie
  • epoll_create/epoll_ctl_old/epoll_wait_old:
  • remap_file_pages:
  • getdents64:
  • set_tid_address:
  • restart_syscall:
  • semtimedop:
  • fadvise64:
  • timer_create/timer_settime/timer_gettime/timer_getoverrun/timer_delete:
  • clock_settime/clock_gettime/clock_getres/clock_nanosleep:
  • epoll_wait/epoll_ctl:
  • tgkill/utimes/vserver:
  • mbind
  • set_mempolicy/get_mempolicy:
  • mq_open/mq_unlink/mq_timedsend/mq_timedsend/mq_timedreceive/mq_notify/mq_getsetattr:
  • kexec_load:
  • waitid:
  • add_key/request_key/keyctl:
  • ioprio_set/ioprio_get:
  • inotify_init/inotify_add_watch/inotify_rm_watch:
  • migrate_pages:
  • openat/mkdirat/mknodat:
  • fchownat/futimesat/newfstatat/unlinkat/renameat/linkat/symlinkat/readlinkat/fchmodat/faccessat
  • pselect6
  • ppoll
  • unshare
(2) I386架构
  • restart_syscall
  • fork
  • waitpid
  • creat
  • link/unlink
  • execve
  • chdir
  • time
  • mknod
  • chmod/lchown
  • break
  • oldstat/oldfstat
  • lseek
  • getpid
  • mount/umount
  • setuid
  • stime
  • ptrace
  • alarm
  • pause
  • utime
  • stty/gtty
  • access(ignored)
  • nice
  • ftime
  • sync
  • kill
  • rename
  • mkdir
  • rmdir
  • pipe
  • prof
  • setgid
  • signal
  • acct
  • umount2
  • lock
  • fcntl
  • mpx
  • setpgid
  • ulimit
  • oldolduname
  • umask
  • chroot
  • ustat
  • dup2
  • getppid/getpgrp/setsid
  • sigaction
  • sgetmask/ssetmask
  • setreuid/setregid:
  • sigsuspend/sigpending:
  • sethostname
  • setrlimit(ignored)
  • gettimeofday/settimeofday:
  • getgroups/setgroups:
  • select
  • symlink/readlink
  • oldlstat
  • uselib
  • swapon
  • reboot
  • readdir
  • mmap/munmap
  • fchmod/fchown
  • ioperm
  • socketcall
  • syslog
  • setitimer/getitimer
  • stat/lstat/fstat
  • olduname/iopl
  • vhangup
  • idle
  • vm86old
  • wait4
  • swapoff
  • ipc/fsync
  • sigreturn/clone
  • setdomainname
  • modify_ldt
  • adjtimex
  • sigprocmask
  • mprotect(ignored)
  • sigprocmask
  • create_module/init_module/delete_module
  • get_kernel_syms
  • quotactl
  • getpgid
  • fchdir
  • bdflush/sysfs/personality
  • afs_syscall
  • setfsuid/setfsgid
  • getdents
  • _newselect
  • flock
  • msync
  • readv
  • getsid
  • fdatasync
  • _sysctl
  • mlock/munlock/mlockall/munlockall
  • sched_setparam/sched_getparam/sched_setscheduler/sched_getscheduler/sched_yield/sched_get_priority_max/sched_get_priority_min/sched_rr_get_interval
  • nanosleep
  • mremap/setresuid/getresuid
  • vm86
  • query_module
  • poll
  • nfsservctl
  • setresgid/getresgid
  • prctl
  • rt_sigreturn/rt_sigaction/rt_sigprocmask/rt_sigpending/rt_sigtimedwait/rt_sigqueueinfo/rt_sigsuspend
  • pread64
  • pwrite64
  • chown
  • capget/capset
  • sigaltstack
  • sendfile
  • getpmsg/putpmsg
  • vfork
  • ugetrlimit
  • lstat64/fstat64
  • lchown32
  • getuid32/getgid32/geteuid32/setregid32/getgroups32/setgroups32
  • fchown32
  • setresuid32/getresuid32/setresgid32/getresgid32
  • chown32
  • setuid32/setgid32
  • setfsuid32/setfsgid32
  • pivot_root
  • mincore/madvise/madvise1/getdents64
  • fcntl64
  • unused
  • gettid
  • readahead
  • setxattr/lsetxattr/fsetxattr/getxattr/lgetxattr/fgetxattr/listxattr/llistxattr/flistxattr/removexattr/lremovexattr/fremovexattr
  • tkill
  • sendfile64
  • futex
  • sched_setaffinity/sched_getaffinity
  • set_thread_area/get_thread_area
  • io_setup/io_destroy/io_getevents/io_submit/io_cancel
  • fadvise64
  • unused
  • lookup_dcookie
  • epoll_create/epoll_ctl/epoll_wait
  • remap_file_pages
  • set_tid_address
  • timer_create/timer_settime/timer_gettime/timer_getoverrun/timer_delete
  • clock_settime/clock_gettime/clock_getres/clock_nanosleep
  • statfs64/fstatfs64
  • tgkill
  • utimes
  • fadvise64_64
  • vserver
  • mbind
  • get_mempolicy/set_mempolicy
  • mq_open/mq_unlink/mq_timedsend/mq_timedreceive/mq_notify/mq_getsetattr
  • kexec_load
  • waitid
  • sys_setaltroot
  • add_key/request_key/keyctl
  • ioprio_set/ioprio_get
  • inotify_init/inotify_add_watch/inotify_rm_watch
  • migrate_pages
  • openat/mkdirat/mknodat/fchownat/futimesat/fstatat64
  • unlinkat/renameat/linkat/symlinkat/readlinkat/fchmodat/faccessat
  • pselect6/ppoll
  • unshare
  • set_robust_list/get_robust_list
  • splice/vmsplice
  • sync_file_range
  • tee
  • move_pages
  • getcpu
  • epoll_pwait
  • utimensat
  •  signalfd
  • timerfd
  • eventfd

原文地址:https://www.cnblogs.com/cyjsegull/p/4526293.html