diff options
author | Marcin Juszkiewicz <hrw@openedhand.com> | 2008-01-09 11:16:08 +0000 |
---|---|---|
committer | Marcin Juszkiewicz <hrw@openedhand.com> | 2008-01-09 11:16:08 +0000 |
commit | 3e5646fce1af97a8bde8a740da4ee0c58bf42ebd (patch) | |
tree | 2d5c0dc86ac168f2b3ae135d5d66ba84e36f9478 /meta/packages/qemu/qemu-0.9.1 | |
parent | 03e591a793512342acac958597047f34a9d5bfbe (diff) | |
download | poky-3e5646fce1af97a8bde8a740da4ee0c58bf42ebd.tar.gz |
qemu: upgrade CVS snapshot 20071230 to 0.9.1 release
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3435 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/qemu/qemu-0.9.1')
25 files changed, 1878 insertions, 0 deletions
diff --git a/meta/packages/qemu/qemu-0.9.1/02_snapshot_use_tmpdir.patch b/meta/packages/qemu/qemu-0.9.1/02_snapshot_use_tmpdir.patch new file mode 100644 index 0000000000..40264ed443 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
6 | Index: 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.1/04_do_not_print_rtc_freq_if_ok.patch b/meta/packages/qemu/qemu-0.9.1/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.1/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 | # | ||
6 | Index: 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, ¤t_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.1/05_non-fatal_if_linux_hd_missing.patch b/meta/packages/qemu/qemu-0.9.1/05_non-fatal_if_linux_hd_missing.patch new file mode 100644 index 0000000000..fdd922605e --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
6 | Index: 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.1/06_exit_segfault.patch b/meta/packages/qemu/qemu-0.9.1/06_exit_segfault.patch new file mode 100644 index 0000000000..06123d0626 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
6 | Index: 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.1/10_signal_jobs.patch b/meta/packages/qemu/qemu-0.9.1/10_signal_jobs.patch new file mode 100644 index 0000000000..34282adc9d --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
6 | Index: 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.1/11_signal_sigaction.patch b/meta/packages/qemu/qemu-0.9.1/11_signal_sigaction.patch new file mode 100644 index 0000000000..33c5e8b12d --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
6 | Index: 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.1/22_net_tuntap_stall.patch b/meta/packages/qemu/qemu-0.9.1/22_net_tuntap_stall.patch new file mode 100644 index 0000000000..6017df0f6d --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
6 | Index: 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.1/31_syscalls.patch b/meta/packages/qemu/qemu-0.9.1/31_syscalls.patch new file mode 100644 index 0000000000..95a7332ee8 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
6 | Index: 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.1/32_syscall_sysctl.patch b/meta/packages/qemu/qemu-0.9.1/32_syscall_sysctl.patch new file mode 100644 index 0000000000..5e8dd75b0e --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
6 | Index: 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.1/33_syscall_ppc_clone.patch b/meta/packages/qemu/qemu-0.9.1/33_syscall_ppc_clone.patch new file mode 100644 index 0000000000..3f733b6ab8 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
6 | Index: 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.1/39_syscall_fadvise64.patch b/meta/packages/qemu/qemu-0.9.1/39_syscall_fadvise64.patch new file mode 100644 index 0000000000..54ee3e0948 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/39_syscall_fadvise64.patch | |||
@@ -0,0 +1,21 @@ | |||
1 | --- | ||
2 | linux-user/syscall.c | 6 ++++++ | ||
3 | 1 file changed, 6 insertions(+) | ||
4 | |||
5 | Index: 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.1/41_arm_fpa_sigfpe.patch b/meta/packages/qemu/qemu-0.9.1/41_arm_fpa_sigfpe.patch new file mode 100644 index 0000000000..cea3afc7ff --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
7 | Index: 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; | ||
80 | Index: 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.1/52_ne2000_return.patch b/meta/packages/qemu/qemu-0.9.1/52_ne2000_return.patch new file mode 100644 index 0000000000..e4ea33f2c6 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/52_ne2000_return.patch | |||
@@ -0,0 +1,17 @@ | |||
1 | --- | ||
2 | hw/ne2000.c | 2 +- | ||
3 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
4 | |||
5 | Index: 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.1/61_safe_64bit_int.patch b/meta/packages/qemu/qemu-0.9.1/61_safe_64bit_int.patch new file mode 100644 index 0000000000..9b1ace81a5 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
6 | Index: dyngen-exec.h | ||
7 | =================================================================== | ||
8 | --- dyngen-exec.h.orig 2007-12-31 13:06:21.000000000 +0000 | ||
9 | +++ dyngen-exec.h 2007-12-31 13:08:54.000000000 +0000 | ||
10 | @@ -38,7 +38,7 @@ | ||
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__) || defined(__alpha__) | ||
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 @@ | ||
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__) || defined(__alpha__) | ||
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.1/63_sparc_build.patch b/meta/packages/qemu/qemu-0.9.1/63_sparc_build.patch new file mode 100644 index 0000000000..37b38f641b --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
6 | Index: 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.1/64_ppc_asm_constraints.patch b/meta/packages/qemu/qemu-0.9.1/64_ppc_asm_constraints.patch new file mode 100644 index 0000000000..e4858b79d7 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | # | ||
6 | Index: 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.1/65_kfreebsd.patch b/meta/packages/qemu/qemu-0.9.1/65_kfreebsd.patch new file mode 100644 index 0000000000..dfece800ac --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/65_kfreebsd.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | --- | ||
2 | configure | 6 ++++++ | ||
3 | vl.c | 2 ++ | ||
4 | 2 files changed, 8 insertions(+) | ||
5 | |||
6 | Index: 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" | ||
23 | Index: 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.1/66_tls_ld.patch b/meta/packages/qemu/qemu-0.9.1/66_tls_ld.patch new file mode 100644 index 0000000000..54e02eff8b --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/66_tls_ld.patch | |||
@@ -0,0 +1,55 @@ | |||
1 | --- | ||
2 | arm.ld | 7 +++++++ | ||
3 | i386.ld | 7 +++++++ | ||
4 | 2 files changed, 14 insertions(+) | ||
5 | |||
6 | Index: 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)); | ||
31 | Index: 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.1/91-oh-sdl-cursor.patch b/meta/packages/qemu/qemu-0.9.1/91-oh-sdl-cursor.patch new file mode 100644 index 0000000000..0d60c1c306 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | |||
6 | Index: 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.1/disable-error-in-configure.patch b/meta/packages/qemu/qemu-0.9.1/disable-error-in-configure.patch new file mode 100644 index 0000000000..017f9f6355 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/disable-error-in-configure.patch | |||
@@ -0,0 +1,17 @@ | |||
1 | --- | ||
2 | configure | 2 -- | ||
3 | 1 file changed, 2 deletions(-) | ||
4 | |||
5 | Index: 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.1/fix_segfault.patch b/meta/packages/qemu/qemu-0.9.1/fix_segfault.patch new file mode 100644 index 0000000000..443c330650 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/fix_segfault.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | --- | ||
2 | linux-user/syscall.c | 22 ---------------------- | ||
3 | 1 file changed, 22 deletions(-) | ||
4 | |||
5 | Index: 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.1/qemu-0.9.0-nptl-update.patch b/meta/packages/qemu/qemu-0.9.1/qemu-0.9.0-nptl-update.patch new file mode 100644 index 0000000000..ebc996e873 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | |||
6 | Index: 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 | |||
31 | Index: 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.1/qemu-0.9.0-nptl.patch b/meta/packages/qemu/qemu-0.9.1/qemu-0.9.0-nptl.patch new file mode 100644 index 0000000000..10e3cc04a5 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/qemu-0.9.0-nptl.patch | |||
@@ -0,0 +1,929 @@ | |||
1 | These are Paul Brook's patches to QEMU-0.8.2 to enable the running of single | ||
2 | ARM binaries under QEMU's user-emulation mode. Without them, QEMU-0.8.1 | ||
3 | immediately dies saying: | ||
4 | Error: f0005 | ||
5 | qemu: uncaught target signal 6 (Aborted) - exiting | ||
6 | while qemu-0.8.2 dies saying: | ||
7 | qemu: Unsupported syscall: 983045 | ||
8 | cannot set up thread-local storage: unknown error | ||
9 | |||
10 | This file is a rediffing of the patches visible at | ||
11 | https://nowt.dyndns.org/patch.qemu_nptl on 27 Sept 2006 | ||
12 | which "patch" fails to apply automatically. | ||
13 | See 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 | |||
30 | --- qemu.orig/configure | ||
31 | +++ qemu/configure | ||
32 | @@ -103,10 +103,11 @@ check_gcc="yes" | ||
33 | softmmu="yes" | ||
34 | 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 | case $targetos in | ||
43 | CYGWIN*) | ||
44 | @@ -322,10 +323,12 @@ for opt do | ||
45 | ;; | ||
46 | --disable-werror) werror="no" | ||
47 | ;; | ||
48 | *) echo "ERROR: unknown option $opt"; show_help="yes" | ||
49 | ;; | ||
50 | + --disable-nptl) nptl="no" | ||
51 | + ;; | ||
52 | esac | ||
53 | done | ||
54 | |||
55 | if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then | ||
56 | AIOLIBS= | ||
57 | @@ -417,10 +420,11 @@ echo " --enable-system enable | ||
58 | echo " --disable-system disable all system emulation targets" | ||
59 | echo " --enable-linux-user enable all linux usermode emulation targets" | ||
60 | echo " --disable-linux-user disable all linux usermode emulation targets" | ||
61 | echo " --enable-darwin-user enable all darwin usermode emulation targets" | ||
62 | echo " --disable-darwin-user disable all darwin usermode emulation targets" | ||
63 | +echo " --disable-nptl disable usermode NPTL guest support" | ||
64 | echo " --fmod-lib path to FMOD library" | ||
65 | echo " --fmod-inc path to FMOD includes" | ||
66 | echo " --enable-uname-release=R Return R for uname -r in usermode emulation" | ||
67 | echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" | ||
68 | echo "" | ||
69 | @@ -583,10 +587,27 @@ fi | ||
70 | cat > $TMPC <<EOF | ||
71 | int main(void) { | ||
72 | } | ||
73 | EOF | ||
74 | |||
75 | +# check NPTL support | ||
76 | +cat > $TMPC <<EOF | ||
77 | +#include <sched.h> | ||
78 | +void foo() | ||
79 | +{ | ||
80 | +#ifndef CLONE_SETTLS | ||
81 | +#error bork | ||
82 | +#endif | ||
83 | +} | ||
84 | +EOF | ||
85 | + | ||
86 | +if $cc -c -o $TMPO $TMPC 2> /dev/null ; then | ||
87 | + : | ||
88 | +else | ||
89 | + nptl="no" | ||
90 | +fi | ||
91 | + | ||
92 | ########################################## | ||
93 | # SDL probe | ||
94 | |||
95 | sdl_too_old=no | ||
96 | |||
97 | @@ -747,10 +768,11 @@ if test -n "$sparc_cpu"; then | ||
98 | fi | ||
99 | echo "kqemu support $kqemu" | ||
100 | echo "Documentation $build_docs" | ||
101 | [ ! -z "$uname_release" ] && \ | ||
102 | echo "uname -r $uname_release" | ||
103 | +echo "NPTL support $nptl" | ||
104 | |||
105 | if test $sdl_too_old = "yes"; then | ||
106 | echo "-> Your SDL version is too old - please upgrade to have SDL support" | ||
107 | fi | ||
108 | if [ -s /tmp/qemu-$$-sdl-config.log ]; then | ||
109 | @@ -1063,10 +1085,13 @@ if test "$target_cpu" = "i386" ; then | ||
110 | fi | ||
111 | elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then | ||
112 | echo "TARGET_ARCH=arm" >> $config_mak | ||
113 | echo "#define TARGET_ARCH \"arm\"" >> $config_h | ||
114 | echo "#define TARGET_ARM 1" >> $config_h | ||
115 | + if test "$nptl" = "yes" ; then | ||
116 | + echo "#define USE_NPTL 1" >> $config_h | ||
117 | + fi | ||
118 | bflt="yes" | ||
119 | elif test "$target_cpu" = "sparc" ; then | ||
120 | echo "TARGET_ARCH=sparc" >> $config_mak | ||
121 | echo "#define TARGET_ARCH \"sparc\"" >> $config_h | ||
122 | echo "#define TARGET_SPARC 1" >> $config_h | ||
123 | --- qemu.orig/exec-all.h | ||
124 | +++ qemu/exec-all.h | ||
125 | @@ -338,174 +338,11 @@ dummy_label ## n: ;\ | ||
126 | |||
127 | extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4]; | ||
128 | extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4]; | ||
129 | extern void *io_mem_opaque[IO_MEM_NB_ENTRIES]; | ||
130 | |||
131 | -#if defined(__powerpc__) | ||
132 | -static inline int testandset (int *p) | ||
133 | -{ | ||
134 | - int ret; | ||
135 | - __asm__ __volatile__ ( | ||
136 | - "0: lwarx %0,0,%1\n" | ||
137 | - " xor. %0,%3,%0\n" | ||
138 | - " bne 1f\n" | ||
139 | - " stwcx. %2,0,%1\n" | ||
140 | - " bne- 0b\n" | ||
141 | - "1: " | ||
142 | - : "=&r" (ret) | ||
143 | - : "r" (p), "r" (1), "r" (0) | ||
144 | - : "cr0", "memory"); | ||
145 | - return ret; | ||
146 | -} | ||
147 | -#elif defined(__i386__) | ||
148 | -static inline int testandset (int *p) | ||
149 | -{ | ||
150 | - long int readval = 0; | ||
151 | - | ||
152 | - __asm__ __volatile__ ("lock; cmpxchgl %2, %0" | ||
153 | - : "+m" (*p), "+a" (readval) | ||
154 | - : "r" (1) | ||
155 | - : "cc"); | ||
156 | - return readval; | ||
157 | -} | ||
158 | -#elif defined(__x86_64__) | ||
159 | -static inline int testandset (int *p) | ||
160 | -{ | ||
161 | - long int readval = 0; | ||
162 | - | ||
163 | - __asm__ __volatile__ ("lock; cmpxchgl %2, %0" | ||
164 | - : "+m" (*p), "+a" (readval) | ||
165 | - : "r" (1) | ||
166 | - : "cc"); | ||
167 | - return readval; | ||
168 | -} | ||
169 | -#elif defined(__s390__) | ||
170 | -static inline int testandset (int *p) | ||
171 | -{ | ||
172 | - int ret; | ||
173 | - | ||
174 | - __asm__ __volatile__ ("0: cs %0,%1,0(%2)\n" | ||
175 | - " jl 0b" | ||
176 | - : "=&d" (ret) | ||
177 | - : "r" (1), "a" (p), "0" (*p) | ||
178 | - : "cc", "memory" ); | ||
179 | - return ret; | ||
180 | -} | ||
181 | -#elif defined(__alpha__) | ||
182 | -static inline int testandset (int *p) | ||
183 | -{ | ||
184 | - int ret; | ||
185 | - unsigned long one; | ||
186 | - | ||
187 | - __asm__ __volatile__ ("0: mov 1,%2\n" | ||
188 | - " ldl_l %0,%1\n" | ||
189 | - " stl_c %2,%1\n" | ||
190 | - " beq %2,1f\n" | ||
191 | - ".subsection 2\n" | ||
192 | - "1: br 0b\n" | ||
193 | - ".previous" | ||
194 | - : "=r" (ret), "=m" (*p), "=r" (one) | ||
195 | - : "m" (*p)); | ||
196 | - return ret; | ||
197 | -} | ||
198 | -#elif defined(__sparc__) | ||
199 | -static inline int testandset (int *p) | ||
200 | -{ | ||
201 | - int ret; | ||
202 | - | ||
203 | - __asm__ __volatile__("ldstub [%1], %0" | ||
204 | - : "=r" (ret) | ||
205 | - : "r" (p) | ||
206 | - : "memory"); | ||
207 | - | ||
208 | - return (ret ? 1 : 0); | ||
209 | -} | ||
210 | -#elif defined(__arm__) | ||
211 | -static inline int testandset (int *spinlock) | ||
212 | -{ | ||
213 | - register unsigned int ret; | ||
214 | - __asm__ __volatile__("swp %0, %1, [%2]" | ||
215 | - : "=r"(ret) | ||
216 | - : "0"(1), "r"(spinlock)); | ||
217 | - | ||
218 | - return ret; | ||
219 | -} | ||
220 | -#elif defined(__mc68000) | ||
221 | -static inline int testandset (int *p) | ||
222 | -{ | ||
223 | - char ret; | ||
224 | - __asm__ __volatile__("tas %1; sne %0" | ||
225 | - : "=r" (ret) | ||
226 | - : "m" (p) | ||
227 | - : "cc","memory"); | ||
228 | - return ret; | ||
229 | -} | ||
230 | -#elif defined(__ia64) | ||
231 | - | ||
232 | -#include <ia64intrin.h> | ||
233 | - | ||
234 | -static inline int testandset (int *p) | ||
235 | -{ | ||
236 | - return __sync_lock_test_and_set (p, 1); | ||
237 | -} | ||
238 | -#elif defined(__mips__) | ||
239 | -static inline int testandset (int *p) | ||
240 | -{ | ||
241 | - int ret; | ||
242 | - | ||
243 | - __asm__ __volatile__ ( | ||
244 | - " .set push \n" | ||
245 | - " .set noat \n" | ||
246 | - " .set mips2 \n" | ||
247 | - "1: li $1, 1 \n" | ||
248 | - " ll %0, %1 \n" | ||
249 | - " sc $1, %1 \n" | ||
250 | - " beqz $1, 1b \n" | ||
251 | - " .set pop " | ||
252 | - : "=r" (ret), "+R" (*p) | ||
253 | - : | ||
254 | - : "memory"); | ||
255 | - | ||
256 | - return ret; | ||
257 | -} | ||
258 | -#else | ||
259 | -#error unimplemented CPU support | ||
260 | -#endif | ||
261 | - | ||
262 | -typedef int spinlock_t; | ||
263 | - | ||
264 | -#define SPIN_LOCK_UNLOCKED 0 | ||
265 | - | ||
266 | -#if defined(CONFIG_USER_ONLY) | ||
267 | -static inline void spin_lock(spinlock_t *lock) | ||
268 | -{ | ||
269 | - while (testandset(lock)); | ||
270 | -} | ||
271 | - | ||
272 | -static inline void spin_unlock(spinlock_t *lock) | ||
273 | -{ | ||
274 | - *lock = 0; | ||
275 | -} | ||
276 | - | ||
277 | -static inline int spin_trylock(spinlock_t *lock) | ||
278 | -{ | ||
279 | - return !testandset(lock); | ||
280 | -} | ||
281 | -#else | ||
282 | -static inline void spin_lock(spinlock_t *lock) | ||
283 | -{ | ||
284 | -} | ||
285 | - | ||
286 | -static inline void spin_unlock(spinlock_t *lock) | ||
287 | -{ | ||
288 | -} | ||
289 | - | ||
290 | -static inline int spin_trylock(spinlock_t *lock) | ||
291 | -{ | ||
292 | - return 1; | ||
293 | -} | ||
294 | -#endif | ||
295 | +#include "qemu_spinlock.h" | ||
296 | |||
297 | extern spinlock_t tb_lock; | ||
298 | |||
299 | extern int tb_invalidated_flag; | ||
300 | |||
301 | --- qemu.orig/linux-user/arm/syscall.h | ||
302 | +++ qemu/linux-user/arm/syscall.h | ||
303 | @@ -26,11 +26,13 @@ struct target_pt_regs { | ||
304 | #define ARM_ORIG_r0 uregs[17] | ||
305 | |||
306 | #define ARM_SYSCALL_BASE 0x900000 | ||
307 | #define ARM_THUMB_SYSCALL 0 | ||
308 | |||
309 | -#define ARM_NR_cacheflush (ARM_SYSCALL_BASE + 0xf0000 + 2) | ||
310 | +#define ARM_NR_BASE 0xf0000 | ||
311 | +#define ARM_NR_cacheflush (ARM_NR_BASE + 2) | ||
312 | +#define ARM_NR_set_tls (ARM_NR_BASE + 5) | ||
313 | |||
314 | #define ARM_NR_semihosting 0x123456 | ||
315 | #define ARM_NR_thumb_semihosting 0xAB | ||
316 | |||
317 | #if defined(TARGET_WORDS_BIGENDIAN) | ||
318 | --- qemu.orig/linux-user/main.c | ||
319 | +++ qemu/linux-user/main.c | ||
320 | @@ -361,10 +361,54 @@ static void arm_cache_flush(abi_ulong st | ||
321 | break; | ||
322 | addr = last1 + 1; | ||
323 | } | ||
324 | } | ||
325 | |||
326 | +/* Handle a jump to the kernel code page. */ | ||
327 | +static int | ||
328 | +do_kernel_trap(CPUARMState *env) | ||
329 | +{ | ||
330 | + uint32_t addr; | ||
331 | + uint32_t *ptr; | ||
332 | + uint32_t cpsr; | ||
333 | + | ||
334 | + switch (env->regs[15]) { | ||
335 | + case 0xffff0fc0: /* __kernel_cmpxchg */ | ||
336 | + /* XXX: This only works between threads, not between processes. | ||
337 | + Use native atomic operations. */ | ||
338 | + /* ??? This probably breaks horribly if the access segfaults. */ | ||
339 | + cpu_lock(); | ||
340 | + ptr = (uint32_t *)env->regs[2]; | ||
341 | + cpsr = cpsr_read(env); | ||
342 | + if (*ptr == env->regs[0]) { | ||
343 | + *ptr = env->regs[1]; | ||
344 | + env->regs[0] = 0; | ||
345 | + cpsr |= CPSR_C; | ||
346 | + } else { | ||
347 | + env->regs[0] = -1; | ||
348 | + cpsr &= ~CPSR_C; | ||
349 | + } | ||
350 | + cpsr_write(env, cpsr, CPSR_C); | ||
351 | + cpu_unlock(); | ||
352 | + break; | ||
353 | + case 0xffff0fe0: /* __kernel_get_tls */ | ||
354 | + env->regs[0] = env->cp15.c13_tls; | ||
355 | + break; | ||
356 | + default: | ||
357 | + return 1; | ||
358 | + } | ||
359 | + /* Jump back to the caller. */ | ||
360 | + addr = env->regs[14]; | ||
361 | + if (addr & 1) { | ||
362 | + env->thumb = 1; | ||
363 | + addr &= ~1; | ||
364 | + } | ||
365 | + env->regs[15] = addr; | ||
366 | + | ||
367 | + return 0; | ||
368 | +} | ||
369 | + | ||
370 | void cpu_loop(CPUARMState *env) | ||
371 | { | ||
372 | int trapnr; | ||
373 | unsigned int n, insn; | ||
374 | target_siginfo_t info; | ||
375 | @@ -471,32 +515,50 @@ void cpu_loop(CPUARMState *env) | ||
376 | get_user_u32(insn, env->regs[15] - 4); | ||
377 | n = insn & 0xffffff; | ||
378 | } | ||
379 | } | ||
380 | |||
381 | - if (n == ARM_NR_cacheflush) { | ||
382 | - arm_cache_flush(env->regs[0], env->regs[1]); | ||
383 | - } else if (n == ARM_NR_semihosting | ||
384 | - || n == ARM_NR_thumb_semihosting) { | ||
385 | + if (n == ARM_NR_semihosting | ||
386 | + || n == ARM_NR_thumb_semihosting) { | ||
387 | env->regs[0] = do_arm_semihosting (env); | ||
388 | } else if (n == 0 || n >= ARM_SYSCALL_BASE | ||
389 | || (env->thumb && n == ARM_THUMB_SYSCALL)) { | ||
390 | /* linux syscall */ | ||
391 | if (env->thumb || n == 0) { | ||
392 | n = env->regs[7]; | ||
393 | } else { | ||
394 | n -= ARM_SYSCALL_BASE; | ||
395 | env->eabi = 0; | ||
396 | } | ||
397 | - env->regs[0] = do_syscall(env, | ||
398 | - n, | ||
399 | - env->regs[0], | ||
400 | - env->regs[1], | ||
401 | - env->regs[2], | ||
402 | - env->regs[3], | ||
403 | - env->regs[4], | ||
404 | - env->regs[5]); | ||
405 | + if ( n > ARM_NR_BASE) { | ||
406 | + switch (n) | ||
407 | + { | ||
408 | + case ARM_NR_cacheflush: | ||
409 | + arm_cache_flush(env->regs[0], env->regs[1]); | ||
410 | + break; | ||
411 | +#ifdef USE_NPTL | ||
412 | + case ARM_NR_set_tls: | ||
413 | + cpu_set_tls(env, env->regs[0]); | ||
414 | + env->regs[0] = 0; | ||
415 | + break; | ||
416 | +#endif | ||
417 | + default: | ||
418 | + printf ("Error: Bad syscall: %x\n", n); | ||
419 | + goto error; | ||
420 | + } | ||
421 | + } | ||
422 | + else | ||
423 | + { | ||
424 | + env->regs[0] = do_syscall(env, | ||
425 | + n, | ||
426 | + env->regs[0], | ||
427 | + env->regs[1], | ||
428 | + env->regs[2], | ||
429 | + env->regs[3], | ||
430 | + env->regs[4], | ||
431 | + env->regs[5]); | ||
432 | + } | ||
433 | } else { | ||
434 | goto error; | ||
435 | } | ||
436 | } | ||
437 | break; | ||
438 | @@ -531,10 +593,14 @@ void cpu_loop(CPUARMState *env) | ||
439 | info.si_code = TARGET_TRAP_BRKPT; | ||
440 | queue_signal(info.si_signo, &info); | ||
441 | } | ||
442 | } | ||
443 | break; | ||
444 | + case EXCP_KERNEL_TRAP: | ||
445 | + if (do_kernel_trap(env)) | ||
446 | + goto error; | ||
447 | + break; | ||
448 | default: | ||
449 | error: | ||
450 | fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", | ||
451 | trapnr); | ||
452 | cpu_dump_state(env, stderr, fprintf, 0); | ||
453 | @@ -2378,10 +2444,14 @@ int main(int argc, char **argv) | ||
454 | #if defined(TARGET_ARM) || defined(TARGET_M68K) | ||
455 | ts->stack_base = info->start_stack; | ||
456 | ts->heap_base = info->brk; | ||
457 | /* This will be filled in on the first SYS_HEAPINFO call. */ | ||
458 | ts->heap_limit = 0; | ||
459 | + /* Register the magic kernel code page. The cpu will generate a | ||
460 | + special exception when it tries to execute code here. We can't | ||
461 | + put real code here because it may be in use by the host kernel. */ | ||
462 | + page_set_flags(0xffff0000, 0xffff0fff, 0); | ||
463 | #endif | ||
464 | |||
465 | if (gdbstub_port) { | ||
466 | gdbserver_start (gdbstub_port); | ||
467 | gdb_handlesig(env, 0); | ||
468 | --- qemu.orig/linux-user/qemu.h | ||
469 | +++ qemu/linux-user/qemu.h | ||
470 | @@ -100,10 +100,13 @@ typedef struct TaskState { | ||
471 | /* Extra fields for semihosted binaries. */ | ||
472 | uint32_t stack_base; | ||
473 | uint32_t heap_base; | ||
474 | uint32_t heap_limit; | ||
475 | #endif | ||
476 | +#ifdef USE_NPTL | ||
477 | + uint32_t *child_tidptr; | ||
478 | +#endif | ||
479 | int used; /* non zero if used */ | ||
480 | struct image_info *info; | ||
481 | uint8_t stack[0]; | ||
482 | } __attribute__((aligned(16))) TaskState; | ||
483 | |||
484 | --- qemu.orig/linux-user/syscall.c | ||
485 | +++ qemu/linux-user/syscall.c | ||
486 | @@ -69,13 +69,22 @@ | ||
487 | #include <linux/soundcard.h> | ||
488 | #include <linux/dirent.h> | ||
489 | #include <linux/kd.h> | ||
490 | |||
491 | #include "qemu.h" | ||
492 | +#include "qemu_spinlock.h" | ||
493 | |||
494 | //#define DEBUG | ||
495 | |||
496 | +#ifdef USE_NPTL | ||
497 | +#define CLONE_NPTL_FLAGS2 (CLONE_SETTLS | \ | ||
498 | + CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID) | ||
499 | +#else | ||
500 | +/* XXX: Hardcode the above values. */ | ||
501 | +#define CLONE_NPTL_FLAGS2 0 | ||
502 | +#endif | ||
503 | + | ||
504 | #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ | ||
505 | || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) | ||
506 | /* 16 bit uid wrappers emulation */ | ||
507 | #define USE_UID16 | ||
508 | #endif | ||
509 | @@ -2690,27 +2699,46 @@ abi_long do_arch_prctl(CPUX86State *env, | ||
510 | |||
511 | /* this stack is the equivalent of the kernel stack associated with a | ||
512 | thread/process */ | ||
513 | #define NEW_STACK_SIZE 8192 | ||
514 | |||
515 | +#ifdef USE_NPTL | ||
516 | +static spinlock_t nptl_lock = SPIN_LOCK_UNLOCKED; | ||
517 | +#endif | ||
518 | + | ||
519 | static int clone_func(void *arg) | ||
520 | { | ||
521 | CPUState *env = arg; | ||
522 | +#ifdef HAVE_NPTL | ||
523 | + /* Wait until the parent has finshed initializing the tls state. */ | ||
524 | + while (!spin_trylock(&nptl_lock)) | ||
525 | + usleep(1); | ||
526 | + spin_unlock(&nptl_lock); | ||
527 | +#endif | ||
528 | cpu_loop(env); | ||
529 | /* never exits */ | ||
530 | return 0; | ||
531 | } | ||
532 | |||
533 | /* do_fork() Must return host values and target errnos (unlike most | ||
534 | do_*() functions). */ | ||
535 | -int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp) | ||
536 | +int do_fork(CPUState *env, unsigned int flags, unsigned long newsp, | ||
537 | + uint32_t *parent_tidptr, void *newtls, | ||
538 | + uint32_t *child_tidptr) | ||
539 | { | ||
540 | int ret; | ||
541 | TaskState *ts; | ||
542 | uint8_t *new_stack; | ||
543 | CPUState *new_env; | ||
544 | |||
545 | +#ifdef USE_NPTL | ||
546 | + unsigned int nptl_flags; | ||
547 | + | ||
548 | + if (flags & CLONE_PARENT_SETTID) | ||
549 | + *parent_tidptr = gettid(); | ||
550 | +#endif | ||
551 | + | ||
552 | if (flags & CLONE_VM) { | ||
553 | ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE); | ||
554 | memset(ts, 0, sizeof(TaskState)); | ||
555 | new_stack = ts->stack; | ||
556 | ts->used = 1; | ||
557 | @@ -2772,20 +2800,71 @@ int do_fork(CPUState *env, unsigned int | ||
558 | new_env->regs[14] = newsp; | ||
559 | #else | ||
560 | #error unsupported target CPU | ||
561 | #endif | ||
562 | new_env->opaque = ts; | ||
563 | +#ifdef USE_NPTL | ||
564 | + nptl_flags = flags; | ||
565 | + flags &= ~CLONE_NPTL_FLAGS2; | ||
566 | + | ||
567 | + if (nptl_flags & CLONE_CHILD_CLEARTID) { | ||
568 | + ts->child_tidptr = child_tidptr; | ||
569 | + } | ||
570 | + | ||
571 | + if (nptl_flags & CLONE_SETTLS) | ||
572 | + cpu_set_tls (new_env, newtls); | ||
573 | + | ||
574 | + /* Grab the global cpu lock so that the thread setup appears | ||
575 | + atomic. */ | ||
576 | + if (nptl_flags & CLONE_CHILD_SETTID) | ||
577 | + spin_lock(&nptl_lock); | ||
578 | + | ||
579 | +#else | ||
580 | + if (flags & CLONE_NPTL_FLAGS2) | ||
581 | + return -EINVAL; | ||
582 | +#endif | ||
583 | + | ||
584 | + if (CLONE_VFORK & flags) | ||
585 | + flags ^= CLONE_VM; | ||
586 | #ifdef __ia64__ | ||
587 | ret = __clone2(clone_func, new_stack + NEW_STACK_SIZE, flags, new_env); | ||
588 | #else | ||
589 | ret = clone(clone_func, new_stack + NEW_STACK_SIZE, flags, new_env); | ||
590 | #endif | ||
591 | +#ifdef USE_NPTL | ||
592 | + if (ret != -1) { | ||
593 | + if (nptl_flags & CLONE_CHILD_SETTID) | ||
594 | + *child_tidptr = ret; | ||
595 | + } | ||
596 | + | ||
597 | + /* Allow the child to continue. */ | ||
598 | + if (nptl_flags & CLONE_CHILD_SETTID) | ||
599 | + spin_unlock(&nptl_lock); | ||
600 | +#endif | ||
601 | } else { | ||
602 | /* if no CLONE_VM, we consider it is a fork */ | ||
603 | - if ((flags & ~CSIGNAL) != 0) | ||
604 | + if ((flags & ~(CSIGNAL | CLONE_NPTL_FLAGS2)) != 0) | ||
605 | return -EINVAL; | ||
606 | ret = fork(); | ||
607 | +#ifdef USE_NPTL | ||
608 | + /* There is a race condition here. The parent process could | ||
609 | + theoretically read the TID in the child process before the child | ||
610 | + tid is set. This would require using either ptrace | ||
611 | + (not implemented) or having *_tidptr to point at a shared memory | ||
612 | + mapping. We can't repeat the spinlock hack used above because | ||
613 | + the child process gets its own copy of the lock. */ | ||
614 | + if (ret == 0) { | ||
615 | + /* Child Process. */ | ||
616 | + if (flags & CLONE_CHILD_SETTID) | ||
617 | + *child_tidptr = gettid(); | ||
618 | + ts = (TaskState *)env->opaque; | ||
619 | + if (flags & CLONE_CHILD_CLEARTID) | ||
620 | + ts->child_tidptr = child_tidptr; | ||
621 | + if (flags & CLONE_SETTLS) | ||
622 | + cpu_set_tls (env, newtls); | ||
623 | + } | ||
624 | +#endif | ||
625 | } | ||
626 | return ret; | ||
627 | } | ||
628 | |||
629 | static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) | ||
630 | @@ -3106,11 +3185,11 @@ abi_long do_syscall(void *cpu_env, int n | ||
631 | break; | ||
632 | case TARGET_NR_brk: | ||
633 | ret = do_brk(arg1); | ||
634 | break; | ||
635 | case TARGET_NR_fork: | ||
636 | - ret = get_errno(do_fork(cpu_env, SIGCHLD, 0)); | ||
637 | + ret = get_errno(do_fork(cpu_env, SIGCHLD, 0, NULL, NULL, NULL)); | ||
638 | break; | ||
639 | #ifdef TARGET_NR_waitpid | ||
640 | case TARGET_NR_waitpid: | ||
641 | { | ||
642 | int status; | ||
643 | @@ -4463,11 +4542,12 @@ abi_long do_syscall(void *cpu_env, int n | ||
644 | #endif | ||
645 | case TARGET_NR_fsync: | ||
646 | ret = get_errno(fsync(arg1)); | ||
647 | break; | ||
648 | case TARGET_NR_clone: | ||
649 | - ret = get_errno(do_fork(cpu_env, arg1, arg2)); | ||
650 | + ret = get_errno(do_fork(cpu_env, arg1, arg2, (uint32_t *)arg3, | ||
651 | + (void *)arg4, (uint32_t *)arg5)); | ||
652 | break; | ||
653 | #ifdef __NR_exit_group | ||
654 | /* new thread calls */ | ||
655 | case TARGET_NR_exit_group: | ||
656 | gdb_exit(cpu_env, arg1); | ||
657 | @@ -4908,11 +4988,12 @@ abi_long do_syscall(void *cpu_env, int n | ||
658 | case TARGET_NR_putpmsg: | ||
659 | goto unimplemented; | ||
660 | #endif | ||
661 | #ifdef TARGET_NR_vfork | ||
662 | case TARGET_NR_vfork: | ||
663 | - ret = get_errno(do_fork(cpu_env, CLONE_VFORK | CLONE_VM | SIGCHLD, 0)); | ||
664 | + ret = get_errno(do_fork(cpu_env, CLONE_VFORK | CLONE_VM | SIGCHLD, 0, | ||
665 | + NULL, NULL, NULL)); | ||
666 | break; | ||
667 | #endif | ||
668 | #ifdef TARGET_NR_ugetrlimit | ||
669 | case TARGET_NR_ugetrlimit: | ||
670 | { | ||
671 | --- /dev/null | ||
672 | +++ qemu/qemu_spinlock.h | ||
673 | @@ -0,0 +1,181 @@ | ||
674 | +/* | ||
675 | + * Atomic operation helper include | ||
676 | + * | ||
677 | + * Copyright (c) 2005 Fabrice Bellard | ||
678 | + * | ||
679 | + * This library is free software; you can redistribute it and/or | ||
680 | + * modify it under the terms of the GNU Lesser General Public | ||
681 | + * License as published by the Free Software Foundation; either | ||
682 | + * version 2 of the License, or (at your option) any later version. | ||
683 | + * | ||
684 | + * This library is distributed in the hope that it will be useful, | ||
685 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
686 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
687 | + * Lesser General Public License for more details. | ||
688 | + * | ||
689 | + * You should have received a copy of the GNU Lesser General Public | ||
690 | + * License along with this library; if not, write to the Free Software | ||
691 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
692 | + */ | ||
693 | +#ifndef QEMU_SPINLOCK_H | ||
694 | +#define QEMU_SPINLOCK_H | ||
695 | + | ||
696 | +#ifdef __powerpc__ | ||
697 | +static inline int testandset (int *p) | ||
698 | +{ | ||
699 | + int ret; | ||
700 | + __asm__ __volatile__ ( | ||
701 | + "0: lwarx %0,0,%1\n" | ||
702 | + " xor. %0,%3,%0\n" | ||
703 | + " bne 1f\n" | ||
704 | + " stwcx. %2,0,%1\n" | ||
705 | + " bne- 0b\n" | ||
706 | + "1: " | ||
707 | + : "=&r" (ret) | ||
708 | + : "r" (p), "r" (1), "r" (0) | ||
709 | + : "cr0", "memory"); | ||
710 | + return ret; | ||
711 | +} | ||
712 | +#endif | ||
713 | + | ||
714 | +#ifdef __i386__ | ||
715 | +static inline int testandset (int *p) | ||
716 | +{ | ||
717 | + long int readval = 0; | ||
718 | + | ||
719 | + __asm__ __volatile__ ("lock; cmpxchgl %2, %0" | ||
720 | + : "+m" (*p), "+a" (readval) | ||
721 | + : "r" (1) | ||
722 | + : "cc"); | ||
723 | + return readval; | ||
724 | +} | ||
725 | +#endif | ||
726 | + | ||
727 | +#ifdef __x86_64__ | ||
728 | +static inline int testandset (int *p) | ||
729 | +{ | ||
730 | + long int readval = 0; | ||
731 | + | ||
732 | + __asm__ __volatile__ ("lock; cmpxchgl %2, %0" | ||
733 | + : "+m" (*p), "+a" (readval) | ||
734 | + : "r" (1) | ||
735 | + : "cc"); | ||
736 | + return readval; | ||
737 | +} | ||
738 | +#endif | ||
739 | + | ||
740 | +#ifdef __s390__ | ||
741 | +static inline int testandset (int *p) | ||
742 | +{ | ||
743 | + int ret; | ||
744 | + | ||
745 | + __asm__ __volatile__ ("0: cs %0,%1,0(%2)\n" | ||
746 | + " jl 0b" | ||
747 | + : "=&d" (ret) | ||
748 | + : "r" (1), "a" (p), "0" (*p) | ||
749 | + : "cc", "memory" ); | ||
750 | + return ret; | ||
751 | +} | ||
752 | +#endif | ||
753 | + | ||
754 | +#ifdef __alpha__ | ||
755 | +static inline int testandset (int *p) | ||
756 | +{ | ||
757 | + int ret; | ||
758 | + unsigned long one; | ||
759 | + | ||
760 | + __asm__ __volatile__ ("0: mov 1,%2\n" | ||
761 | + " ldl_l %0,%1\n" | ||
762 | + " stl_c %2,%1\n" | ||
763 | + " beq %2,1f\n" | ||
764 | + ".subsection 2\n" | ||
765 | + "1: br 0b\n" | ||
766 | + ".previous" | ||
767 | + : "=r" (ret), "=m" (*p), "=r" (one) | ||
768 | + : "m" (*p)); | ||
769 | + return ret; | ||
770 | +} | ||
771 | +#endif | ||
772 | + | ||
773 | +#ifdef __sparc__ | ||
774 | +static inline int testandset (int *p) | ||
775 | +{ | ||
776 | + int ret; | ||
777 | + | ||
778 | + __asm__ __volatile__("ldstub [%1], %0" | ||
779 | + : "=r" (ret) | ||
780 | + : "r" (p) | ||
781 | + : "memory"); | ||
782 | + | ||
783 | + return (ret ? 1 : 0); | ||
784 | +} | ||
785 | +#endif | ||
786 | + | ||
787 | +#ifdef __arm__ | ||
788 | +static inline int testandset (int *spinlock) | ||
789 | +{ | ||
790 | + register unsigned int ret; | ||
791 | + __asm__ __volatile__("swp %0, %1, [%2]" | ||
792 | + : "=r"(ret) | ||
793 | + : "0"(1), "r"(spinlock)); | ||
794 | + | ||
795 | + return ret; | ||
796 | +} | ||
797 | +#endif | ||
798 | + | ||
799 | +#ifdef __mc68000 | ||
800 | +static inline int testandset (int *p) | ||
801 | +{ | ||
802 | + char ret; | ||
803 | + __asm__ __volatile__("tas %1; sne %0" | ||
804 | + : "=r" (ret) | ||
805 | + : "m" (p) | ||
806 | + : "cc","memory"); | ||
807 | + return ret; | ||
808 | +} | ||
809 | +#endif | ||
810 | + | ||
811 | +#ifdef __ia64 | ||
812 | +#include <ia64intrin.h> | ||
813 | + | ||
814 | +static inline int testandset (int *p) | ||
815 | +{ | ||
816 | + return __sync_lock_test_and_set (p, 1); | ||
817 | +} | ||
818 | +#endif | ||
819 | + | ||
820 | +typedef int spinlock_t; | ||
821 | + | ||
822 | +#define SPIN_LOCK_UNLOCKED 0 | ||
823 | + | ||
824 | +#if defined(CONFIG_USER_ONLY) | ||
825 | +static inline void spin_lock(spinlock_t *lock) | ||
826 | +{ | ||
827 | + while (testandset(lock)); | ||
828 | +} | ||
829 | + | ||
830 | +static inline void spin_unlock(spinlock_t *lock) | ||
831 | +{ | ||
832 | + *lock = 0; | ||
833 | +} | ||
834 | + | ||
835 | +static inline int spin_trylock(spinlock_t *lock) | ||
836 | +{ | ||
837 | + return !testandset(lock); | ||
838 | +} | ||
839 | +#else | ||
840 | +static inline void spin_lock(spinlock_t *lock) | ||
841 | +{ | ||
842 | +} | ||
843 | + | ||
844 | +static inline void spin_unlock(spinlock_t *lock) | ||
845 | +{ | ||
846 | +} | ||
847 | + | ||
848 | +static inline int spin_trylock(spinlock_t *lock) | ||
849 | +{ | ||
850 | + return 1; | ||
851 | +} | ||
852 | +#endif | ||
853 | + | ||
854 | +#endif | ||
855 | --- qemu.orig/target-arm/cpu.h | ||
856 | +++ qemu/target-arm/cpu.h | ||
857 | @@ -36,10 +36,11 @@ | ||
858 | #define EXCP_DATA_ABORT 4 | ||
859 | #define EXCP_IRQ 5 | ||
860 | #define EXCP_FIQ 6 | ||
861 | #define EXCP_BKPT 7 | ||
862 | #define EXCP_EXCEPTION_EXIT 8 /* Return from v7M exception. */ | ||
863 | +#define EXCP_KERNEL_TRAP 9 /* Jumped to kernel code page. */ | ||
864 | |||
865 | #define ARMV7M_EXCP_RESET 1 | ||
866 | #define ARMV7M_EXCP_NMI 2 | ||
867 | #define ARMV7M_EXCP_HARD 3 | ||
868 | #define ARMV7M_EXCP_MEM 4 | ||
869 | @@ -220,10 +221,19 @@ int cpu_arm_signal_handler(int host_sign | ||
870 | void *puc); | ||
871 | |||
872 | void cpu_lock(void); | ||
873 | void cpu_unlock(void); | ||
874 | |||
875 | +void cpu_lock(void); | ||
876 | +void cpu_unlock(void); | ||
877 | +#if defined(USE_NPTL) | ||
878 | +static inline void cpu_set_tls(CPUARMState *env, void *newtls) | ||
879 | +{ | ||
880 | + env->cp15.c13_tls2 = (uint32_t)(long)newtls; | ||
881 | +} | ||
882 | +#endif | ||
883 | + | ||
884 | #define CPSR_M (0x1f) | ||
885 | #define CPSR_T (1 << 5) | ||
886 | #define CPSR_F (1 << 6) | ||
887 | #define CPSR_I (1 << 7) | ||
888 | #define CPSR_A (1 << 8) | ||
889 | --- qemu.orig/target-arm/op.c | ||
890 | +++ qemu/target-arm/op.c | ||
891 | @@ -1007,10 +1007,16 @@ void OPPROTO op_exception_exit(void) | ||
892 | { | ||
893 | env->exception_index = EXCP_EXCEPTION_EXIT; | ||
894 | cpu_loop_exit(); | ||
895 | } | ||
896 | |||
897 | +void OPPROTO op_kernel_trap(void) | ||
898 | +{ | ||
899 | + env->exception_index = EXCP_KERNEL_TRAP; | ||
900 | + cpu_loop_exit(); | ||
901 | +} | ||
902 | + | ||
903 | /* VFP support. We follow the convention used for VFP instrunctions: | ||
904 | Single precition routines have a "s" suffix, double precision a | ||
905 | "d" suffix. */ | ||
906 | |||
907 | #define VFP_OP(name, p) void OPPROTO op_vfp_##name##p(void) | ||
908 | --- qemu.orig/target-arm/translate.c | ||
909 | +++ qemu/target-arm/translate.c | ||
910 | @@ -7518,11 +7518,18 @@ static inline int gen_intermediate_code_ | ||
911 | /* We always get here via a jump, so know we are not in a | ||
912 | conditional execution block. */ | ||
913 | gen_op_exception_exit(); | ||
914 | } | ||
915 | #endif | ||
916 | - | ||
917 | +#ifdef CONFIG_USER_ONLY | ||
918 | + /* Intercept jump to the magic kernel page. */ | ||
919 | + if (dc->pc > 0xffff0000) { | ||
920 | + gen_op_kernel_trap(); | ||
921 | + dc->is_jmp = DISAS_UPDATE; | ||
922 | + break; | ||
923 | + } | ||
924 | +#endif | ||
925 | if (env->nb_breakpoints > 0) { | ||
926 | for(j = 0; j < env->nb_breakpoints; j++) { | ||
927 | if (env->breakpoints[j] == dc->pc) { | ||
928 | gen_set_condexec(dc); | ||
929 | gen_op_movl_T0_im((long)dc->pc); | ||
diff --git a/meta/packages/qemu/qemu-0.9.1/qemu-amd64-32b-mapping-0.9.0.patch b/meta/packages/qemu/qemu-0.9.1/qemu-amd64-32b-mapping-0.9.0.patch new file mode 100644 index 0000000000..c7f36d8110 --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | |||
5 | Index: 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.1/workaround_bad_futex_headers.patch b/meta/packages/qemu/qemu-0.9.1/workaround_bad_futex_headers.patch new file mode 100644 index 0000000000..cc122ebdba --- /dev/null +++ b/meta/packages/qemu/qemu-0.9.1/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 | |||
5 | Index: 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> | ||