initial import
[patches.git] / qemu-friendlier-syscall.patch
1 --- linux-user/syscall.c 22 Mar 2007 15:08:55 -0000 1.95
2 +++ linux-user/syscall.c 31 Mar 2007 08:36:00 -0000
3 @@ -2043,6 +2047,7 @@ long do_syscall(void *cpu_env, int num,
4 case TARGET_NR_fork:
5 ret = get_errno(do_fork(cpu_env, SIGCHLD, 0));
6 break;
7 +#ifdef TARGET_NR_waitpid
8 case TARGET_NR_waitpid:
9 {
10 int status;
11 @@ -2051,6 +2056,7 @@ long do_syscall(void *cpu_env, int num,
12 tput32(arg2, status);
13 }
14 break;
15 +#endif
16 case TARGET_NR_creat:
17 p = lock_user_string(arg1);
18 ret = get_errno(creat(p, arg2));
19 @@ -2179,11 +2185,13 @@ long do_syscall(void *cpu_env, int num,
20 unlock_user(p3, arg3, 0);
21 break;
22 }
23 +#ifdef TARGET_NR_umount
24 case TARGET_NR_umount:
25 p = lock_user_string(arg1);
26 ret = get_errno(umount(p));
27 unlock_user(p, arg1, 0);
28 break;
29 +#endif
30 case TARGET_NR_stime:
31 {
32 time_t host_time;
33 @@ -2203,6 +2211,7 @@ long do_syscall(void *cpu_env, int num,
34 case TARGET_NR_pause:
35 ret = get_errno(pause());
36 break;
37 +#ifdef TARGET_NR_utime
38 case TARGET_NR_utime:
39 {
40 struct utimbuf tbuf, *host_tbuf;
41 @@ -2221,6 +2230,7 @@ long do_syscall(void *cpu_env, int num,
42 unlock_user(p, arg1, 0);
43 }
44 break;
45 +#endif
46 case TARGET_NR_utimes:
47 {
48 struct timeval *tvp, tv[2];
49 @@ -2317,9 +2327,10 @@ long do_syscall(void *cpu_env, int num,
50 case TARGET_NR_prof:
51 goto unimplemented;
52 #endif
53 +#ifdef TARGET_NR_signal
54 case TARGET_NR_signal:
55 goto unimplemented;
56 -
57 +#endif
58 case TARGET_NR_acct:
59 p = lock_user_string(arg1);
60 ret = get_errno(acct(path(p)));
61 @@ -2377,6 +2388,7 @@ long do_syscall(void *cpu_env, int num,
62 case TARGET_NR_setsid:
63 ret = get_errno(setsid());
64 break;
65 +#ifdef TARGET_NR_sigaction
66 case TARGET_NR_sigaction:
67 {
68 #if !defined(TARGET_MIPS)
69 @@ -2431,6 +2443,7 @@ long do_syscall(void *cpu_env, int num,
70 #endif
71 }
72 break;
73 +#endif
74 case TARGET_NR_rt_sigaction:
75 {
76 struct target_sigaction *act;
77 @@ -2472,6 +2485,7 @@ long do_syscall(void *cpu_env, int num,
78 ret = target_set;
79 }
80 break;
81 +#ifdef TARGET_NR_sigprocmask
82 case TARGET_NR_sigprocmask:
83 {
84 int how = arg1;
85 @@ -2508,6 +2522,7 @@ long do_syscall(void *cpu_env, int num,
86 }
87 }
88 break;
89 +#endif
90 case TARGET_NR_rt_sigprocmask:
91 {
92 int how = arg1;
93 @@ -2544,6 +2559,7 @@ long do_syscall(void *cpu_env, int num,
94 }
95 }
96 break;
97 +#ifdef TARGET_NR_sigpending
98 case TARGET_NR_sigpending:
99 {
100 sigset_t set;
101 @@ -2555,6 +2571,7 @@ long do_syscall(void *cpu_env, int num,
102 }
103 }
104 break;
105 +#endif
106 case TARGET_NR_rt_sigpending:
107 {
108 sigset_t set;
109 @@ -2566,6 +2583,7 @@ long do_syscall(void *cpu_env, int num,
110 }
111 }
112 break;
113 +#ifdef TARGET_NR_sigsuspend
114 case TARGET_NR_sigsuspend:
115 {
116 sigset_t set;
117 @@ -2575,6 +2593,7 @@ long do_syscall(void *cpu_env, int num,
118 ret = get_errno(sigsuspend(&set));
119 }
120 break;
121 +#endif
122 case TARGET_NR_rt_sigsuspend:
123 {
124 sigset_t set;
125 @@ -2616,10 +2635,12 @@ long do_syscall(void *cpu_env, int num,
126 ret = get_errno(sys_rt_sigqueueinfo(arg1, arg2, &uinfo));
127 }
128 break;
129 +#ifdef TARGET_NR_sigreturn
130 case TARGET_NR_sigreturn:
131 /* NOTE: ret is eax, so not transcoding must be done */
132 ret = do_sigreturn(cpu_env);
133 break;
134 +#endif
135 case TARGET_NR_rt_sigreturn:
136 /* NOTE: ret is eax, so not transcoding must be done */
137 ret = do_rt_sigreturn(cpu_env);
138 @@ -2725,17 +2746,24 @@ long do_syscall(void *cpu_env, int num,
139 unlock_user(p, arg1, 0);
140 }
141 break;
142 +#ifdef TARGET_NR_uselib
143 case TARGET_NR_uselib:
144 goto unimplemented;
145 +#endif
146 +#ifdef TARGET_NR_swapon
147 case TARGET_NR_swapon:
148 p = lock_user_string(arg1);
149 ret = get_errno(swapon(p, arg2));
150 unlock_user(p, arg1, 0);
151 break;
152 +#endif
153 case TARGET_NR_reboot:
154 goto unimplemented;
155 +#ifdef TARGET_NR_readdir
156 case TARGET_NR_readdir:
157 goto unimplemented;
158 +#endif
159 +#ifdef TARGET_NR_mmap
160 case TARGET_NR_mmap:
161 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_M68K)
162 {
163 @@ -2760,6 +2788,7 @@ long do_syscall(void *cpu_env, int num,
164 arg6));
165 #endif
166 break;
167 +#endif
168 #ifdef TARGET_NR_mmap2
169 case TARGET_NR_mmap2:
170 #if defined(TARGET_SPARC) || defined(TARGET_MIPS)
171 @@ -2779,25 +2808,37 @@ long do_syscall(void *cpu_env, int num,
172 case TARGET_NR_mprotect:
173 ret = get_errno(target_mprotect(arg1, arg2, arg3));
174 break;
175 +#ifdef TARGET_NR_mremap
176 case TARGET_NR_mremap:
177 ret = get_errno(target_mremap(arg1, arg2, arg3, arg4, arg5));
178 break;
179 +#endif
180 /* ??? msync/mlock/munlock are broken for softmmu. */
181 +#ifdef TARGET_NR_msync
182 case TARGET_NR_msync:
183 ret = get_errno(msync(g2h(arg1), arg2, arg3));
184 break;
185 +#endif
186 +#ifdef TARGET_NR_mlock
187 case TARGET_NR_mlock:
188 ret = get_errno(mlock(g2h(arg1), arg2));
189 break;
190 +#endif
191 +#ifdef TARGET_NR_munlock
192 case TARGET_NR_munlock:
193 ret = get_errno(munlock(g2h(arg1), arg2));
194 break;
195 +#endif
196 +#ifdef TARGET_NR_mlockall
197 case TARGET_NR_mlockall:
198 ret = get_errno(mlockall(arg1));
199 break;
200 +#endif
201 +#ifdef TARGET_NR_munlockall
202 case TARGET_NR_munlockall:
203 ret = get_errno(munlockall());
204 break;
205 +#endif
206 case TARGET_NR_truncate:
207 p = lock_user_string(arg1);
208 ret = get_errno(truncate(p, arg2));
209 @@ -2875,10 +2916,11 @@ long do_syscall(void *cpu_env, int num,
210 case TARGET_NR_ioperm:
211 goto unimplemented;
212 #endif
213 +#ifdef TARGET_NR_socketcall
214 case TARGET_NR_socketcall:
215 ret = do_socketcall(arg1, arg2);
216 break;
217 -
218 +#endif
219 #ifdef TARGET_NR_accept
220 case TARGET_NR_accept:
221 ret = do_accept(arg1, arg2, arg3);
222 @@ -3087,11 +3129,13 @@ long do_syscall(void *cpu_env, int num,
223 }
224 }
225 break;
226 +#ifdef TARGET_NR_swapoff
227 case TARGET_NR_swapoff:
228 p = lock_user_string(arg1);
229 ret = get_errno(swapoff(p));
230 unlock_user(p, arg1, 0);
231 break;
232 +#endif
233 case TARGET_NR_sysinfo:
234 {
235 struct target_sysinfo *target_value;
236 @@ -3119,9 +3163,11 @@ long do_syscall(void *cpu_env, int num,
237 }
238 }
239 break;
240 +#ifdef TARGET_NR_ipc
241 case TARGET_NR_ipc:
242 ret = do_ipc(arg1, arg2, arg3, arg4, arg5, arg6);
243 break;
244 +#endif
245 case TARGET_NR_fsync:
246 ret = get_errno(fsync(arg1));
247 break;
248 @@ -3170,10 +3216,14 @@ long do_syscall(void *cpu_env, int num,
249 #endif
250 case TARGET_NR_adjtimex:
251 goto unimplemented;
252 +#ifdef TARGET_NR_create_module
253 case TARGET_NR_create_module:
254 +#endif
255 case TARGET_NR_init_module:
256 case TARGET_NR_delete_module:
257 +#ifdef TARGET_NR_get_kernel_syms
258 case TARGET_NR_get_kernel_syms:
259 +#endif
260 goto unimplemented;
261 case TARGET_NR_quotactl:
262 goto unimplemented;
263 @@ -3185,13 +3235,17 @@ long do_syscall(void *cpu_env, int num,
264 break;
265 case TARGET_NR_bdflush:
266 goto unimplemented;
267 +#ifdef TARGET_NR_sysfs
268 case TARGET_NR_sysfs:
269 goto unimplemented;
270 +#endif
271 case TARGET_NR_personality:
272 ret = get_errno(personality(arg1));
273 break;
274 +#ifdef TARGET_NR_afs_syscall
275 case TARGET_NR_afs_syscall:
276 goto unimplemented;
277 +#endif
278 case TARGET_NR__llseek:
279 {
280 #if defined (__x86_64__)
281 @@ -3305,9 +3359,12 @@ long do_syscall(void *cpu_env, int num,
282 }
283 break;
284 #endif /* TARGET_NR_getdents64 */
285 +#ifdef TARGET_NR__newselect
286 case TARGET_NR__newselect:
287 ret = do_select(arg1, arg2, arg3, arg4, arg5);
288 break;
289 +#endif
290 +#ifdef TARGET_NR_poll
291 case TARGET_NR_poll:
292 {
293 struct target_pollfd *target_pfd;
294 @@ -3333,6 +3390,7 @@ long do_syscall(void *cpu_env, int num,
295 unlock_user(target_pfd, arg1, ret);
296 }
297 break;
298 +#endif
299 case TARGET_NR_flock:
300 /* NOTE: the flock constant seems to be the same for every
301 Linux platform */
302 @@ -3434,10 +3492,14 @@ long do_syscall(void *cpu_env, int num,
303 }
304 }
305 break;
306 +#ifdef TARGET_NR_query_module
307 case TARGET_NR_query_module:
308 goto unimplemented;
309 +#endif
310 +#ifdef TARGET_NR_nfsservctl
311 case TARGET_NR_nfsservctl:
312 goto unimplemented;
313 +#endif
314 case TARGET_NR_prctl:
315 switch (arg1)
316 {
317 @@ -3970,8 +4032,10 @@ long do_syscall(void *cpu_env, int num,
318 case TARGET_NR_gettid:
319 ret = get_errno(gettid());
320 break;
321 +#ifdef TARGET_NR_readahead
322 case TARGET_NR_readahead:
323 goto unimplemented;
324 +#endif
325 #ifdef TARGET_NR_setxattr
326 case TARGET_NR_setxattr:
327 case TARGET_NR_lsetxattr: