summaryrefslogtreecommitdiffstats
path: root/meta/packages
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2007-12-03 23:18:02 +0000
committerRichard Purdie <richard@openedhand.com>2007-12-03 23:18:02 +0000
commit11f9f2412eae749d28c99f8bf36f8aee7deb36b4 (patch)
tree35edbce67c753112dd4aff9b7f93fb60f5ba4394 /meta/packages
parentc3c2ee2f424a0041ad2c27d42853a05e683b401f (diff)
downloadpoky-11f9f2412eae749d28c99f8bf36f8aee7deb36b4.tar.gz
qemu: Add 20071121 version, default preference -1 for now
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3303 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages')
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/02_snapshot_use_tmpdir.patch23
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/04_do_not_print_rtc_freq_if_ok.patch26
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/05_non-fatal_if_linux_hd_missing.patch17
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/06_exit_segfault.patch45
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/10_signal_jobs.patch26
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/11_signal_sigaction.patch21
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/22_net_tuntap_stall.patch18
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/31_syscalls.patch48
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/32_syscall_sysctl.patch55
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/33_syscall_ppc_clone.patch22
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/39_syscall_fadvise64.patch21
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/41_arm_fpa_sigfpe.patch104
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/52_ne2000_return.patch17
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/61_safe_64bit_int.patch27
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/63_sparc_build.patch18
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/64_ppc_asm_constraints.patch18
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/65_kfreebsd.patch35
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/66_tls_ld.patch55
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/91-oh-sdl-cursor.patch18
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/disable-error-in-configure.patch17
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/fix_segfault.patch37
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl-update.patch219
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl.patch854
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-amd64-32b-mapping-0.9.0.patch37
-rw-r--r--meta/packages/qemu/qemu-0.9.0+cvs20071121/workaround_bad_futex_headers.patch25
-rw-r--r--meta/packages/qemu/qemu-native_20071121.bb5
-rw-r--r--meta/packages/qemu/qemu_20071121.bb58
27 files changed, 1866 insertions, 0 deletions
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/02_snapshot_use_tmpdir.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/02_snapshot_use_tmpdir.patch
new file mode 100644
index 0000000000..40264ed443
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/02_snapshot_use_tmpdir.patch
@@ -0,0 +1,23 @@
1#DPATCHLEVEL=0
2---
3# block.c | 6 +++++-
4# 1 file changed, 5 insertions(+), 1 deletion(-)
5#
6Index: block.c
7===================================================================
8--- block.c.orig 2007-12-03 23:47:25.000000000 +0000
9+++ block.c 2007-12-03 23:47:31.000000000 +0000
10@@ -191,8 +191,12 @@ void get_tmp_filename(char *filename, in
11 void get_tmp_filename(char *filename, int size)
12 {
13 int fd;
14+ char *tmpdir;
15 /* XXX: race condition possible */
16- pstrcpy(filename, size, "/tmp/vl.XXXXXX");
17+ tmpdir = getenv("TMPDIR");
18+ if (!tmpdir)
19+ tmpdir = "/tmp";
20+ snprintf(filename, size, "%s/vl.XXXXXX", tmpdir);
21 fd = mkstemp(filename);
22 close(fd);
23 }
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/04_do_not_print_rtc_freq_if_ok.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/04_do_not_print_rtc_freq_if_ok.patch
new file mode 100644
index 0000000000..31c9da491d
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/04_do_not_print_rtc_freq_if_ok.patch
@@ -0,0 +1,26 @@
1#DPATCHLEVEL=1
2---
3# vl.c | 5 ++++-
4# 1 file changed, 4 insertions(+), 1 deletion(-)
5#
6Index: qemu/vl.c
7===================================================================
8--- qemu.orig/vl.c 2007-12-03 15:44:35.000000000 +0000
9+++ qemu/vl.c 2007-12-03 15:51:03.000000000 +0000
10@@ -1289,12 +1289,15 @@ static void hpet_stop_timer(struct qemu_
11
12 static int rtc_start_timer(struct qemu_alarm_timer *t)
13 {
14+ unsigned long current_rtc_freq = 0;
15 int rtc_fd;
16
17 TFR(rtc_fd = open("/dev/rtc", O_RDONLY));
18 if (rtc_fd < 0)
19 return -1;
20- if (ioctl(rtc_fd, RTC_IRQP_SET, RTC_FREQ) < 0) {
21+ ioctl(rtc_fd, RTC_IRQP_READ, &current_rtc_freq);
22+ if (current_rtc_freq != RTC_FREQ &&
23+ ioctl(rtc_fd, RTC_IRQP_SET, RTC_FREQ) < 0) {
24 fprintf(stderr, "Could not configure '/dev/rtc' to have a 1024 Hz timer. This is not a fatal\n"
25 "error, but for better emulation accuracy either use a 2.6 host Linux kernel or\n"
26 "type 'echo 1024 > /proc/sys/dev/rtc/max-user-freq' as root.\n");
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/05_non-fatal_if_linux_hd_missing.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/05_non-fatal_if_linux_hd_missing.patch
new file mode 100644
index 0000000000..fdd922605e
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/05_non-fatal_if_linux_hd_missing.patch
@@ -0,0 +1,17 @@
1#DPATCHLEVEL=1
2---
3# hw/pc.c | 1 -
4# 1 file changed, 1 deletion(-)
5#
6Index: qemu/hw/pc.c
7===================================================================
8--- qemu.orig/hw/pc.c 2007-12-03 23:47:25.000000000 +0000
9+++ qemu/hw/pc.c 2007-12-03 23:47:38.000000000 +0000
10@@ -385,7 +385,6 @@ static void generate_bootsect(uint32_t g
11 if (bs_table[0] == NULL) {
12 fprintf(stderr, "A disk image must be given for 'hda' when booting "
13 "a Linux kernel\n");
14- exit(1);
15 }
16
17 memset(bootsect, 0, sizeof(bootsect));
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/06_exit_segfault.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/06_exit_segfault.patch
new file mode 100644
index 0000000000..06123d0626
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/06_exit_segfault.patch
@@ -0,0 +1,45 @@
1#DPATCHLEVEL=0
2---
3# linux-user/main.c | 8 ++++----
4# 1 file changed, 4 insertions(+), 4 deletions(-)
5#
6Index: linux-user/main.c
7===================================================================
8--- linux-user/main.c.orig 2007-12-03 23:47:25.000000000 +0000
9+++ linux-user/main.c 2007-12-03 23:47:41.000000000 +0000
10@@ -714,7 +714,7 @@ void cpu_loop (CPUSPARCState *env)
11 default:
12 printf ("Unhandled trap: 0x%x\n", trapnr);
13 cpu_dump_state(env, stderr, fprintf, 0);
14- exit (1);
15+ _exit (1);
16 }
17 process_pending_signals (env);
18 }
19@@ -1634,7 +1634,7 @@ void cpu_loop (CPUState *env)
20 default:
21 printf ("Unhandled trap: 0x%x\n", trapnr);
22 cpu_dump_state(env, stderr, fprintf, 0);
23- exit (1);
24+ _exit (1);
25 }
26 process_pending_signals (env);
27 }
28@@ -1954,7 +1954,7 @@ int main(int argc, char **argv)
29 for(item = cpu_log_items; item->mask != 0; item++) {
30 printf("%-10s %s\n", item->name, item->help);
31 }
32- exit(1);
33+ _exit(1);
34 }
35 cpu_set_log(mask);
36 } else if (!strcmp(r, "s")) {
37@@ -1973,7 +1973,7 @@ int main(int argc, char **argv)
38 if (qemu_host_page_size == 0 ||
39 (qemu_host_page_size & (qemu_host_page_size - 1)) != 0) {
40 fprintf(stderr, "page size must be a power of two\n");
41- exit(1);
42+ _exit(1);
43 }
44 } else if (!strcmp(r, "g")) {
45 gdbstub_port = atoi(argv[optind++]);
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/10_signal_jobs.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/10_signal_jobs.patch
new file mode 100644
index 0000000000..34282adc9d
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/10_signal_jobs.patch
@@ -0,0 +1,26 @@
1#DPATCHLEVEL=0
2---
3# linux-user/signal.c | 7 ++++++-
4# 1 file changed, 6 insertions(+), 1 deletion(-)
5#
6Index: linux-user/signal.c
7===================================================================
8--- linux-user/signal.c.orig 2007-12-03 15:40:26.000000000 +0000
9+++ linux-user/signal.c 2007-12-03 15:55:49.000000000 +0000
10@@ -364,10 +364,15 @@ int queue_signal(int sig, target_siginfo
11 k = &sigact_table[sig - 1];
12 handler = k->sa._sa_handler;
13 if (handler == TARGET_SIG_DFL) {
14+ if (sig == TARGET_SIGTSTP || sig == TARGET_SIGTTIN || sig == TARGET_SIGTTOU) {
15+ kill(getpid(),SIGSTOP);
16+ return 0;
17+ } else
18 /* default handler : ignore some signal. The other are fatal */
19 if (sig != TARGET_SIGCHLD &&
20 sig != TARGET_SIGURG &&
21- sig != TARGET_SIGWINCH) {
22+ sig != TARGET_SIGWINCH &&
23+ sig != TARGET_SIGCONT) {
24 force_sig(sig);
25 } else {
26 return 0; /* indicate ignored */
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/11_signal_sigaction.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/11_signal_sigaction.patch
new file mode 100644
index 0000000000..33c5e8b12d
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/11_signal_sigaction.patch
@@ -0,0 +1,21 @@
1#DPATCHLEVEL=0
2---
3# linux-user/signal.c | 5 +++++
4# 1 file changed, 5 insertions(+)
5#
6Index: linux-user/signal.c
7===================================================================
8--- linux-user/signal.c.orig 2007-12-03 23:47:44.000000000 +0000
9+++ linux-user/signal.c 2007-12-03 23:47:46.000000000 +0000
10@@ -512,6 +512,11 @@ int do_sigaction(int sig, const struct t
11
12 if (sig < 1 || sig > TARGET_NSIG || sig == SIGKILL || sig == SIGSTOP)
13 return -EINVAL;
14+
15+ /* no point doing the stuff as those are not allowed for sigaction */
16+ if ((sig == TARGET_SIGKILL) || (sig == TARGET_SIGSTOP))
17+ return -EINVAL;
18+
19 k = &sigact_table[sig - 1];
20 #if defined(DEBUG_SIGNAL)
21 fprintf(stderr, "sigaction sig=%d act=0x%08x, oact=0x%08x\n",
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/22_net_tuntap_stall.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/22_net_tuntap_stall.patch
new file mode 100644
index 0000000000..6017df0f6d
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/22_net_tuntap_stall.patch
@@ -0,0 +1,18 @@
1#DPATCHLEVEL=0
2---
3# vl.c | 2 +-
4# 1 file changed, 1 insertion(+), 1 deletion(-)
5#
6Index: vl.c
7===================================================================
8--- vl.c.orig 2007-12-03 23:47:36.000000000 +0000
9+++ vl.c 2007-12-03 23:47:48.000000000 +0000
10@@ -4023,7 +4023,7 @@ static int tap_open(char *ifname, int if
11 return -1;
12 }
13 memset(&ifr, 0, sizeof(ifr));
14- ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
15+ ifr.ifr_flags = IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE;
16 if (ifname[0] != '\0')
17 pstrcpy(ifr.ifr_name, IFNAMSIZ, ifname);
18 else
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/31_syscalls.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/31_syscalls.patch
new file mode 100644
index 0000000000..95a7332ee8
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/31_syscalls.patch
@@ -0,0 +1,48 @@
1#DPATCHLEVEL=0
2---
3# linux-user/syscall.c | 11 ++++++++---
4# 1 file changed, 8 insertions(+), 3 deletions(-)
5#
6Index: linux-user/syscall.c
7===================================================================
8--- linux-user/syscall.c.orig 2007-12-03 19:32:56.000000000 +0000
9+++ linux-user/syscall.c 2007-12-03 19:33:41.000000000 +0000
10@@ -250,6 +250,7 @@ extern int getresuid(uid_t *, uid_t *, u
11 extern int setresgid(gid_t, gid_t, gid_t);
12 extern int getresgid(gid_t *, gid_t *, gid_t *);
13 extern int setgroups(int, gid_t *);
14+extern int uselib(const char*);
15
16 #define ERRNO_TABLE_SIZE 1200
17
18@@ -4024,7 +4025,8 @@ abi_long do_syscall(void *cpu_env, int n
19 #endif
20 #ifdef TARGET_NR_uselib
21 case TARGET_NR_uselib:
22- goto unimplemented;
23+ ret = get_errno(uselib(path((const char*)arg1)));
24+ break;
25 #endif
26 #ifdef TARGET_NR_swapon
27 case TARGET_NR_swapon:
28@@ -5289,7 +5291,9 @@ abi_long do_syscall(void *cpu_env, int n
29 goto unimplemented;
30 #ifdef TARGET_NR_mincore
31 case TARGET_NR_mincore:
32- goto unimplemented;
33+ /*page_unprotect_range((void*)arg3, ((size_t)arg2 + TARGET_PAGE_SIZE - 1) / TARGET_PAGE_SIZE);*/
34+ ret = get_errno(mincore((void*)arg1, (size_t)arg2, (unsigned char*)arg3));
35+ break;
36 #endif
37 #ifdef TARGET_NR_madvise
38 case TARGET_NR_madvise:
39@@ -5429,7 +5433,8 @@ abi_long do_syscall(void *cpu_env, int n
40 break;
41 #ifdef TARGET_NR_readahead
42 case TARGET_NR_readahead:
43- goto unimplemented;
44+ ret = get_errno(readahead((int)arg1, (off64_t)arg2, (size_t)arg3));
45+ break;
46 #endif
47 #ifdef TARGET_NR_setxattr
48 case TARGET_NR_setxattr:
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/32_syscall_sysctl.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/32_syscall_sysctl.patch
new file mode 100644
index 0000000000..5e8dd75b0e
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/32_syscall_sysctl.patch
@@ -0,0 +1,55 @@
1#DPATCHLEVEL=0
2---
3# linux-user/syscall.c | 32 +++++++++++++++++++++++++++++---
4# 1 file changed, 29 insertions(+), 3 deletions(-)
5#
6Index: linux-user/syscall.c
7===================================================================
8--- linux-user/syscall.c.orig 2007-12-03 15:56:24.000000000 +0000
9+++ linux-user/syscall.c 2007-12-03 15:57:36.000000000 +0000
10@@ -52,6 +52,7 @@
11 //#include <sys/user.h>
12 #include <netinet/ip.h>
13 #include <netinet/tcp.h>
14+#include <sys/sysctl.h>
15
16 #define termios host_termios
17 #define winsize host_winsize
18@@ -4739,9 +4740,34 @@ abi_long do_syscall(void *cpu_env, int n
19 break;
20 #endif
21 case TARGET_NR__sysctl:
22- /* We don't implement this, but ENOTDIR is always a safe
23- return value. */
24- ret = -TARGET_ENOTDIR;
25+ {
26+ struct __sysctl_args *args = (struct __sysctl_args *) arg1;
27+ int *name_target, *name, nlen, *oldlenp, oldlen, newlen, i;
28+ void *oldval, *newval;
29+
30+ name_target = (int *) tswapl((long) args->name);
31+ nlen = tswapl(args->nlen);
32+ oldval = (void *) tswapl((long) args->oldval);
33+ oldlenp = (int *) tswapl((long) args->oldlenp);
34+ oldlen = tswapl(*oldlenp);
35+ newval = (void *) tswapl((long) args->newval);
36+ newlen = tswapl(args->newlen);
37+
38+ name = alloca(nlen * sizeof (int));
39+ for (i = 0; i < nlen; i++)
40+ name[i] = tswapl(name_target[i]);
41+
42+ if (nlen == 2 && name[0] == CTL_KERN && name[1] == KERN_VERSION) {
43+ ret = get_errno(
44+ sysctl(name, nlen, oldval, &oldlen, newval, newlen));
45+ if (!is_error(ret)) {
46+ *oldlenp = tswapl(oldlen);
47+ }
48+ } else {
49+ gemu_log("qemu: Unsupported sysctl name\n");
50+ ret = -ENOSYS;
51+ }
52+ }
53 break;
54 case TARGET_NR_sched_setparam:
55 {
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/33_syscall_ppc_clone.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/33_syscall_ppc_clone.patch
new file mode 100644
index 0000000000..3f733b6ab8
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/33_syscall_ppc_clone.patch
@@ -0,0 +1,22 @@
1#DPATCHLEVEL=0
2---
3# linux-user/syscall.c | 6 +-----
4# 1 file changed, 1 insertion(+), 5 deletions(-)
5#
6Index: linux-user/syscall.c
7===================================================================
8--- linux-user/syscall.c.orig 2007-12-03 15:58:11.000000000 +0000
9+++ linux-user/syscall.c 2007-12-03 15:58:46.000000000 +0000
10@@ -2750,11 +2750,7 @@ int do_fork(CPUState *env, unsigned int
11 if (!newsp)
12 newsp = env->gpr[1];
13 new_env->gpr[1] = newsp;
14- {
15- int i;
16- for (i = 7; i < 32; i++)
17- new_env->gpr[i] = 0;
18- }
19+ new_env->gpr[3] = 0;
20 #elif defined(TARGET_SH4)
21 if (!newsp)
22 newsp = env->gregs[15];
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/39_syscall_fadvise64.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/39_syscall_fadvise64.patch
new file mode 100644
index 0000000000..54ee3e0948
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/39_syscall_fadvise64.patch
@@ -0,0 +1,21 @@
1---
2 linux-user/syscall.c | 6 ++++++
3 1 file changed, 6 insertions(+)
4
5Index: linux-user/syscall.c
6===================================================================
7--- linux-user/syscall.c.orig 2007-12-03 19:33:47.000000000 +0000
8+++ linux-user/syscall.c 2007-12-03 19:33:48.000000000 +0000
9@@ -5317,6 +5317,12 @@ abi_long do_syscall(void *cpu_env, int n
10 ret = get_errno(mincore((void*)arg1, (size_t)arg2, (unsigned char*)arg3));
11 break;
12 #endif
13+#ifdef TARGET_NR_fadvise64_64
14+ case TARGET_NR_fadvise64_64:
15+ /* Just return success */
16+ ret = get_errno(0);
17+ break;
18+#endif
19 #ifdef TARGET_NR_madvise
20 case TARGET_NR_madvise:
21 /* A straight passthrough may not be safe because qemu sometimes
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/41_arm_fpa_sigfpe.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/41_arm_fpa_sigfpe.patch
new file mode 100644
index 0000000000..cea3afc7ff
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/41_arm_fpa_sigfpe.patch
@@ -0,0 +1,104 @@
1#DPATCHLEVEL=0
2---
3# linux-user/main.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++-
4# target-arm/nwfpe/fpa11.c | 7 ++++++
5# 2 files changed, 57 insertions(+), 1 deletion(-)
6#
7Index: linux-user/main.c
8===================================================================
9--- linux-user/main.c.orig 2007-12-03 15:59:10.000000000 +0000
10+++ linux-user/main.c 2007-12-03 16:01:27.000000000 +0000
11@@ -377,18 +377,67 @@ void cpu_loop(CPUARMState *env)
12 {
13 TaskState *ts = env->opaque;
14 uint32_t opcode;
15+ int rc;
16
17 /* we handle the FPU emulation here, as Linux */
18 /* we get the opcode */
19 /* FIXME - what to do if get_user() fails? */
20 get_user_u32(opcode, env->regs[15]);
21
22- if (EmulateAll(opcode, &ts->fpa, env) == 0) {
23+ rc = EmulateAll(opcode, &ts->fpa, env);
24+ if (rc == 0) { /* illegal instruction */
25 info.si_signo = SIGILL;
26 info.si_errno = 0;
27 info.si_code = TARGET_ILL_ILLOPN;
28 info._sifields._sigfault._addr = env->regs[15];
29 queue_signal(info.si_signo, &info);
30+ } else if (rc < 0) { /* FP exception */
31+ int arm_fpe=0;
32+
33+ /* translate softfloat flags to FPSR flags */
34+ if (-rc & float_flag_invalid)
35+ arm_fpe |= BIT_IOC;
36+ if (-rc & float_flag_divbyzero)
37+ arm_fpe |= BIT_DZC;
38+ if (-rc & float_flag_overflow)
39+ arm_fpe |= BIT_OFC;
40+ if (-rc & float_flag_underflow)
41+ arm_fpe |= BIT_UFC;
42+ if (-rc & float_flag_inexact)
43+ arm_fpe |= BIT_IXC;
44+
45+ FPSR fpsr = ts->fpa.fpsr;
46+ //printf("fpsr 0x%x, arm_fpe 0x%x\n",fpsr,arm_fpe);
47+
48+ if (fpsr & (arm_fpe << 16)) { /* exception enabled? */
49+ info.si_signo = SIGFPE;
50+ info.si_errno = 0;
51+
52+ /* ordered by priority, least first */
53+ if (arm_fpe & BIT_IXC) info.si_code = TARGET_FPE_FLTRES;
54+ if (arm_fpe & BIT_UFC) info.si_code = TARGET_FPE_FLTUND;
55+ if (arm_fpe & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF;
56+ if (arm_fpe & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV;
57+ if (arm_fpe & BIT_IOC) info.si_code = TARGET_FPE_FLTINV;
58+
59+ info._sifields._sigfault._addr = env->regs[15];
60+ queue_signal(info.si_signo, &info);
61+ } else {
62+ env->regs[15] += 4;
63+ }
64+
65+ /* accumulate unenabled exceptions */
66+ if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC))
67+ fpsr |= BIT_IXC;
68+ if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC))
69+ fpsr |= BIT_UFC;
70+ if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC))
71+ fpsr |= BIT_OFC;
72+ if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC))
73+ fpsr |= BIT_DZC;
74+ if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC))
75+ fpsr |= BIT_IOC;
76+ ts->fpa.fpsr=fpsr;
77 } else {
78 /* increment PC */
79 env->regs[15] += 4;
80Index: target-arm/nwfpe/fpa11.c
81===================================================================
82--- target-arm/nwfpe/fpa11.c.orig 2007-12-03 15:40:26.000000000 +0000
83+++ target-arm/nwfpe/fpa11.c 2007-12-03 15:59:11.000000000 +0000
84@@ -162,6 +162,8 @@ unsigned int EmulateAll(unsigned int opc
85 fpa11->initflag = 1;
86 }
87
88+ set_float_exception_flags(0, &fpa11->fp_status);
89+
90 if (TEST_OPCODE(opcode,MASK_CPRT))
91 {
92 //fprintf(stderr,"emulating CPRT\n");
93@@ -191,6 +193,11 @@ unsigned int EmulateAll(unsigned int opc
94 }
95
96 // restore_flags(flags);
97+ if(nRc == 1 && get_float_exception_flags(&fpa11->fp_status))
98+ {
99+ //printf("fef 0x%x\n",float_exception_flags);
100+ nRc=-get_float_exception_flags(&fpa11->fp_status);
101+ }
102
103 //printf("returning %d\n",nRc);
104 return(nRc);
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/52_ne2000_return.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/52_ne2000_return.patch
new file mode 100644
index 0000000000..e4ea33f2c6
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/52_ne2000_return.patch
@@ -0,0 +1,17 @@
1---
2 hw/ne2000.c | 2 +-
3 1 file changed, 1 insertion(+), 1 deletion(-)
4
5Index: qemu/hw/ne2000.c
6===================================================================
7--- qemu.orig/hw/ne2000.c 2007-12-03 19:32:52.000000000 +0000
8+++ qemu/hw/ne2000.c 2007-12-03 19:33:55.000000000 +0000
9@@ -217,7 +217,7 @@ static int ne2000_can_receive(void *opaq
10 NE2000State *s = opaque;
11
12 if (s->cmd & E8390_STOP)
13- return 1;
14+ return 0;
15 return !ne2000_buffer_full(s);
16 }
17
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/61_safe_64bit_int.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/61_safe_64bit_int.patch
new file mode 100644
index 0000000000..bdb0d2e232
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/61_safe_64bit_int.patch
@@ -0,0 +1,27 @@
1#DPATCHLEVEL=0
2---
3# dyngen-exec.h | 4 ++--
4# 1 file changed, 2 insertions(+), 2 deletions(-)
5#
6Index: dyngen-exec.h
7===================================================================
8--- dyngen-exec.h.orig 2007-12-03 15:40:26.000000000 +0000
9+++ dyngen-exec.h 2007-12-03 16:03:29.000000000 +0000
10@@ -38,7 +38,7 @@ typedef unsigned int uint32_t;
11 // Linux/Sparc64 defines uint64_t
12 #if !(defined (__sparc_v9__) && defined(__linux__))
13 /* XXX may be done for all 64 bits targets ? */
14-#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__)
15+#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) || defined(__alpha__) || defined(__sparc__)
16 typedef unsigned long uint64_t;
17 #else
18 typedef unsigned long long uint64_t;
19@@ -55,7 +55,7 @@ typedef signed short int16_t;
20 typedef signed int int32_t;
21 // Linux/Sparc64 defines int64_t
22 #if !(defined (__sparc_v9__) && defined(__linux__))
23-#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__)
24+#if defined (__x86_64__) || defined(__ia64) || defined(__s390x__) || defined(__alpha__) || defined(__sparc__)
25 typedef signed long int64_t;
26 #else
27 typedef signed long long int64_t;
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/63_sparc_build.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/63_sparc_build.patch
new file mode 100644
index 0000000000..37b38f641b
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/63_sparc_build.patch
@@ -0,0 +1,18 @@
1#DPATCHLEVEL=0
2---
3# sparc.ld | 2 +-
4# 1 file changed, 1 insertion(+), 1 deletion(-)
5#
6Index: sparc.ld
7===================================================================
8--- sparc.ld.orig 2007-12-03 15:40:26.000000000 +0000
9+++ sparc.ld 2007-12-03 16:05:06.000000000 +0000
10@@ -6,7 +6,7 @@ ENTRY(_start)
11 SECTIONS
12 {
13 /* Read-only sections, merged into text segment: */
14- . = 0x60000000 + SIZEOF_HEADERS;
15+ . = 0x60000000 + 0x400;
16 .interp : { *(.interp) }
17 .hash : { *(.hash) }
18 .dynsym : { *(.dynsym) }
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/64_ppc_asm_constraints.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/64_ppc_asm_constraints.patch
new file mode 100644
index 0000000000..e4858b79d7
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/64_ppc_asm_constraints.patch
@@ -0,0 +1,18 @@
1#DPATCHLEVEL=1
2---
3# cpu-all.h | 2 +-
4# 1 file changed, 1 insertion(+), 1 deletion(-)
5#
6Index: qemu/cpu-all.h
7===================================================================
8--- qemu.orig/cpu-all.h 2007-06-13 11:48:22.000000000 +0100
9+++ qemu/cpu-all.h 2007-06-13 11:51:56.000000000 +0100
10@@ -250,7 +250,7 @@ static inline void stw_le_p(void *ptr, i
11 static inline void stl_le_p(void *ptr, int v)
12 {
13 #ifdef __powerpc__
14- __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*(uint32_t *)ptr) : "r" (v), "r" (ptr));
15+ __asm__ __volatile__ ("stwbrx %0,0,%1" : : "r" (v), "r" (ptr) : "memory");
16 #else
17 uint8_t *p = ptr;
18 p[0] = v;
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/65_kfreebsd.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/65_kfreebsd.patch
new file mode 100644
index 0000000000..dfece800ac
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/65_kfreebsd.patch
@@ -0,0 +1,35 @@
1---
2 configure | 6 ++++++
3 vl.c | 2 ++
4 2 files changed, 8 insertions(+)
5
6Index: configure
7===================================================================
8--- configure.orig 2007-12-03 15:40:26.000000000 +0000
9+++ configure 2007-12-03 16:05:34.000000000 +0000
10@@ -129,6 +129,12 @@ if [ "$cpu" = "i386" -o "$cpu" = "x86_64
11 kqemu="yes"
12 fi
13 ;;
14+GNU/kFreeBSD)
15+oss="yes"
16+if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
17+ kqemu="yes"
18+fi
19+;;
20 FreeBSD)
21 bsd="yes"
22 oss="yes"
23Index: vl.c
24===================================================================
25--- vl.c.orig 2007-12-03 16:05:32.000000000 +0000
26+++ vl.c 2007-12-03 16:05:34.000000000 +0000
27@@ -97,6 +97,8 @@
28 #include <stropts.h>
29 #endif
30 #endif
31+#elif defined (__GLIBC__) && defined (__FreeBSD_kernel__)
32+#include <freebsd/stdlib.h>
33 #else
34 #include <winsock2.h>
35 int inet_aton(const char *cp, struct in_addr *ia);
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/66_tls_ld.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/66_tls_ld.patch
new file mode 100644
index 0000000000..54e02eff8b
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/66_tls_ld.patch
@@ -0,0 +1,55 @@
1---
2 arm.ld | 7 +++++++
3 i386.ld | 7 +++++++
4 2 files changed, 14 insertions(+)
5
6Index: arm.ld
7===================================================================
8--- arm.ld.orig 2007-06-13 11:48:22.000000000 +0100
9+++ arm.ld 2007-06-13 11:51:56.000000000 +0100
10@@ -26,6 +26,10 @@ SECTIONS
11 { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
12 .rela.rodata :
13 { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
14+ .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
15+ .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
16+ .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
17+ .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
18 .rel.got : { *(.rel.got) }
19 .rela.got : { *(.rela.got) }
20 .rel.ctors : { *(.rel.ctors) }
21@@ -58,6 +62,9 @@ SECTIONS
22 .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
23 __exidx_end = .;
24 .reginfo : { *(.reginfo) }
25+ /* Thread Local Storage sections */
26+ .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
27+ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
28 /* Adjust the address for the data segment. We want to adjust up to
29 the same address within the page on the next page up. */
30 . = ALIGN(0x100000) + (. & (0x100000 - 1));
31Index: i386.ld
32===================================================================
33--- i386.ld.orig 2007-06-13 11:48:22.000000000 +0100
34+++ i386.ld 2007-06-13 11:51:56.000000000 +0100
35@@ -28,6 +28,10 @@ SECTIONS
36 { *(.rel.rodata) *(.rel.gnu.linkonce.r*) }
37 .rela.rodata :
38 { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
39+ .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
40+ .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
41+ .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
42+ .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
43 .rel.got : { *(.rel.got) }
44 .rela.got : { *(.rela.got) }
45 .rel.ctors : { *(.rel.ctors) }
46@@ -53,6 +57,9 @@ SECTIONS
47 _etext = .;
48 PROVIDE (etext = .);
49 .fini : { *(.fini) } =0x47ff041f
50+ /* Thread Local Storage sections */
51+ .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
52+ .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
53 . = ALIGN(32 / 8);
54 PROVIDE (__preinit_array_start = .);
55 .preinit_array : { *(.preinit_array) }
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/91-oh-sdl-cursor.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/91-oh-sdl-cursor.patch
new file mode 100644
index 0000000000..0d60c1c306
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/91-oh-sdl-cursor.patch
@@ -0,0 +1,18 @@
1=== modified file 'sdl.c'
2---
3 sdl.c | 2 +-
4 1 file changed, 1 insertion(+), 1 deletion(-)
5
6Index: sdl.c
7===================================================================
8--- sdl.c.orig 2007-12-03 19:32:15.000000000 +0000
9+++ sdl.c 2007-12-03 19:34:04.000000000 +0000
10@@ -247,7 +247,7 @@ static void sdl_hide_cursor(void)
11
12 if (kbd_mouse_is_absolute()) {
13 SDL_ShowCursor(1);
14- SDL_SetCursor(sdl_cursor_hidden);
15+ /* SDL_SetCursor(sdl_cursor_hidden); */
16 } else {
17 SDL_ShowCursor(0);
18 }
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/disable-error-in-configure.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/disable-error-in-configure.patch
new file mode 100644
index 0000000000..017f9f6355
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/disable-error-in-configure.patch
@@ -0,0 +1,17 @@
1---
2 configure | 2 --
3 1 file changed, 2 deletions(-)
4
5Index: qemu/configure
6===================================================================
7--- qemu.orig/configure 2007-12-03 16:38:38.000000000 +0000
8+++ qemu/configure 2007-12-03 16:38:39.000000000 +0000
9@@ -323,8 +323,6 @@ for opt do
10 ;;
11 --disable-werror) werror="no"
12 ;;
13- *) echo "ERROR: unknown option $opt"; show_help="yes"
14- ;;
15 --disable-nptl) nptl="no"
16 ;;
17 esac
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/fix_segfault.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/fix_segfault.patch
new file mode 100644
index 0000000000..443c330650
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/fix_segfault.patch
@@ -0,0 +1,37 @@
1---
2 linux-user/syscall.c | 22 ----------------------
3 1 file changed, 22 deletions(-)
4
5Index: qemu/linux-user/syscall.c
6===================================================================
7--- qemu.orig/linux-user/syscall.c 2007-12-03 23:40:11.000000000 +0000
8+++ qemu/linux-user/syscall.c 2007-12-03 23:40:21.000000000 +0000
9@@ -5695,28 +5695,6 @@ abi_long do_syscall(void *cpu_env, int n
10 goto unimplemented_nowarn;
11 #endif
12
13-#ifdef TARGET_NR_clock_gettime
14- case TARGET_NR_clock_gettime:
15- {
16- struct timespec ts;
17- ret = get_errno(clock_gettime(arg1, &ts));
18- if (!is_error(ret)) {
19- host_to_target_timespec(arg2, &ts);
20- }
21- break;
22- }
23-#endif
24-#ifdef TARGET_NR_clock_getres
25- case TARGET_NR_clock_getres:
26- {
27- struct timespec ts;
28- ret = get_errno(clock_getres(arg1, &ts));
29- if (!is_error(ret)) {
30- host_to_target_timespec(arg2, &ts);
31- }
32- break;
33- }
34-#endif
35
36 #if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address)
37 case TARGET_NR_set_tid_address:
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl-update.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl-update.patch
new file mode 100644
index 0000000000..ebc996e873
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl-update.patch
@@ -0,0 +1,219 @@
1---
2 linux-user/main.c | 7 ++-
3 linux-user/syscall.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++-----
4 2 files changed, 111 insertions(+), 10 deletions(-)
5
6Index: qemu/linux-user/main.c
7===================================================================
8--- qemu.orig/linux-user/main.c 2007-12-03 19:34:09.000000000 +0000
9+++ qemu/linux-user/main.c 2007-12-03 23:44:45.000000000 +0000
10@@ -391,7 +391,7 @@ do_kernel_trap(CPUARMState *env)
11 cpu_unlock();
12 break;
13 case 0xffff0fe0: /* __kernel_get_tls */
14- env->regs[0] = env->cp15.c13_tls;
15+ env->regs[0] = env->cp15.c13_tls2;
16 break;
17 default:
18 return 1;
19@@ -2037,6 +2037,11 @@ int main(int argc, char **argv)
20 int drop_ld_preload = 0, environ_count = 0;
21 char **target_environ, **wrk, **dst;
22
23+ char *assume_kernel = getenv("QEMU_ASSUME_KERNEL");
24+
25+ if (assume_kernel)
26+ setenv("LD_ASSUME_KERNEL", assume_kernel, 1);
27+
28 if (argc <= 1)
29 usage();
30
31Index: qemu/linux-user/syscall.c
32===================================================================
33--- qemu.orig/linux-user/syscall.c 2007-12-03 19:34:09.000000000 +0000
34+++ qemu/linux-user/syscall.c 2007-12-03 23:46:54.000000000 +0000
35@@ -61,6 +61,7 @@
36 #define tchars host_tchars /* same as target */
37 #define ltchars host_ltchars /* same as target */
38
39+#include <linux/futex.h>
40 #include <linux/termios.h>
41 #include <linux/unistd.h>
42 #include <linux/utsname.h>
43@@ -2694,7 +2695,6 @@ abi_long do_arch_prctl(CPUX86State *env,
44 return 0;
45 }
46 #endif
47-
48 #endif /* defined(TARGET_I386) */
49
50 /* this stack is the equivalent of the kernel stack associated with a
51@@ -2729,16 +2729,19 @@ int do_fork(CPUState *env, unsigned int
52 TaskState *ts;
53 uint8_t *new_stack;
54 CPUState *new_env;
55-
56+#if defined(TARGET_I386)
57+ uint64_t *new_gdt_table;
58+#endif
59 #ifdef USE_NPTL
60 unsigned int nptl_flags;
61
62 if (flags & CLONE_PARENT_SETTID)
63 *parent_tidptr = gettid();
64 #endif
65-
66 if (flags & CLONE_VM) {
67 ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE);
68+ if (!ts)
69+ return -ENOMEM;
70 memset(ts, 0, sizeof(TaskState));
71 new_stack = ts->stack;
72 ts->used = 1;
73@@ -2750,6 +2753,29 @@ int do_fork(CPUState *env, unsigned int
74 #if defined(TARGET_I386)
75 if (!newsp)
76 newsp = env->regs[R_ESP];
77+ new_gdt_table = malloc(9 * 8);
78+ if (!new_gdt_table) {
79+ free(new_env);
80+ return -ENOMEM;
81+ }
82+ /* Copy main GDT table from parent, but clear TLS entries */
83+ memcpy(new_gdt_table, g2h(env->gdt.base), 6 * 8);
84+ memset(&new_gdt_table[6], 0, 3 * 8);
85+ new_env->gdt.base = h2g(new_gdt_table);
86+ if (flags & 0x00080000 /* CLONE_SETTLS */) {
87+ ret = do_set_thread_area(new_env, new_env->regs[R_ESI]);
88+ if (ret) {
89+ free(new_gdt_table);
90+ free(new_env);
91+ return ret;
92+ }
93+ }
94+ cpu_x86_load_seg(env, R_CS, new_env->regs[R_CS]);
95+ cpu_x86_load_seg(env, R_DS, new_env->regs[R_DS]);
96+ cpu_x86_load_seg(env, R_ES, new_env->regs[R_ES]);
97+ cpu_x86_load_seg(env, R_SS, new_env->regs[R_SS]);
98+ cpu_x86_load_seg(env, R_FS, new_env->regs[R_FS]);
99+ cpu_x86_load_seg(env, R_GS, new_env->regs[R_GS]);
100 new_env->regs[R_ESP] = newsp;
101 new_env->regs[R_EAX] = 0;
102 #elif defined(TARGET_ARM)
103@@ -3121,6 +3147,68 @@ static inline abi_long host_to_target_ti
104 unlock_user_struct(target_ts, target_addr, 1);
105 }
106
107+static long do_futex(target_ulong uaddr, int op, uint32_t val,
108+ target_ulong utime, target_ulong uaddr2,
109+ uint32_t val3)
110+{
111+ struct timespec host_utime;
112+ unsigned long val2 = utime;
113+
114+ if (utime && (op == FUTEX_WAIT || op == FUTEX_LOCK_PI)) {
115+ target_to_host_timespec(&host_utime, utime);
116+ val2 = (unsigned long)&host_utime;
117+ }
118+
119+#ifdef BSWAP_NEEDED
120+ switch(op) {
121+ case FUTEX_CMP_REQUEUE:
122+ val3 = tswap32(val3);
123+ case FUTEX_REQUEUE:
124+ val2 = tswap32(val2);
125+ case FUTEX_WAIT:
126+ case FUTEX_WAKE:
127+ val = tswap32(val);
128+ case FUTEX_LOCK_PI: /* This one's icky, but comes out OK */
129+ case FUTEX_UNLOCK_PI:
130+ break;
131+ default:
132+ gemu_log("qemu: Unsupported futex op %d\n", op);
133+ return -ENOSYS;
134+ }
135+#if 0 /* No, it's worse than this */
136+ if (op == FUTEX_WAKE_OP) {
137+ /* Need to munge the secondary operation (val3) */
138+ val3 = tswap32(val3);
139+ int op2 = (val3 >> 28) & 7;
140+ int cmp = (val3 >> 24) & 15;
141+ int oparg = (val3 << 8) >> 20;
142+ int cmparg = (val3 << 20) >> 20;
143+ int shift = val3 & (FUTEX_OP_OPARG_SHIFT << 28);
144+
145+ if (shift)
146+ oparg = (oparg & 7) + 24 - (oparg & 24);
147+ else oparg =
148+ if (op2 == FUTEX_OP_ADD) {
149+ gemu_log("qemu: Unsupported wrong-endian FUTEX_OP_ADD\n");
150+ return -ENOSYS;
151+ }
152+ if (cmparg == FUTEX_OP_CMP_LT || cmparg == FUTEX_OP_CMP_GE ||
153+ cmparg == FUTEX_OP_CMP_LE || cmparg == FUTEX_OP_CMP_GT) {
154+ gemu_log("qemu: Unsupported wrong-endian futex cmparg %d\n", cmparg);
155+ return -ENOSYS;
156+ }
157+ val3 = shift | (op2<<28) | (cmp<<24) | (oparg<<12) | cmparg;
158+ }
159+#endif
160+#endif
161+ return syscall(__NR_futex, g2h(uaddr), op, val, val2, g2h(uaddr2), val3);
162+}
163+
164+int do_set_tid_address(target_ulong tidptr)
165+{
166+ return syscall(__NR_set_tid_address, g2h(tidptr));
167+}
168+
169 /* do_syscall() should always have a single exit point at the end so
170 that actions, such as logging of syscall results, can be performed.
171 All errnos that do_syscall() returns must be -TARGET_<errcode>. */
172@@ -3145,7 +3233,7 @@ abi_long do_syscall(void *cpu_env, int n
173 _mcleanup();
174 #endif
175 gdb_exit(cpu_env, arg1);
176- /* XXX: should free thread stack and CPU env */
177+ /* XXX: should free thread stack, GDT and CPU env */
178 _exit(arg1);
179 ret = 0; /* avoid warning */
180 break;
181@@ -5569,6 +5657,9 @@ abi_long do_syscall(void *cpu_env, int n
182 #elif defined(TARGET_I386) && defined(TARGET_ABI32)
183 ret = do_set_thread_area(cpu_env, arg1);
184 break;
185+#elif TARGET_i386
186+ ret = get_errno(do_set_thread_area(cpu_env, arg1));
187+ break;
188 #else
189 goto unimplemented_nowarn;
190 #endif
191@@ -5586,6 +5677,16 @@ abi_long do_syscall(void *cpu_env, int n
192 goto unimplemented_nowarn;
193 #endif
194
195+#ifdef TARGET_NR_futex
196+ case TARGET_NR_futex:
197+ ret = get_errno(do_futex(arg1, arg2, arg3, arg4, arg5, arg6));
198+ break;
199+#endif
200+#ifdef TARGET_NR_set_robust_list
201+ case TARGET_NR_set_robust_list:
202+ goto unimplemented_nowarn;
203+#endif
204+
205 #ifdef TARGET_NR_clock_gettime
206 case TARGET_NR_clock_gettime:
207 {
208@@ -5627,11 +5728,6 @@ abi_long do_syscall(void *cpu_env, int n
209 break;
210 #endif
211
212-#ifdef TARGET_NR_set_robust_list
213- case TARGET_NR_set_robust_list:
214- goto unimplemented_nowarn;
215-#endif
216-
217 #if defined(TARGET_NR_utimensat) && defined(__NR_utimensat)
218 case TARGET_NR_utimensat:
219 {
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl.patch
new file mode 100644
index 0000000000..3e46744af2
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl.patch
@@ -0,0 +1,854 @@
1These are Paul Brook's patches to QEMU-0.8.2 to enable the running of single
2ARM binaries under QEMU's user-emulation mode. Without them, QEMU-0.8.1
3immediately dies saying:
4 Error: f0005
5 qemu: uncaught target signal 6 (Aborted) - exiting
6while qemu-0.8.2 dies saying:
7 qemu: Unsupported syscall: 983045
8 cannot set up thread-local storage: unknown error
9
10This file is a rediffing of the patches visible at
11https://nowt.dyndns.org/patch.qemu_nptl on 27 Sept 2006
12which "patch" fails to apply automatically.
13See also http://lists.gnu.org/archive/html/qemu-devel/2006-09/msg00194.html
14
15 Martin Guy, 27 Sept 2006
16
17---
18 configure | 25 ++++++
19 exec-all.h | 165 ------------------------------------------
20 linux-user/arm/syscall.h | 4 -
21 linux-user/main.c | 94 +++++++++++++++++++++---
22 linux-user/qemu.h | 3
23 linux-user/syscall.c | 91 ++++++++++++++++++++++-
24 qemu_spinlock.h | 181 +++++++++++++++++++++++++++++++++++++++++++++++
25 target-arm/cpu.h | 10 ++
26 target-arm/op.c | 6 +
27 target-arm/translate.c | 9 ++
28 10 files changed, 405 insertions(+), 183 deletions(-)
29
30Index: qemu/configure
31===================================================================
32--- qemu.orig/configure 2007-12-03 19:34:02.000000000 +0000
33+++ qemu/configure 2007-12-03 23:46:51.000000000 +0000
34@@ -105,6 +105,7 @@ linux_user="no"
35 darwin_user="no"
36 build_docs="no"
37 uname_release=""
38+nptl="yes"
39
40 # OS specific
41 targetos=`uname -s`
42@@ -324,6 +325,8 @@ for opt do
43 ;;
44 *) echo "ERROR: unknown option $opt"; show_help="yes"
45 ;;
46+ --disable-nptl) nptl="no"
47+ ;;
48 esac
49 done
50
51@@ -419,6 +422,7 @@ echo " --enable-linux-user enable
52 echo " --disable-linux-user disable all linux usermode emulation targets"
53 echo " --enable-darwin-user enable all darwin usermode emulation targets"
54 echo " --disable-darwin-user disable all darwin usermode emulation targets"
55+echo " --disable-nptl disable usermode NPTL guest support"
56 echo " --fmod-lib path to FMOD library"
57 echo " --fmod-inc path to FMOD includes"
58 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
59@@ -585,6 +589,23 @@ int main(void) {
60 }
61 EOF
62
63+# check NPTL support
64+cat > $TMPC <<EOF
65+#include <sched.h>
66+void foo()
67+{
68+#ifndef CLONE_SETTLS
69+#error bork
70+#endif
71+}
72+EOF
73+
74+if $cc -c -o $TMPO $TMPC 2> /dev/null ; then
75+ :
76+else
77+ nptl="no"
78+fi
79+
80 ##########################################
81 # SDL probe
82
83@@ -749,6 +770,7 @@ echo "kqemu support $kqemu"
84 echo "Documentation $build_docs"
85 [ ! -z "$uname_release" ] && \
86 echo "uname -r $uname_release"
87+echo "NPTL support $nptl"
88
89 if test $sdl_too_old = "yes"; then
90 echo "-> Your SDL version is too old - please upgrade to have SDL support"
91@@ -954,6 +976,9 @@ if test "$sdl1" = "yes" ; then
92 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
93 fi
94 fi
95+if test "$nptl" = "yes" ; then
96+ echo "#define USE_NPTL 1" >> $config_h
97+fi
98 if test "$cocoa" = "yes" ; then
99 echo "#define CONFIG_COCOA 1" >> $config_h
100 echo "CONFIG_COCOA=yes" >> $config_mak
101Index: qemu/exec-all.h
102===================================================================
103--- qemu.orig/exec-all.h 2007-12-03 19:32:15.000000000 +0000
104+++ qemu/exec-all.h 2007-12-03 19:34:09.000000000 +0000
105@@ -340,170 +340,7 @@ extern CPUWriteMemoryFunc *io_mem_write[
106 extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4];
107 extern void *io_mem_opaque[IO_MEM_NB_ENTRIES];
108
109-#if defined(__powerpc__)
110-static inline int testandset (int *p)
111-{
112- int ret;
113- __asm__ __volatile__ (
114- "0: lwarx %0,0,%1\n"
115- " xor. %0,%3,%0\n"
116- " bne 1f\n"
117- " stwcx. %2,0,%1\n"
118- " bne- 0b\n"
119- "1: "
120- : "=&r" (ret)
121- : "r" (p), "r" (1), "r" (0)
122- : "cr0", "memory");
123- return ret;
124-}
125-#elif defined(__i386__)
126-static inline int testandset (int *p)
127-{
128- long int readval = 0;
129-
130- __asm__ __volatile__ ("lock; cmpxchgl %2, %0"
131- : "+m" (*p), "+a" (readval)
132- : "r" (1)
133- : "cc");
134- return readval;
135-}
136-#elif defined(__x86_64__)
137-static inline int testandset (int *p)
138-{
139- long int readval = 0;
140-
141- __asm__ __volatile__ ("lock; cmpxchgl %2, %0"
142- : "+m" (*p), "+a" (readval)
143- : "r" (1)
144- : "cc");
145- return readval;
146-}
147-#elif defined(__s390__)
148-static inline int testandset (int *p)
149-{
150- int ret;
151-
152- __asm__ __volatile__ ("0: cs %0,%1,0(%2)\n"
153- " jl 0b"
154- : "=&d" (ret)
155- : "r" (1), "a" (p), "0" (*p)
156- : "cc", "memory" );
157- return ret;
158-}
159-#elif defined(__alpha__)
160-static inline int testandset (int *p)
161-{
162- int ret;
163- unsigned long one;
164-
165- __asm__ __volatile__ ("0: mov 1,%2\n"
166- " ldl_l %0,%1\n"
167- " stl_c %2,%1\n"
168- " beq %2,1f\n"
169- ".subsection 2\n"
170- "1: br 0b\n"
171- ".previous"
172- : "=r" (ret), "=m" (*p), "=r" (one)
173- : "m" (*p));
174- return ret;
175-}
176-#elif defined(__sparc__)
177-static inline int testandset (int *p)
178-{
179- int ret;
180-
181- __asm__ __volatile__("ldstub [%1], %0"
182- : "=r" (ret)
183- : "r" (p)
184- : "memory");
185-
186- return (ret ? 1 : 0);
187-}
188-#elif defined(__arm__)
189-static inline int testandset (int *spinlock)
190-{
191- register unsigned int ret;
192- __asm__ __volatile__("swp %0, %1, [%2]"
193- : "=r"(ret)
194- : "0"(1), "r"(spinlock));
195-
196- return ret;
197-}
198-#elif defined(__mc68000)
199-static inline int testandset (int *p)
200-{
201- char ret;
202- __asm__ __volatile__("tas %1; sne %0"
203- : "=r" (ret)
204- : "m" (p)
205- : "cc","memory");
206- return ret;
207-}
208-#elif defined(__ia64)
209-
210-#include <ia64intrin.h>
211-
212-static inline int testandset (int *p)
213-{
214- return __sync_lock_test_and_set (p, 1);
215-}
216-#elif defined(__mips__)
217-static inline int testandset (int *p)
218-{
219- int ret;
220-
221- __asm__ __volatile__ (
222- " .set push \n"
223- " .set noat \n"
224- " .set mips2 \n"
225- "1: li $1, 1 \n"
226- " ll %0, %1 \n"
227- " sc $1, %1 \n"
228- " beqz $1, 1b \n"
229- " .set pop "
230- : "=r" (ret), "+R" (*p)
231- :
232- : "memory");
233-
234- return ret;
235-}
236-#else
237-#error unimplemented CPU support
238-#endif
239-
240-typedef int spinlock_t;
241-
242-#define SPIN_LOCK_UNLOCKED 0
243-
244-#if defined(CONFIG_USER_ONLY)
245-static inline void spin_lock(spinlock_t *lock)
246-{
247- while (testandset(lock));
248-}
249-
250-static inline void spin_unlock(spinlock_t *lock)
251-{
252- *lock = 0;
253-}
254-
255-static inline int spin_trylock(spinlock_t *lock)
256-{
257- return !testandset(lock);
258-}
259-#else
260-static inline void spin_lock(spinlock_t *lock)
261-{
262-}
263-
264-static inline void spin_unlock(spinlock_t *lock)
265-{
266-}
267-
268-static inline int spin_trylock(spinlock_t *lock)
269-{
270- return 1;
271-}
272-#endif
273+#include "qemu_spinlock.h"
274
275 extern spinlock_t tb_lock;
276
277Index: qemu/linux-user/arm/syscall.h
278===================================================================
279--- qemu.orig/linux-user/arm/syscall.h 2007-12-03 19:32:15.000000000 +0000
280+++ qemu/linux-user/arm/syscall.h 2007-12-03 19:34:09.000000000 +0000
281@@ -28,7 +28,9 @@ struct target_pt_regs {
282 #define ARM_SYSCALL_BASE 0x900000
283 #define ARM_THUMB_SYSCALL 0
284
285-#define ARM_NR_cacheflush (ARM_SYSCALL_BASE + 0xf0000 + 2)
286+#define ARM_NR_BASE 0xf0000
287+#define ARM_NR_cacheflush (ARM_NR_BASE + 2)
288+#define ARM_NR_set_tls (ARM_NR_BASE + 5)
289
290 #define ARM_NR_semihosting 0x123456
291 #define ARM_NR_thumb_semihosting 0xAB
292Index: qemu/linux-user/main.c
293===================================================================
294--- qemu.orig/linux-user/main.c 2007-12-03 19:33:53.000000000 +0000
295+++ qemu/linux-user/main.c 2007-12-03 23:47:10.000000000 +0000
296@@ -363,6 +363,50 @@ static void arm_cache_flush(abi_ulong st
297 }
298 }
299
300+/* Handle a jump to the kernel code page. */
301+static int
302+do_kernel_trap(CPUARMState *env)
303+{
304+ uint32_t addr;
305+ uint32_t *ptr;
306+ uint32_t cpsr;
307+
308+ switch (env->regs[15]) {
309+ case 0xffff0fc0: /* __kernel_cmpxchg */
310+ /* XXX: This only works between threads, not between processes.
311+ Use native atomic operations. */
312+ /* ??? This probably breaks horribly if the access segfaults. */
313+ cpu_lock();
314+ ptr = (uint32_t *)env->regs[2];
315+ cpsr = cpsr_read(env);
316+ if (*ptr == env->regs[0]) {
317+ *ptr = env->regs[1];
318+ env->regs[0] = 0;
319+ cpsr |= CPSR_C;
320+ } else {
321+ env->regs[0] = -1;
322+ cpsr &= ~CPSR_C;
323+ }
324+ cpsr_write(env, cpsr, CPSR_C);
325+ cpu_unlock();
326+ break;
327+ case 0xffff0fe0: /* __kernel_get_tls */
328+ env->regs[0] = env->cp15.c13_tls;
329+ break;
330+ default:
331+ return 1;
332+ }
333+ /* Jump back to the caller. */
334+ addr = env->regs[14];
335+ if (addr & 1) {
336+ env->thumb = 1;
337+ addr &= ~1;
338+ }
339+ env->regs[15] = addr;
340+
341+ return 0;
342+}
343+
344 void cpu_loop(CPUARMState *env)
345 {
346 int trapnr;
347@@ -473,10 +517,8 @@ void cpu_loop(CPUARMState *env)
348 }
349 }
350
351- if (n == ARM_NR_cacheflush) {
352- arm_cache_flush(env->regs[0], env->regs[1]);
353- } else if (n == ARM_NR_semihosting
354- || n == ARM_NR_thumb_semihosting) {
355+ if (n == ARM_NR_semihosting
356+ || n == ARM_NR_thumb_semihosting) {
357 env->regs[0] = do_arm_semihosting (env);
358 } else if (n == 0 || n >= ARM_SYSCALL_BASE
359 || (env->thumb && n == ARM_THUMB_SYSCALL)) {
360@@ -487,14 +529,34 @@ void cpu_loop(CPUARMState *env)
361 n -= ARM_SYSCALL_BASE;
362 env->eabi = 0;
363 }
364- env->regs[0] = do_syscall(env,
365- n,
366- env->regs[0],
367- env->regs[1],
368- env->regs[2],
369- env->regs[3],
370- env->regs[4],
371- env->regs[5]);
372+ if ( n > ARM_NR_BASE) {
373+ switch (n)
374+ {
375+ case ARM_NR_cacheflush:
376+ arm_cache_flush(env->regs[0], env->regs[1]);
377+ break;
378+#ifdef USE_NPTL
379+ case ARM_NR_set_tls:
380+ cpu_set_tls(env, env->regs[0]);
381+ env->regs[0] = 0;
382+ break;
383+#endif
384+ default:
385+ printf ("Error: Bad syscall: %x\n", n);
386+ goto error;
387+ }
388+ }
389+ else
390+ {
391+ env->regs[0] = do_syscall(env,
392+ n,
393+ env->regs[0],
394+ env->regs[1],
395+ env->regs[2],
396+ env->regs[3],
397+ env->regs[4],
398+ env->regs[5]);
399+ }
400 } else {
401 goto error;
402 }
403@@ -533,6 +595,10 @@ void cpu_loop(CPUARMState *env)
404 }
405 }
406 break;
407+ case EXCP_KERNEL_TRAP:
408+ if (do_kernel_trap(env))
409+ goto error;
410+ break;
411 default:
412 error:
413 fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
414@@ -2380,6 +2446,10 @@ int main(int argc, char **argv)
415 ts->heap_base = info->brk;
416 /* This will be filled in on the first SYS_HEAPINFO call. */
417 ts->heap_limit = 0;
418+ /* Register the magic kernel code page. The cpu will generate a
419+ special exception when it tries to execute code here. We can't
420+ put real code here because it may be in use by the host kernel. */
421+ page_set_flags(0xffff0000, 0xffff0fff, 0);
422 #endif
423
424 if (gdbstub_port) {
425Index: qemu/linux-user/qemu.h
426===================================================================
427--- qemu.orig/linux-user/qemu.h 2007-12-03 19:32:15.000000000 +0000
428+++ qemu/linux-user/qemu.h 2007-12-03 19:34:09.000000000 +0000
429@@ -102,6 +102,9 @@ typedef struct TaskState {
430 uint32_t heap_base;
431 uint32_t heap_limit;
432 #endif
433+#ifdef USE_NPTL
434+ uint32_t *child_tidptr;
435+#endif
436 int used; /* non zero if used */
437 struct image_info *info;
438 uint8_t stack[0];
439Index: qemu/linux-user/syscall.c
440===================================================================
441--- qemu.orig/linux-user/syscall.c 2007-12-03 19:33:48.000000000 +0000
442+++ qemu/linux-user/syscall.c 2007-12-03 23:47:10.000000000 +0000
443@@ -71,9 +71,18 @@
444 #include <linux/kd.h>
445
446 #include "qemu.h"
447+#include "qemu_spinlock.h"
448
449 //#define DEBUG
450
451+#ifdef USE_NPTL
452+#define CLONE_NPTL_FLAGS2 (CLONE_SETTLS | \
453+ CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)
454+#else
455+/* XXX: Hardcode the above values. */
456+#define CLONE_NPTL_FLAGS2 0
457+#endif
458+
459 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
460 || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
461 /* 16 bit uid wrappers emulation */
462@@ -2692,9 +2701,19 @@ abi_long do_arch_prctl(CPUX86State *env,
463 thread/process */
464 #define NEW_STACK_SIZE 8192
465
466+#ifdef USE_NPTL
467+static spinlock_t nptl_lock = SPIN_LOCK_UNLOCKED;
468+#endif
469+
470 static int clone_func(void *arg)
471 {
472 CPUState *env = arg;
473+#ifdef HAVE_NPTL
474+ /* Wait until the parent has finshed initializing the tls state. */
475+ while (!spin_trylock(&nptl_lock))
476+ usleep(1);
477+ spin_unlock(&nptl_lock);
478+#endif
479 cpu_loop(env);
480 /* never exits */
481 return 0;
482@@ -2702,13 +2721,22 @@ static int clone_func(void *arg)
483
484 /* do_fork() Must return host values and target errnos (unlike most
485 do_*() functions). */
486-int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp)
487+int do_fork(CPUState *env, unsigned int flags, unsigned long newsp,
488+ uint32_t *parent_tidptr, void *newtls,
489+ uint32_t *child_tidptr)
490 {
491 int ret;
492 TaskState *ts;
493 uint8_t *new_stack;
494 CPUState *new_env;
495
496+#ifdef USE_NPTL
497+ unsigned int nptl_flags;
498+
499+ if (flags & CLONE_PARENT_SETTID)
500+ *parent_tidptr = gettid();
501+#endif
502+
503 if (flags & CLONE_VM) {
504 ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE);
505 memset(ts, 0, sizeof(TaskState));
506@@ -2774,16 +2802,67 @@ int do_fork(CPUState *env, unsigned int
507 #error unsupported target CPU
508 #endif
509 new_env->opaque = ts;
510+#ifdef USE_NPTL
511+ nptl_flags = flags;
512+ flags &= ~CLONE_NPTL_FLAGS2;
513+
514+ if (nptl_flags & CLONE_CHILD_CLEARTID) {
515+ ts->child_tidptr = child_tidptr;
516+ }
517+
518+ if (nptl_flags & CLONE_SETTLS)
519+ cpu_set_tls (new_env, newtls);
520+
521+ /* Grab the global cpu lock so that the thread setup appears
522+ atomic. */
523+ if (nptl_flags & CLONE_CHILD_SETTID)
524+ spin_lock(&nptl_lock);
525+
526+#else
527+ if (flags & CLONE_NPTL_FLAGS2)
528+ return -EINVAL;
529+#endif
530+
531+ if (CLONE_VFORK & flags)
532+ flags ^= CLONE_VM;
533 #ifdef __ia64__
534 ret = __clone2(clone_func, new_stack + NEW_STACK_SIZE, flags, new_env);
535 #else
536 ret = clone(clone_func, new_stack + NEW_STACK_SIZE, flags, new_env);
537 #endif
538+#ifdef USE_NPTL
539+ if (ret != -1) {
540+ if (nptl_flags & CLONE_CHILD_SETTID)
541+ *child_tidptr = ret;
542+ }
543+
544+ /* Allow the child to continue. */
545+ if (nptl_flags & CLONE_CHILD_SETTID)
546+ spin_unlock(&nptl_lock);
547+#endif
548 } else {
549 /* if no CLONE_VM, we consider it is a fork */
550- if ((flags & ~CSIGNAL) != 0)
551+ if ((flags & ~(CSIGNAL | CLONE_NPTL_FLAGS2)) != 0)
552 return -EINVAL;
553 ret = fork();
554+#ifdef USE_NPTL
555+ /* There is a race condition here. The parent process could
556+ theoretically read the TID in the child process before the child
557+ tid is set. This would require using either ptrace
558+ (not implemented) or having *_tidptr to point at a shared memory
559+ mapping. We can't repeat the spinlock hack used above because
560+ the child process gets its own copy of the lock. */
561+ if (ret == 0) {
562+ /* Child Process. */
563+ if (flags & CLONE_CHILD_SETTID)
564+ *child_tidptr = gettid();
565+ ts = (TaskState *)env->opaque;
566+ if (flags & CLONE_CHILD_CLEARTID)
567+ ts->child_tidptr = child_tidptr;
568+ if (flags & CLONE_SETTLS)
569+ cpu_set_tls (env, newtls);
570+ }
571+#endif
572 }
573 return ret;
574 }
575@@ -3108,7 +3187,7 @@ abi_long do_syscall(void *cpu_env, int n
576 ret = do_brk(arg1);
577 break;
578 case TARGET_NR_fork:
579- ret = get_errno(do_fork(cpu_env, SIGCHLD, 0));
580+ ret = get_errno(do_fork(cpu_env, SIGCHLD, 0, NULL, NULL, NULL));
581 break;
582 #ifdef TARGET_NR_waitpid
583 case TARGET_NR_waitpid:
584@@ -4465,7 +4544,8 @@ abi_long do_syscall(void *cpu_env, int n
585 ret = get_errno(fsync(arg1));
586 break;
587 case TARGET_NR_clone:
588- ret = get_errno(do_fork(cpu_env, arg1, arg2));
589+ ret = get_errno(do_fork(cpu_env, arg1, arg2, (uint32_t *)arg3,
590+ (void *)arg4, (uint32_t *)arg5));
591 break;
592 #ifdef __NR_exit_group
593 /* new thread calls */
594@@ -4910,7 +4990,8 @@ abi_long do_syscall(void *cpu_env, int n
595 #endif
596 #ifdef TARGET_NR_vfork
597 case TARGET_NR_vfork:
598- ret = get_errno(do_fork(cpu_env, CLONE_VFORK | CLONE_VM | SIGCHLD, 0));
599+ ret = get_errno(do_fork(cpu_env, CLONE_VFORK | CLONE_VM | SIGCHLD, 0,
600+ NULL, NULL, NULL));
601 break;
602 #endif
603 #ifdef TARGET_NR_ugetrlimit
604Index: qemu/qemu_spinlock.h
605===================================================================
606--- /dev/null 1970-01-01 00:00:00.000000000 +0000
607+++ qemu/qemu_spinlock.h 2007-12-03 19:34:09.000000000 +0000
608@@ -0,0 +1,181 @@
609+/*
610+ * Atomic operation helper include
611+ *
612+ * Copyright (c) 2005 Fabrice Bellard
613+ *
614+ * This library is free software; you can redistribute it and/or
615+ * modify it under the terms of the GNU Lesser General Public
616+ * License as published by the Free Software Foundation; either
617+ * version 2 of the License, or (at your option) any later version.
618+ *
619+ * This library is distributed in the hope that it will be useful,
620+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
621+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
622+ * Lesser General Public License for more details.
623+ *
624+ * You should have received a copy of the GNU Lesser General Public
625+ * License along with this library; if not, write to the Free Software
626+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
627+ */
628+#ifndef QEMU_SPINLOCK_H
629+#define QEMU_SPINLOCK_H
630+
631+#ifdef __powerpc__
632+static inline int testandset (int *p)
633+{
634+ int ret;
635+ __asm__ __volatile__ (
636+ "0: lwarx %0,0,%1\n"
637+ " xor. %0,%3,%0\n"
638+ " bne 1f\n"
639+ " stwcx. %2,0,%1\n"
640+ " bne- 0b\n"
641+ "1: "
642+ : "=&r" (ret)
643+ : "r" (p), "r" (1), "r" (0)
644+ : "cr0", "memory");
645+ return ret;
646+}
647+#endif
648+
649+#ifdef __i386__
650+static inline int testandset (int *p)
651+{
652+ long int readval = 0;
653+
654+ __asm__ __volatile__ ("lock; cmpxchgl %2, %0"
655+ : "+m" (*p), "+a" (readval)
656+ : "r" (1)
657+ : "cc");
658+ return readval;
659+}
660+#endif
661+
662+#ifdef __x86_64__
663+static inline int testandset (int *p)
664+{
665+ long int readval = 0;
666+
667+ __asm__ __volatile__ ("lock; cmpxchgl %2, %0"
668+ : "+m" (*p), "+a" (readval)
669+ : "r" (1)
670+ : "cc");
671+ return readval;
672+}
673+#endif
674+
675+#ifdef __s390__
676+static inline int testandset (int *p)
677+{
678+ int ret;
679+
680+ __asm__ __volatile__ ("0: cs %0,%1,0(%2)\n"
681+ " jl 0b"
682+ : "=&d" (ret)
683+ : "r" (1), "a" (p), "0" (*p)
684+ : "cc", "memory" );
685+ return ret;
686+}
687+#endif
688+
689+#ifdef __alpha__
690+static inline int testandset (int *p)
691+{
692+ int ret;
693+ unsigned long one;
694+
695+ __asm__ __volatile__ ("0: mov 1,%2\n"
696+ " ldl_l %0,%1\n"
697+ " stl_c %2,%1\n"
698+ " beq %2,1f\n"
699+ ".subsection 2\n"
700+ "1: br 0b\n"
701+ ".previous"
702+ : "=r" (ret), "=m" (*p), "=r" (one)
703+ : "m" (*p));
704+ return ret;
705+}
706+#endif
707+
708+#ifdef __sparc__
709+static inline int testandset (int *p)
710+{
711+ int ret;
712+
713+ __asm__ __volatile__("ldstub [%1], %0"
714+ : "=r" (ret)
715+ : "r" (p)
716+ : "memory");
717+
718+ return (ret ? 1 : 0);
719+}
720+#endif
721+
722+#ifdef __arm__
723+static inline int testandset (int *spinlock)
724+{
725+ register unsigned int ret;
726+ __asm__ __volatile__("swp %0, %1, [%2]"
727+ : "=r"(ret)
728+ : "0"(1), "r"(spinlock));
729+
730+ return ret;
731+}
732+#endif
733+
734+#ifdef __mc68000
735+static inline int testandset (int *p)
736+{
737+ char ret;
738+ __asm__ __volatile__("tas %1; sne %0"
739+ : "=r" (ret)
740+ : "m" (p)
741+ : "cc","memory");
742+ return ret;
743+}
744+#endif
745+
746+#ifdef __ia64
747+#include <ia64intrin.h>
748+
749+static inline int testandset (int *p)
750+{
751+ return __sync_lock_test_and_set (p, 1);
752+}
753+#endif
754+
755+typedef int spinlock_t;
756+
757+#define SPIN_LOCK_UNLOCKED 0
758+
759+#if defined(CONFIG_USER_ONLY)
760+static inline void spin_lock(spinlock_t *lock)
761+{
762+ while (testandset(lock));
763+}
764+
765+static inline void spin_unlock(spinlock_t *lock)
766+{
767+ *lock = 0;
768+}
769+
770+static inline int spin_trylock(spinlock_t *lock)
771+{
772+ return !testandset(lock);
773+}
774+#else
775+static inline void spin_lock(spinlock_t *lock)
776+{
777+}
778+
779+static inline void spin_unlock(spinlock_t *lock)
780+{
781+}
782+
783+static inline int spin_trylock(spinlock_t *lock)
784+{
785+ return 1;
786+}
787+#endif
788+
789+#endif
790Index: qemu/target-arm/cpu.h
791===================================================================
792--- qemu.orig/target-arm/cpu.h 2007-12-03 19:32:15.000000000 +0000
793+++ qemu/target-arm/cpu.h 2007-12-03 23:45:48.000000000 +0000
794@@ -38,6 +38,7 @@
795 #define EXCP_FIQ 6
796 #define EXCP_BKPT 7
797 #define EXCP_EXCEPTION_EXIT 8 /* Return from v7M exception. */
798+#define EXCP_KERNEL_TRAP 9 /* Jumped to kernel code page. */
799
800 #define ARMV7M_EXCP_RESET 1
801 #define ARMV7M_EXCP_NMI 2
802@@ -222,6 +223,15 @@ int cpu_arm_signal_handler(int host_sign
803 void cpu_lock(void);
804 void cpu_unlock(void);
805
806+void cpu_lock(void);
807+void cpu_unlock(void);
808+#if defined(USE_NPTL)
809+static inline void cpu_set_tls(CPUARMState *env, void *newtls)
810+{
811+ env->cp15.c13_tls2 = (uint32_t)(long)newtls;
812+}
813+#endif
814+
815 #define CPSR_M (0x1f)
816 #define CPSR_T (1 << 5)
817 #define CPSR_F (1 << 6)
818Index: qemu/target-arm/op.c
819===================================================================
820--- qemu.orig/target-arm/op.c 2007-12-03 19:32:15.000000000 +0000
821+++ qemu/target-arm/op.c 2007-12-03 19:34:09.000000000 +0000
822@@ -1009,6 +1009,12 @@ void OPPROTO op_exception_exit(void)
823 cpu_loop_exit();
824 }
825
826+void OPPROTO op_kernel_trap(void)
827+{
828+ env->exception_index = EXCP_KERNEL_TRAP;
829+ cpu_loop_exit();
830+}
831+
832 /* VFP support. We follow the convention used for VFP instrunctions:
833 Single precition routines have a "s" suffix, double precision a
834 "d" suffix. */
835Index: qemu/target-arm/translate.c
836===================================================================
837--- qemu.orig/target-arm/translate.c 2007-12-03 19:32:15.000000000 +0000
838+++ qemu/target-arm/translate.c 2007-12-03 19:34:09.000000000 +0000
839@@ -7520,7 +7520,14 @@ static inline int gen_intermediate_code_
840 gen_op_exception_exit();
841 }
842 #endif
843-
844+#ifdef CONFIG_USER_ONLY
845+ /* Intercept jump to the magic kernel page. */
846+ if (dc->pc > 0xffff0000) {
847+ gen_op_kernel_trap();
848+ dc->is_jmp = DISAS_UPDATE;
849+ break;
850+ }
851+#endif
852 if (env->nb_breakpoints > 0) {
853 for(j = 0; j < env->nb_breakpoints; j++) {
854 if (env->breakpoints[j] == dc->pc) {
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-amd64-32b-mapping-0.9.0.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-amd64-32b-mapping-0.9.0.patch
new file mode 100644
index 0000000000..c7f36d8110
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-amd64-32b-mapping-0.9.0.patch
@@ -0,0 +1,37 @@
1---
2 linux-user/mmap.c | 8 ++++++--
3 1 file changed, 6 insertions(+), 2 deletions(-)
4
5Index: qemu/linux-user/mmap.c
6===================================================================
7--- qemu.orig/linux-user/mmap.c 2007-12-03 15:40:25.000000000 +0000
8+++ qemu/linux-user/mmap.c 2007-12-03 16:37:21.000000000 +0000
9@@ -29,6 +29,10 @@
10
11 //#define DEBUG_MMAP
12
13+#ifndef MAP_32BIT
14+#define MAP_32BIT 0
15+#endif
16+
17 /* NOTE: all the constants are the HOST ones, but addresses are target. */
18 int target_mprotect(abi_ulong start, abi_ulong len, int prot)
19 {
20@@ -251,7 +255,7 @@ abi_long target_mmap(abi_ulong start, ab
21 especially important if qemu_host_page_size >
22 qemu_real_host_page_size */
23 p = mmap(g2h(mmap_start),
24- host_len, prot, flags | MAP_FIXED, fd, host_offset);
25+ host_len, prot, flags | MAP_FIXED | MAP_32BIT, fd, host_offset);
26 if (p == MAP_FAILED)
27 return -1;
28 /* update start so that it points to the file position at 'offset' */
29@@ -406,7 +410,7 @@ abi_long target_mremap(abi_ulong old_add
30 unsigned long host_addr;
31
32 /* XXX: use 5 args syscall */
33- host_addr = (long)mremap(g2h(old_addr), old_size, new_size, flags);
34+ host_addr = (long)mremap(g2h(old_addr), old_size, new_size, flags | MAP_32BIT);
35 if (host_addr == -1)
36 return -1;
37 new_addr = h2g(host_addr);
diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/workaround_bad_futex_headers.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/workaround_bad_futex_headers.patch
new file mode 100644
index 0000000000..cc122ebdba
--- /dev/null
+++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/workaround_bad_futex_headers.patch
@@ -0,0 +1,25 @@
1---
2 linux-user/syscall.c | 10 +++++++++-
3 1 file changed, 9 insertions(+), 1 deletion(-)
4
5Index: qemu/linux-user/syscall.c
6===================================================================
7--- qemu.orig/linux-user/syscall.c 2007-08-09 20:28:06.000000000 +0100
8+++ qemu/linux-user/syscall.c 2007-08-09 20:28:41.000000000 +0100
9@@ -61,7 +61,15 @@
10 #define tchars host_tchars /* same as target */
11 #define ltchars host_ltchars /* same as target */
12
13-#include <linux/futex.h>
14+#define FUTEX_WAIT 0
15+#define FUTEX_WAKE 1
16+#define FUTEX_FD 2
17+#define FUTEX_REQUEUE 3
18+#define FUTEX_CMP_REQUEUE 4
19+#define FUTEX_WAKE_OP 5
20+#define FUTEX_LOCK_PI 6
21+#define FUTEX_UNLOCK_PI 7
22+
23 #include <linux/termios.h>
24 #include <linux/unistd.h>
25 #include <linux/utsname.h>
diff --git a/meta/packages/qemu/qemu-native_20071121.bb b/meta/packages/qemu/qemu-native_20071121.bb
new file mode 100644
index 0000000000..28373e273e
--- /dev/null
+++ b/meta/packages/qemu/qemu-native_20071121.bb
@@ -0,0 +1,5 @@
1require qemu_${PV}.bb
2inherit native
3DEPENDS = "zlib-native"
4
5require qemu-gcc3-check.inc
diff --git a/meta/packages/qemu/qemu_20071121.bb b/meta/packages/qemu/qemu_20071121.bb
new file mode 100644
index 0000000000..63100806b0
--- /dev/null
+++ b/meta/packages/qemu/qemu_20071121.bb
@@ -0,0 +1,58 @@
1LICENSE = "GPL"
2DEPENDS = "zlib"
3SRCDATE = "20071121"
4PV = "0.9.0+cvs${SRCDATE}"
5
6DEFAULT_PREFERENCE = "-1"
7
8FILESPATH = "${FILE_DIRNAME}/qemu-${PV}:${FILE_DIRNAME}/files"
9FILESDIR = "${WORKDIR}"
10
11SRC_URI = "\
12 cvs://anonymous@cvs.savannah.nongnu.org/sources/qemu;method=pserver;rsh=ssh;module=qemu \
13 file://02_snapshot_use_tmpdir.patch;patch=1;pnum=0 \
14 file://04_do_not_print_rtc_freq_if_ok.patch;patch=1;pnum=1 \
15 file://05_non-fatal_if_linux_hd_missing.patch;patch=1;pnum=1 \
16 file://06_exit_segfault.patch;patch=1;pnum=0 \
17 file://10_signal_jobs.patch;patch=1;pnum=0 \
18 file://11_signal_sigaction.patch;patch=1;pnum=0 \
19 file://22_net_tuntap_stall.patch;patch=1;pnum=0 \
20 file://31_syscalls.patch;patch=1;pnum=0 \
21 file://32_syscall_sysctl.patch;patch=1;pnum=0 \
22 file://33_syscall_ppc_clone.patch;patch=1;pnum=0 \
23 file://39_syscall_fadvise64.patch;patch=1;pnum=0 \
24 file://41_arm_fpa_sigfpe.patch;patch=1;pnum=0 \
25 file://52_ne2000_return.patch;patch=1;pnum=1 \
26 file://61_safe_64bit_int.patch;patch=1;pnum=0 \
27 file://63_sparc_build.patch;patch=1;pnum=0 \
28 file://64_ppc_asm_constraints.patch;patch=1;pnum=1 \
29 file://65_kfreebsd.patch;patch=1;pnum=0 \
30 file://66_tls_ld.patch;patch=1;pnum=0 \
31 file://91-oh-sdl-cursor.patch;patch=1;pnum=0 \
32 file://qemu-0.9.0-nptl.patch;patch=1 \
33 file://qemu-0.9.0-nptl-update.patch;patch=1 \
34 file://qemu-amd64-32b-mapping-0.9.0.patch;patch=1 \
35 file://workaround_bad_futex_headers.patch;patch=1 \
36 file://fix_segfault.patch;patch=1 \
37 file://disable-error-in-configure.patch;patch=1"
38
39# svn://svn.o-hand.com/repos/misc/trunk/qemu-packaging/qemu;module=debian;proto=http;srcdate=20070119 \
40# file://debian/patches/21_net_soopts.patch;patch=1;pnum=0 \
41# file://debian/patches/35_syscall_sockaddr.patch;patch=1;pnum=0 \
42# file://debian/patches/43_arm_cpustate.patch;patch=1;pnum=0 \
43# file://debian/patches/62_linux_boot_nasm.patch;patch=1;pnum=0 \
44# file://debian/patches/67_ppc_ftbfs.patch;patch=1;pnum=0 \
45# file://debian/patches/80_ui_curses.patch;patch=1;pnum=0 \
46# file://debian/patches/96-x.patch;patch=1"
47
48S = "${WORKDIR}/qemu"
49
50#EXTRA_OECONF += "--disable-sdl"
51#EXTRA_OECONF += "--target-list=arm-linux-user"
52EXTRA_OECONF += "--disable-gfx-check"
53
54inherit autotools
55
56do_configure() {
57 oe_runconf
58}