1
apply patch to fix debian bug #562887, qemu-user-static mipsel emulation not
3
http://lists.nongnu.org/archive/html/qemu-devel/2011-07/msg00313.html
5
Index: qemu-0.14.1.1/linux-user/main.c
6
===================================================================
7
--- qemu-0.14.1.1.orig/linux-user/main.c 2011-07-04 19:37:39.000000000 +0200
8
+++ qemu-0.14.1.1/linux-user/main.c 2011-07-05 10:39:30.000000000 +0200
10
MIPS_SYS(sys_getcwd , 2)
11
MIPS_SYS(sys_capget , 2)
12
MIPS_SYS(sys_capset , 2) /* 4205 */
13
- MIPS_SYS(sys_sigaltstack , 0)
14
+ MIPS_SYS(sys_sigaltstack , 2)
15
MIPS_SYS(sys_sendfile , 4)
16
MIPS_SYS(sys_ni_syscall , 0)
17
MIPS_SYS(sys_ni_syscall , 0)
18
@@ -1985,6 +1985,20 @@
19
MIPS_SYS(sys_epoll_pwait, 6)
20
MIPS_SYS(sys_ioprio_set, 3)
21
MIPS_SYS(sys_ioprio_get, 2)
22
+ MIPS_SYS(sys_utimensat, 4)
23
+ MIPS_SYS(sys_ni_syscall, 0) /* signalfd */
24
+ MIPS_SYS(sys_ni_syscall, 0) /* timerfd */
25
+ MIPS_SYS(sys_eventfd, 1)
26
+ MIPS_SYS(sys_fallocate, 4)
27
+ MIPS_SYS(sys_ni_syscall, 0) /* timerfd_create */
28
+ MIPS_SYS(sys_ni_syscall, 0) /* timerfd_gettime */
29
+ MIPS_SYS(sys_ni_syscall, 0) /* timerfd_settime */
30
+ MIPS_SYS(sys_ni_syscall, 0) /* signalfd4 */
31
+ MIPS_SYS(sys_eventfd2, 2)
32
+ MIPS_SYS(sys_epoll_create1, 1)
33
+ MIPS_SYS(sys_dup3, 3)
34
+ MIPS_SYS(sys_pipe2, 2)
35
+ MIPS_SYS(sys_inotify_init1, 1)
40
syscall_num = env->active_tc.gpr[2] - 4000;
41
env->active_tc.PC += 4;
42
if (syscall_num >= sizeof(mips_syscall_args)) {
44
+ ret = -TARGET_ENOSYS;
54
info.si_signo = TARGET_SIGSEGV;
56
/* XXX: check env->error_code */
57
Index: qemu-0.14.1.1/linux-user/syscall.c
58
===================================================================
59
--- qemu-0.14.1.1.orig/linux-user/syscall.c 2011-07-04 19:37:39.000000000 +0200
60
+++ qemu-0.14.1.1/linux-user/syscall.c 2011-07-04 19:37:41.000000000 +0200
65
+static inline int target_to_host_resource(int code)
68
+ case TARGET_RLIMIT_AS:
70
+ case TARGET_RLIMIT_CORE:
72
+ case TARGET_RLIMIT_CPU:
74
+ case TARGET_RLIMIT_DATA:
76
+ case TARGET_RLIMIT_FSIZE:
77
+ return RLIMIT_FSIZE;
78
+ case TARGET_RLIMIT_LOCKS:
79
+ return RLIMIT_LOCKS;
80
+ case TARGET_RLIMIT_MEMLOCK:
81
+ return RLIMIT_MEMLOCK;
82
+ case TARGET_RLIMIT_MSGQUEUE:
83
+ return RLIMIT_MSGQUEUE;
84
+ case TARGET_RLIMIT_NICE:
86
+ case TARGET_RLIMIT_NOFILE:
87
+ return RLIMIT_NOFILE;
88
+ case TARGET_RLIMIT_NPROC:
89
+ return RLIMIT_NPROC;
90
+ case TARGET_RLIMIT_RSS:
92
+ case TARGET_RLIMIT_RTPRIO:
93
+ return RLIMIT_RTPRIO;
94
+ case TARGET_RLIMIT_SIGPENDING:
95
+ return RLIMIT_SIGPENDING;
96
+ case TARGET_RLIMIT_STACK:
97
+ return RLIMIT_STACK;
103
static inline abi_long copy_from_user_timeval(struct timeval *tv,
104
abi_ulong target_tv_addr)
106
@@ -4317,6 +4355,10 @@
114
return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
117
@@ -4334,6 +4376,10 @@
125
return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
128
@@ -5543,7 +5589,7 @@
130
case TARGET_NR_setrlimit:
132
- int resource = arg1;
133
+ int resource = target_to_host_resource(arg1);
134
struct target_rlimit *target_rlim;
136
if (!lock_user_struct(VERIFY_READ, target_rlim, arg2, 1))
137
@@ -5556,7 +5602,7 @@
139
case TARGET_NR_getrlimit:
141
- int resource = arg1;
142
+ int resource = target_to_host_resource(arg1);
143
struct target_rlimit *target_rlim;
146
@@ -6791,6 +6837,9 @@
147
if (((CPUARMState *)cpu_env)->eabi)
153
if (!(p = lock_user(VERIFY_WRITE, arg2, arg3, 0)))
155
ret = get_errno(pread(arg1, p, arg3, arg4));
156
@@ -6801,6 +6850,9 @@
157
if (((CPUARMState *)cpu_env)->eabi)
163
if (!(p = lock_user(VERIFY_READ, arg2, arg3, 1)))
165
ret = get_errno(pwrite(arg1, p, arg3, arg4));
166
@@ -6860,7 +6912,8 @@
167
case TARGET_NR_ugetrlimit:
170
- ret = get_errno(getrlimit(arg1, &rlim));
171
+ int resource = target_to_host_resource(arg1);
172
+ ret = get_errno(getrlimit(resource, &rlim));
173
if (!is_error(ret)) {
174
struct target_rlimit *target_rlim;
175
if (!lock_user_struct(VERIFY_WRITE, target_rlim, arg2, 0))
176
@@ -7558,6 +7611,11 @@
185
ret = get_errno(readahead(arg1, ((off64_t)arg3 << 32) | arg2, arg4));
187
ret = get_errno(readahead(arg1, arg2, arg3));
188
Index: qemu-0.14.1.1/linux-user/syscall_defs.h
189
===================================================================
190
--- qemu-0.14.1.1.orig/linux-user/syscall_defs.h 2011-07-04 19:37:39.000000000 +0200
191
+++ qemu-0.14.1.1/linux-user/syscall_defs.h 2011-07-04 19:37:41.000000000 +0200
193
#define TARGET_RLIM_INFINITY ((target_ulong)~0UL)
196
+#if defined(TARGET_MIPS)
197
+#define TARGET_RLIMIT_CPU 0
198
+#define TARGET_RLIMIT_FSIZE 1
199
+#define TARGET_RLIMIT_DATA 2
200
+#define TARGET_RLIMIT_STACK 3
201
+#define TARGET_RLIMIT_CORE 4
202
+#define TARGET_RLIMIT_RSS 7
203
+#define TARGET_RLIMIT_NPROC 8
204
+#define TARGET_RLIMIT_NOFILE 5
205
+#define TARGET_RLIMIT_MEMLOCK 9
206
+#define TARGET_RLIMIT_AS 6
207
+#define TARGET_RLIMIT_LOCKS 10
208
+#define TARGET_RLIMIT_SIGPENDING 11
209
+#define TARGET_RLIMIT_MSGQUEUE 12
210
+#define TARGET_RLIMIT_NICE 13
211
+#define TARGET_RLIMIT_RTPRIO 14
213
+#define TARGET_RLIMIT_CPU 0
214
+#define TARGET_RLIMIT_FSIZE 1
215
+#define TARGET_RLIMIT_DATA 2
216
+#define TARGET_RLIMIT_STACK 3
217
+#define TARGET_RLIMIT_CORE 4
218
+#define TARGET_RLIMIT_RSS 5
219
+#define TARGET_RLIMIT_NPROC 6
220
+#define TARGET_RLIMIT_NOFILE 7
221
+#define TARGET_RLIMIT_MEMLOCK 8
222
+#define TARGET_RLIMIT_AS 9
223
+#define TARGET_RLIMIT_LOCKS 10
224
+#define TARGET_RLIMIT_SIGPENDING 11
225
+#define TARGET_RLIMIT_MSGQUEUE 12
226
+#define TARGET_RLIMIT_NICE 13
227
+#define TARGET_RLIMIT_RTPRIO 14
230
struct target_pollfd {
231
int fd; /* file descriptor */
232
short events; /* requested events */