diff options
| author | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-05 15:56:31 +0000 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-05 15:56:31 +0000 |
| commit | 55be33fd92859684db70a605c33b2c99a2c1a0f3 (patch) | |
| tree | 45d9b9fa480d28571cb2780a1fe88b7b0f43e3d2 /meta/packages/qemu/qemu-0.9.1+svn | |
| parent | 5273e39edfeef73d0866276b447160cd7b1e9ecc (diff) | |
| download | poky-55be33fd92859684db70a605c33b2c99a2c1a0f3.tar.gz | |
qemu: Upgrade to latest svn removing a ton of merged patches (yay)
Diffstat (limited to 'meta/packages/qemu/qemu-0.9.1+svn')
28 files changed, 0 insertions, 4213 deletions
diff --git a/meta/packages/qemu/qemu-0.9.1+svn/05_non-fatal_if_linux_hd_missing.patch b/meta/packages/qemu/qemu-0.9.1+svn/05_non-fatal_if_linux_hd_missing.patch deleted file mode 100644 index a66737d9ce..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/05_non-fatal_if_linux_hd_missing.patch +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | #DPATCHLEVEL=1 | ||
| 2 | --- | ||
| 3 | # hw/pc.c | 1 - | ||
| 4 | # 1 file changed, 1 deletion(-) | ||
| 5 | # | ||
| 6 | Index: trunk/hw/pc.c | ||
| 7 | =================================================================== | ||
| 8 | --- trunk.orig/hw/pc.c 2008-04-24 20:15:46.000000000 +0100 | ||
| 9 | +++ trunk/hw/pc.c 2008-04-24 20:15:49.000000000 +0100 | ||
| 10 | @@ -399,7 +399,6 @@ | ||
| 11 | if (hda == -1) { | ||
| 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+svn/06_exit_segfault.patch b/meta/packages/qemu/qemu-0.9.1+svn/06_exit_segfault.patch deleted file mode 100644 index bc02d31839..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/06_exit_segfault.patch +++ /dev/null | |||
| @@ -1,45 +0,0 @@ | |||
| 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 2008-04-24 20:15:46.000000000 +0100 | ||
| 9 | +++ linux-user/main.c 2008-04-24 20:15:53.000000000 +0100 | ||
| 10 | @@ -765,7 +765,7 @@ | ||
| 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 | @@ -1697,7 +1697,7 @@ | ||
| 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 | @@ -2026,7 +2026,7 @@ | ||
| 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 | @@ -2045,7 +2045,7 @@ | ||
| 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+svn/10_signal_jobs.patch b/meta/packages/qemu/qemu-0.9.1+svn/10_signal_jobs.patch deleted file mode 100644 index d79482d2f4..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/10_signal_jobs.patch +++ /dev/null | |||
| @@ -1,26 +0,0 @@ | |||
| 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 2008-04-24 20:15:46.000000000 +0100 | ||
| 9 | +++ linux-user/signal.c 2008-04-24 20:15:55.000000000 +0100 | ||
| 10 | @@ -364,10 +364,15 @@ | ||
| 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+svn/11_signal_sigaction.patch b/meta/packages/qemu/qemu-0.9.1+svn/11_signal_sigaction.patch deleted file mode 100644 index cd56541b71..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/11_signal_sigaction.patch +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 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 2008-04-24 20:15:55.000000000 +0100 | ||
| 9 | +++ linux-user/signal.c 2008-04-24 20:15:57.000000000 +0100 | ||
| 10 | @@ -512,6 +512,11 @@ | ||
| 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+svn/22_net_tuntap_stall.patch b/meta/packages/qemu/qemu-0.9.1+svn/22_net_tuntap_stall.patch deleted file mode 100644 index 0e1038983b..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/22_net_tuntap_stall.patch +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 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 2008-04-24 20:15:46.000000000 +0100 | ||
| 9 | +++ vl.c 2008-04-24 20:15:58.000000000 +0100 | ||
| 10 | @@ -4155,7 +4155,7 @@ | ||
| 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+svn/31_syscalls.patch b/meta/packages/qemu/qemu-0.9.1+svn/31_syscalls.patch deleted file mode 100644 index 15565ae11d..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/31_syscalls.patch +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 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 2008-04-24 20:15:46.000000000 +0100 | ||
| 9 | +++ linux-user/syscall.c 2008-04-24 20:15:59.000000000 +0100 | ||
| 10 | @@ -250,6 +250,7 @@ | ||
| 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 | @@ -4041,7 +4042,8 @@ | ||
| 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 | @@ -5322,7 +5324,9 @@ | ||
| 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 | @@ -5462,7 +5466,8 @@ | ||
| 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+svn/32_syscall_sysctl.patch b/meta/packages/qemu/qemu-0.9.1+svn/32_syscall_sysctl.patch deleted file mode 100644 index d42c44cebc..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/32_syscall_sysctl.patch +++ /dev/null | |||
| @@ -1,55 +0,0 @@ | |||
| 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 2008-04-24 20:15:59.000000000 +0100 | ||
| 9 | +++ linux-user/syscall.c 2008-04-24 20:16:01.000000000 +0100 | ||
| 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 | @@ -4758,9 +4759,34 @@ | ||
| 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+svn/33_syscall_ppc_clone.patch b/meta/packages/qemu/qemu-0.9.1+svn/33_syscall_ppc_clone.patch deleted file mode 100644 index 962f821523..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/33_syscall_ppc_clone.patch +++ /dev/null | |||
| @@ -1,22 +0,0 @@ | |||
| 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 2008-04-24 20:16:01.000000000 +0100 | ||
| 9 | +++ linux-user/syscall.c 2008-04-24 20:16:02.000000000 +0100 | ||
| 10 | @@ -2760,11 +2760,7 @@ | ||
| 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+svn/39_syscall_fadvise64.patch b/meta/packages/qemu/qemu-0.9.1+svn/39_syscall_fadvise64.patch deleted file mode 100644 index 845232cfca..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/39_syscall_fadvise64.patch +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 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 2008-04-24 20:16:02.000000000 +0100 | ||
| 8 | +++ linux-user/syscall.c 2008-04-24 20:16:03.000000000 +0100 | ||
| 9 | @@ -5350,6 +5350,12 @@ | ||
| 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+svn/52_ne2000_return.patch b/meta/packages/qemu/qemu-0.9.1+svn/52_ne2000_return.patch deleted file mode 100644 index e364bff731..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/52_ne2000_return.patch +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 1 | --- | ||
| 2 | hw/ne2000.c | 2 +- | ||
| 3 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 4 | |||
| 5 | Index: trunk/hw/ne2000.c | ||
| 6 | =================================================================== | ||
| 7 | --- trunk.orig/hw/ne2000.c 2008-04-24 20:15:46.000000000 +0100 | ||
| 8 | +++ trunk/hw/ne2000.c 2008-04-24 20:16:05.000000000 +0100 | ||
| 9 | @@ -217,7 +217,7 @@ | ||
| 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+svn/61_safe_64bit_int.patch b/meta/packages/qemu/qemu-0.9.1+svn/61_safe_64bit_int.patch deleted file mode 100644 index 9a67feac6b..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/61_safe_64bit_int.patch +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 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 2008-04-24 20:15:46.000000000 +0100 | ||
| 9 | +++ dyngen-exec.h 2008-04-24 20:16:06.000000000 +0100 | ||
| 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+svn/63_sparc_build.patch b/meta/packages/qemu/qemu-0.9.1+svn/63_sparc_build.patch deleted file mode 100644 index 097f55a09e..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/63_sparc_build.patch +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 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 2008-04-24 20:15:46.000000000 +0100 | ||
| 9 | +++ sparc.ld 2008-04-24 20:16:07.000000000 +0100 | ||
| 10 | @@ -6,7 +6,7 @@ | ||
| 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+svn/64_ppc_asm_constraints.patch b/meta/packages/qemu/qemu-0.9.1+svn/64_ppc_asm_constraints.patch deleted file mode 100644 index 7d19817278..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/64_ppc_asm_constraints.patch +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 1 | #DPATCHLEVEL=1 | ||
| 2 | --- | ||
| 3 | # cpu-all.h | 2 +- | ||
| 4 | # 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 5 | # | ||
| 6 | Index: trunk/cpu-all.h | ||
| 7 | =================================================================== | ||
| 8 | --- trunk.orig/cpu-all.h 2008-04-24 20:15:46.000000000 +0100 | ||
| 9 | +++ trunk/cpu-all.h 2008-04-24 20:16:08.000000000 +0100 | ||
| 10 | @@ -285,7 +285,7 @@ | ||
| 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+svn/65_kfreebsd.patch b/meta/packages/qemu/qemu-0.9.1+svn/65_kfreebsd.patch deleted file mode 100644 index 028e85a878..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/65_kfreebsd.patch +++ /dev/null | |||
| @@ -1,35 +0,0 @@ | |||
| 1 | --- | ||
| 2 | configure | 6 ++++++ | ||
| 3 | vl.c | 2 ++ | ||
| 4 | 2 files changed, 8 insertions(+) | ||
| 5 | |||
| 6 | Index: configure | ||
| 7 | =================================================================== | ||
| 8 | --- configure.orig 2008-04-24 20:15:46.000000000 +0100 | ||
| 9 | +++ configure 2008-04-24 20:16:09.000000000 +0100 | ||
| 10 | @@ -135,6 +135,12 @@ | ||
| 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 2008-04-24 20:15:58.000000000 +0100 | ||
| 26 | +++ vl.c 2008-04-24 20:16:09.000000000 +0100 | ||
| 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+svn/66_tls_ld.patch b/meta/packages/qemu/qemu-0.9.1+svn/66_tls_ld.patch deleted file mode 100644 index cbd3f873d8..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/66_tls_ld.patch +++ /dev/null | |||
| @@ -1,55 +0,0 @@ | |||
| 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 2008-04-24 20:15:45.000000000 +0100 | ||
| 9 | +++ arm.ld 2008-04-24 20:16:11.000000000 +0100 | ||
| 10 | @@ -26,6 +26,10 @@ | ||
| 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 @@ | ||
| 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 2008-04-24 20:15:45.000000000 +0100 | ||
| 34 | +++ i386.ld 2008-04-24 20:16:11.000000000 +0100 | ||
| 35 | @@ -28,6 +28,10 @@ | ||
| 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 @@ | ||
| 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+svn/91-oh-sdl-cursor.patch b/meta/packages/qemu/qemu-0.9.1+svn/91-oh-sdl-cursor.patch deleted file mode 100644 index b3d95a4534..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/91-oh-sdl-cursor.patch +++ /dev/null | |||
| @@ -1,18 +0,0 @@ | |||
| 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 2008-04-24 20:15:45.000000000 +0100 | ||
| 9 | +++ sdl.c 2008-04-24 20:16:12.000000000 +0100 | ||
| 10 | @@ -247,7 +247,7 @@ | ||
| 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+svn/configure_symlinkpath_fix.patch b/meta/packages/qemu/qemu-0.9.1+svn/configure_symlinkpath_fix.patch deleted file mode 100644 index 3ec304a38c..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/configure_symlinkpath_fix.patch +++ /dev/null | |||
| @@ -1,28 +0,0 @@ | |||
| 1 | Index: qemu-0.9.1/configure | ||
| 2 | =================================================================== | ||
| 3 | --- qemu-0.9.1.orig/configure 2008-01-24 15:33:13.000000000 +0000 | ||
| 4 | +++ qemu-0.9.1/configure 2008-01-24 15:45:50.000000000 +0000 | ||
| 5 | @@ -209,15 +209,17 @@ | ||
| 6 | |||
| 7 | # find source path | ||
| 8 | source_path=`dirname "$0"` | ||
| 9 | +source_path_used="no" | ||
| 10 | +workdir=`pwd` | ||
| 11 | +workdir=`readlink -f $workdir` | ||
| 12 | if [ -z "$source_path" ]; then | ||
| 13 | - source_path=`pwd` | ||
| 14 | + source_path=$workdir | ||
| 15 | else | ||
| 16 | source_path=`cd "$source_path"; pwd` | ||
| 17 | -fi | ||
| 18 | -if test "$source_path" = `pwd` ; then | ||
| 19 | - source_path_used="no" | ||
| 20 | -else | ||
| 21 | - source_path_used="yes" | ||
| 22 | + source_path=`readlink -f $source_path` | ||
| 23 | + if test "$source_path" != "$workdir" ; then | ||
| 24 | + source_path_used="yes" | ||
| 25 | + fi | ||
| 26 | fi | ||
| 27 | |||
| 28 | werror="no" | ||
diff --git a/meta/packages/qemu/qemu-0.9.1+svn/fix-dirent.patch b/meta/packages/qemu/qemu-0.9.1+svn/fix-dirent.patch deleted file mode 100644 index 9282ac4779..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/fix-dirent.patch +++ /dev/null | |||
| @@ -1,20 +0,0 @@ | |||
| 1 | Index: trunk/linux-user/syscall.c | ||
| 2 | =================================================================== | ||
| 3 | --- trunk.orig/linux-user/syscall.c 2008-11-10 10:58:07.000000000 +0000 | ||
| 4 | +++ trunk/linux-user/syscall.c 2008-11-10 11:00:37.000000000 +0000 | ||
| 5 | @@ -26,6 +26,7 @@ | ||
| 6 | #include <errno.h> | ||
| 7 | #include <unistd.h> | ||
| 8 | #include <fcntl.h> | ||
| 9 | +#include <dirent.h> | ||
| 10 | #include <time.h> | ||
| 11 | #include <sys/types.h> | ||
| 12 | #include <sys/ipc.h> | ||
| 13 | @@ -76,7 +77,6 @@ | ||
| 14 | #include <linux/cdrom.h> | ||
| 15 | #include <linux/hdreg.h> | ||
| 16 | #include <linux/soundcard.h> | ||
| 17 | -#include <linux/dirent.h> | ||
| 18 | #include <linux/kd.h> | ||
| 19 | |||
| 20 | #include "qemu.h" | ||
diff --git a/meta/packages/qemu/qemu-0.9.1+svn/fix_brk.patch b/meta/packages/qemu/qemu-0.9.1+svn/fix_brk.patch deleted file mode 100644 index f15e001dd6..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/fix_brk.patch +++ /dev/null | |||
| @@ -1,59 +0,0 @@ | |||
| 1 | Index: trunk/linux-user/syscall.c | ||
| 2 | =================================================================== | ||
| 3 | --- trunk.orig/linux-user/syscall.c 2008-04-24 20:16:24.000000000 +0100 | ||
| 4 | +++ trunk/linux-user/syscall.c 2008-04-24 20:16:32.000000000 +0100 | ||
| 5 | @@ -440,7 +440,7 @@ | ||
| 6 | if (!new_brk) | ||
| 7 | return target_brk; | ||
| 8 | if (new_brk < target_original_brk) | ||
| 9 | - return -TARGET_ENOMEM; | ||
| 10 | + return target_brk; | ||
| 11 | |||
| 12 | brk_page = HOST_PAGE_ALIGN(target_brk); | ||
| 13 | |||
| 14 | @@ -455,12 +455,11 @@ | ||
| 15 | mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size, | ||
| 16 | PROT_READ|PROT_WRITE, | ||
| 17 | MAP_ANON|MAP_FIXED|MAP_PRIVATE, 0, 0)); | ||
| 18 | - if (is_error(mapped_addr)) { | ||
| 19 | - return mapped_addr; | ||
| 20 | - } else { | ||
| 21 | + | ||
| 22 | + if (!is_error(mapped_addr)) | ||
| 23 | target_brk = new_brk; | ||
| 24 | - return target_brk; | ||
| 25 | - } | ||
| 26 | + | ||
| 27 | + return target_brk; | ||
| 28 | } | ||
| 29 | |||
| 30 | static inline abi_long copy_from_user_fdset(fd_set *fds, | ||
| 31 | Index: trunk/linux-user/mmap.c | ||
| 32 | =================================================================== | ||
| 33 | --- trunk.orig/linux-user/mmap.c 2008-04-24 20:16:16.000000000 +0100 | ||
| 34 | +++ trunk/linux-user/mmap.c 2008-04-24 20:16:32.000000000 +0100 | ||
| 35 | @@ -264,6 +264,9 @@ | ||
| 36 | host_start += offset - host_offset; | ||
| 37 | start = h2g(host_start); | ||
| 38 | } else { | ||
| 39 | + int flg; | ||
| 40 | + target_ulong addr; | ||
| 41 | + | ||
| 42 | if (start & ~TARGET_PAGE_MASK) { | ||
| 43 | errno = EINVAL; | ||
| 44 | return -1; | ||
| 45 | @@ -271,6 +274,14 @@ | ||
| 46 | end = start + len; | ||
| 47 | real_end = HOST_PAGE_ALIGN(end); | ||
| 48 | |||
| 49 | + for(addr = real_start; addr < real_end; addr += TARGET_PAGE_SIZE) { | ||
| 50 | + flg = page_get_flags(addr); | ||
| 51 | + if( flg & PAGE_RESERVED ) { | ||
| 52 | + errno = ENXIO; | ||
| 53 | + return -1; | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | /* worst case: we cannot map the file because the offset is not | ||
| 58 | aligned, so we read it */ | ||
| 59 | if (!(flags & MAP_ANONYMOUS) && | ||
diff --git a/meta/packages/qemu/qemu-0.9.1+svn/fix_protection_bits.patch b/meta/packages/qemu/qemu-0.9.1+svn/fix_protection_bits.patch deleted file mode 100644 index ee2b077602..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/fix_protection_bits.patch +++ /dev/null | |||
| @@ -1,14 +0,0 @@ | |||
| 1 | Index: qemu-0.9.1/linux-user/mmap.c | ||
| 2 | =================================================================== | ||
| 3 | --- qemu-0.9.1.orig/linux-user/mmap.c 2008-04-16 14:10:26.000000000 +0100 | ||
| 4 | +++ qemu-0.9.1/linux-user/mmap.c 2008-04-16 14:10:51.000000000 +0100 | ||
| 5 | @@ -49,8 +49,7 @@ | ||
| 6 | end = start + len; | ||
| 7 | if (end < start) | ||
| 8 | return -EINVAL; | ||
| 9 | - if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC)) | ||
| 10 | - return -EINVAL; | ||
| 11 | + prot = prot & (PROT_READ | PROT_WRITE | PROT_EXEC); | ||
| 12 | if (len == 0) | ||
| 13 | return 0; | ||
| 14 | |||
diff --git a/meta/packages/qemu/qemu-0.9.1+svn/fix_segfault.patch b/meta/packages/qemu/qemu-0.9.1+svn/fix_segfault.patch deleted file mode 100644 index 224a8b813d..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/fix_segfault.patch +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | --- | ||
| 2 | linux-user/syscall.c | 22 ---------------------- | ||
| 3 | 1 file changed, 22 deletions(-) | ||
| 4 | |||
| 5 | Index: trunk/linux-user/syscall.c | ||
| 6 | =================================================================== | ||
| 7 | --- trunk.orig/linux-user/syscall.c 2008-04-24 20:16:21.000000000 +0100 | ||
| 8 | +++ trunk/linux-user/syscall.c 2008-04-24 20:16:24.000000000 +0100 | ||
| 9 | @@ -5728,28 +5728,6 @@ | ||
| 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+svn/no-strip.patch b/meta/packages/qemu/qemu-0.9.1+svn/no-strip.patch deleted file mode 100644 index 4813dd4e2b..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/no-strip.patch +++ /dev/null | |||
| @@ -1,26 +0,0 @@ | |||
| 1 | Index: trunk/Makefile | ||
| 2 | =================================================================== | ||
| 3 | --- trunk.orig/Makefile 2008-04-24 20:15:37.000000000 +0100 | ||
| 4 | +++ trunk/Makefile 2008-04-24 20:16:30.000000000 +0100 | ||
| 5 | @@ -196,7 +196,7 @@ | ||
| 6 | install: all $(if $(BUILD_DOCS),install-doc) | ||
| 7 | mkdir -p "$(DESTDIR)$(bindir)" | ||
| 8 | ifneq ($(TOOLS),) | ||
| 9 | - $(INSTALL) -m 755 -s $(TOOLS) "$(DESTDIR)$(bindir)" | ||
| 10 | + $(INSTALL) -m 755 $(TOOLS) "$(DESTDIR)$(bindir)" | ||
| 11 | endif | ||
| 12 | mkdir -p "$(DESTDIR)$(datadir)" | ||
| 13 | set -e; for x in bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \ | ||
| 14 | Index: trunk/Makefile.target | ||
| 15 | =================================================================== | ||
| 16 | --- trunk.orig/Makefile.target 2008-04-24 20:15:37.000000000 +0100 | ||
| 17 | +++ trunk/Makefile.target 2008-04-24 20:16:30.000000000 +0100 | ||
| 18 | @@ -685,7 +685,7 @@ | ||
| 19 | |||
| 20 | install: all | ||
| 21 | ifneq ($(PROGS),) | ||
| 22 | - $(INSTALL) -m 755 -s $(PROGS) "$(DESTDIR)$(bindir)" | ||
| 23 | + $(INSTALL) -m 755 $(PROGS) "$(DESTDIR)$(bindir)" | ||
| 24 | endif | ||
| 25 | |||
| 26 | # Include automatically generated dependency files | ||
diff --git a/meta/packages/qemu/qemu-0.9.1+svn/qemu-0.9.0-nptl.patch b/meta/packages/qemu/qemu-0.9.1+svn/qemu-0.9.0-nptl.patch deleted file mode 100644 index ac68ebf460..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/qemu-0.9.0-nptl.patch +++ /dev/null | |||
| @@ -1,1100 +0,0 @@ | |||
| 1 | --- | ||
| 2 | configure | 25 ++++++ | ||
| 3 | exec-all.h | 165 ------------------------------------------ | ||
| 4 | linux-user/arm/syscall.h | 4 - | ||
| 5 | linux-user/main.c | 94 +++++++++++++++++++++--- | ||
| 6 | linux-user/qemu.h | 3 | ||
| 7 | linux-user/syscall.c | 91 ++++++++++++++++++++++- | ||
| 8 | qemu_spinlock.h | 181 +++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 9 | target-arm/cpu.h | 10 ++ | ||
| 10 | target-arm/op.c | 6 + | ||
| 11 | target-arm/translate.c | 9 ++ | ||
| 12 | 10 files changed, 405 insertions(+), 183 deletions(-) | ||
| 13 | |||
| 14 | Index: trunk/configure | ||
| 15 | =================================================================== | ||
| 16 | --- trunk.orig/configure 2008-04-24 20:16:52.000000000 +0100 | ||
| 17 | +++ trunk/configure 2008-04-24 20:16:53.000000000 +0100 | ||
| 18 | @@ -112,6 +112,7 @@ | ||
| 19 | build_docs="no" | ||
| 20 | uname_release="" | ||
| 21 | curses="yes" | ||
| 22 | +nptl="yes" | ||
| 23 | |||
| 24 | # OS specific | ||
| 25 | targetos=`uname -s` | ||
| 26 | @@ -339,6 +340,8 @@ | ||
| 27 | ;; | ||
| 28 | *) echo "ERROR: unknown option $opt"; show_help="yes" | ||
| 29 | ;; | ||
| 30 | + --disable-nptl) nptl="no" | ||
| 31 | + ;; | ||
| 32 | esac | ||
| 33 | done | ||
| 34 | |||
| 35 | @@ -436,6 +439,7 @@ | ||
| 36 | echo " --disable-linux-user disable all linux usermode emulation targets" | ||
| 37 | echo " --enable-darwin-user enable all darwin usermode emulation targets" | ||
| 38 | echo " --disable-darwin-user disable all darwin usermode emulation targets" | ||
| 39 | +echo " --disable-nptl disable usermode NPTL guest support" | ||
| 40 | echo " --fmod-lib path to FMOD library" | ||
| 41 | echo " --fmod-inc path to FMOD includes" | ||
| 42 | echo " --enable-uname-release=R Return R for uname -r in usermode emulation" | ||
| 43 | @@ -647,6 +651,23 @@ | ||
| 44 | } | ||
| 45 | EOF | ||
| 46 | |||
| 47 | +# check NPTL support | ||
| 48 | +cat > $TMPC <<EOF | ||
| 49 | +#include <sched.h> | ||
| 50 | +void foo() | ||
| 51 | +{ | ||
| 52 | +#ifndef CLONE_SETTLS | ||
| 53 | +#error bork | ||
| 54 | +#endif | ||
| 55 | +} | ||
| 56 | +EOF | ||
| 57 | + | ||
| 58 | +if $cc -c -o $TMPO $TMPC 2> /dev/null ; then | ||
| 59 | + : | ||
| 60 | +else | ||
| 61 | + nptl="no" | ||
| 62 | +fi | ||
| 63 | + | ||
| 64 | ########################################## | ||
| 65 | # SDL probe | ||
| 66 | |||
| 67 | @@ -845,6 +866,7 @@ | ||
| 68 | echo "Documentation $build_docs" | ||
| 69 | [ ! -z "$uname_release" ] && \ | ||
| 70 | echo "uname -r $uname_release" | ||
| 71 | +echo "NPTL support $nptl" | ||
| 72 | |||
| 73 | if test $sdl_too_old = "yes"; then | ||
| 74 | echo "-> Your SDL version is too old - please upgrade to have SDL support" | ||
| 75 | @@ -1228,6 +1250,9 @@ | ||
| 76 | echo "#define TARGET_ARM 1" >> $config_h | ||
| 77 | echo "#define CONFIG_NO_DYNGEN_OP 1" >> $config_h | ||
| 78 | bflt="yes" | ||
| 79 | + if test "$nptl" = "yes" ; then | ||
| 80 | + echo "#define USE_NPTL 1" >> $config_h | ||
| 81 | + fi | ||
| 82 | ;; | ||
| 83 | cris) | ||
| 84 | echo "TARGET_ARCH=cris" >> $config_mak | ||
| 85 | Index: trunk/exec-all.h | ||
| 86 | =================================================================== | ||
| 87 | --- trunk.orig/exec-all.h 2008-04-24 20:16:41.000000000 +0100 | ||
| 88 | +++ trunk/exec-all.h 2008-04-24 20:16:53.000000000 +0100 | ||
| 89 | @@ -303,217 +303,7 @@ | ||
| 90 | extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4]; | ||
| 91 | extern void *io_mem_opaque[IO_MEM_NB_ENTRIES]; | ||
| 92 | |||
| 93 | -#if defined(__hppa__) | ||
| 94 | - | ||
| 95 | -typedef int spinlock_t[4]; | ||
| 96 | - | ||
| 97 | -#define SPIN_LOCK_UNLOCKED { 1, 1, 1, 1 } | ||
| 98 | - | ||
| 99 | -static inline void resetlock (spinlock_t *p) | ||
| 100 | -{ | ||
| 101 | - (*p)[0] = (*p)[1] = (*p)[2] = (*p)[3] = 1; | ||
| 102 | -} | ||
| 103 | - | ||
| 104 | -#else | ||
| 105 | - | ||
| 106 | -typedef int spinlock_t; | ||
| 107 | - | ||
| 108 | -#define SPIN_LOCK_UNLOCKED 0 | ||
| 109 | - | ||
| 110 | -static inline void resetlock (spinlock_t *p) | ||
| 111 | -{ | ||
| 112 | - *p = SPIN_LOCK_UNLOCKED; | ||
| 113 | -} | ||
| 114 | - | ||
| 115 | -#endif | ||
| 116 | - | ||
| 117 | -#if defined(__powerpc__) | ||
| 118 | -static inline int testandset (int *p) | ||
| 119 | -{ | ||
| 120 | - int ret; | ||
| 121 | - __asm__ __volatile__ ( | ||
| 122 | - "0: lwarx %0,0,%1\n" | ||
| 123 | - " xor. %0,%3,%0\n" | ||
| 124 | - " bne 1f\n" | ||
| 125 | - " stwcx. %2,0,%1\n" | ||
| 126 | - " bne- 0b\n" | ||
| 127 | - "1: " | ||
| 128 | - : "=&r" (ret) | ||
| 129 | - : "r" (p), "r" (1), "r" (0) | ||
| 130 | - : "cr0", "memory"); | ||
| 131 | - return ret; | ||
| 132 | -} | ||
| 133 | -#elif defined(__i386__) | ||
| 134 | -static inline int testandset (int *p) | ||
| 135 | -{ | ||
| 136 | - long int readval = 0; | ||
| 137 | - | ||
| 138 | - __asm__ __volatile__ ("lock; cmpxchgl %2, %0" | ||
| 139 | - : "+m" (*p), "+a" (readval) | ||
| 140 | - : "r" (1) | ||
| 141 | - : "cc"); | ||
| 142 | - return readval; | ||
| 143 | -} | ||
| 144 | -#elif defined(__x86_64__) | ||
| 145 | -static inline int testandset (int *p) | ||
| 146 | -{ | ||
| 147 | - long int readval = 0; | ||
| 148 | - | ||
| 149 | - __asm__ __volatile__ ("lock; cmpxchgl %2, %0" | ||
| 150 | - : "+m" (*p), "+a" (readval) | ||
| 151 | - : "r" (1) | ||
| 152 | - : "cc"); | ||
| 153 | - return readval; | ||
| 154 | -} | ||
| 155 | -#elif defined(__s390__) | ||
| 156 | -static inline int testandset (int *p) | ||
| 157 | -{ | ||
| 158 | - int ret; | ||
| 159 | - | ||
| 160 | - __asm__ __volatile__ ("0: cs %0,%1,0(%2)\n" | ||
| 161 | - " jl 0b" | ||
| 162 | - : "=&d" (ret) | ||
| 163 | - : "r" (1), "a" (p), "0" (*p) | ||
| 164 | - : "cc", "memory" ); | ||
| 165 | - return ret; | ||
| 166 | -} | ||
| 167 | -#elif defined(__alpha__) | ||
| 168 | -static inline int testandset (int *p) | ||
| 169 | -{ | ||
| 170 | - int ret; | ||
| 171 | - unsigned long one; | ||
| 172 | - | ||
| 173 | - __asm__ __volatile__ ("0: mov 1,%2\n" | ||
| 174 | - " ldl_l %0,%1\n" | ||
| 175 | - " stl_c %2,%1\n" | ||
| 176 | - " beq %2,1f\n" | ||
| 177 | - ".subsection 2\n" | ||
| 178 | - "1: br 0b\n" | ||
| 179 | - ".previous" | ||
| 180 | - : "=r" (ret), "=m" (*p), "=r" (one) | ||
| 181 | - : "m" (*p)); | ||
| 182 | - return ret; | ||
| 183 | -} | ||
| 184 | -#elif defined(__sparc__) | ||
| 185 | -static inline int testandset (int *p) | ||
| 186 | -{ | ||
| 187 | - int ret; | ||
| 188 | - | ||
| 189 | - __asm__ __volatile__("ldstub [%1], %0" | ||
| 190 | - : "=r" (ret) | ||
| 191 | - : "r" (p) | ||
| 192 | - : "memory"); | ||
| 193 | - | ||
| 194 | - return (ret ? 1 : 0); | ||
| 195 | -} | ||
| 196 | -#elif defined(__arm__) | ||
| 197 | -static inline int testandset (int *spinlock) | ||
| 198 | -{ | ||
| 199 | - register unsigned int ret; | ||
| 200 | - __asm__ __volatile__("swp %0, %1, [%2]" | ||
| 201 | - : "=r"(ret) | ||
| 202 | - : "0"(1), "r"(spinlock)); | ||
| 203 | - | ||
| 204 | - return ret; | ||
| 205 | -} | ||
| 206 | -#elif defined(__mc68000) | ||
| 207 | -static inline int testandset (int *p) | ||
| 208 | -{ | ||
| 209 | - char ret; | ||
| 210 | - __asm__ __volatile__("tas %1; sne %0" | ||
| 211 | - : "=r" (ret) | ||
| 212 | - : "m" (p) | ||
| 213 | - : "cc","memory"); | ||
| 214 | - return ret; | ||
| 215 | -} | ||
| 216 | -#elif defined(__hppa__) | ||
| 217 | - | ||
| 218 | -/* Because malloc only guarantees 8-byte alignment for malloc'd data, | ||
| 219 | - and GCC only guarantees 8-byte alignment for stack locals, we can't | ||
| 220 | - be assured of 16-byte alignment for atomic lock data even if we | ||
| 221 | - specify "__attribute ((aligned(16)))" in the type declaration. So, | ||
| 222 | - we use a struct containing an array of four ints for the atomic lock | ||
| 223 | - type and dynamically select the 16-byte aligned int from the array | ||
| 224 | - for the semaphore. */ | ||
| 225 | -#define __PA_LDCW_ALIGNMENT 16 | ||
| 226 | -static inline void *ldcw_align (void *p) { | ||
| 227 | - unsigned long a = (unsigned long)p; | ||
| 228 | - a = (a + __PA_LDCW_ALIGNMENT - 1) & ~(__PA_LDCW_ALIGNMENT - 1); | ||
| 229 | - return (void *)a; | ||
| 230 | -} | ||
| 231 | - | ||
| 232 | -static inline int testandset (spinlock_t *p) | ||
| 233 | -{ | ||
| 234 | - unsigned int ret; | ||
| 235 | - p = ldcw_align(p); | ||
| 236 | - __asm__ __volatile__("ldcw 0(%1),%0" | ||
| 237 | - : "=r" (ret) | ||
| 238 | - : "r" (p) | ||
| 239 | - : "memory" ); | ||
| 240 | - return !ret; | ||
| 241 | -} | ||
| 242 | - | ||
| 243 | -#elif defined(__ia64) | ||
| 244 | - | ||
| 245 | -#include <ia64intrin.h> | ||
| 246 | - | ||
| 247 | -static inline int testandset (int *p) | ||
| 248 | -{ | ||
| 249 | - return __sync_lock_test_and_set (p, 1); | ||
| 250 | -} | ||
| 251 | -#elif defined(__mips__) | ||
| 252 | -static inline int testandset (int *p) | ||
| 253 | -{ | ||
| 254 | - int ret; | ||
| 255 | - | ||
| 256 | - __asm__ __volatile__ ( | ||
| 257 | - " .set push \n" | ||
| 258 | - " .set noat \n" | ||
| 259 | - " .set mips2 \n" | ||
| 260 | - "1: li $1, 1 \n" | ||
| 261 | - " ll %0, %1 \n" | ||
| 262 | - " sc $1, %1 \n" | ||
| 263 | - " beqz $1, 1b \n" | ||
| 264 | - " .set pop " | ||
| 265 | - : "=r" (ret), "+R" (*p) | ||
| 266 | - : | ||
| 267 | - : "memory"); | ||
| 268 | - | ||
| 269 | - return ret; | ||
| 270 | -} | ||
| 271 | -#else | ||
| 272 | -#error unimplemented CPU support | ||
| 273 | -#endif | ||
| 274 | - | ||
| 275 | -#if defined(CONFIG_USER_ONLY) | ||
| 276 | -static inline void spin_lock(spinlock_t *lock) | ||
| 277 | -{ | ||
| 278 | - while (testandset(lock)); | ||
| 279 | -} | ||
| 280 | - | ||
| 281 | -static inline void spin_unlock(spinlock_t *lock) | ||
| 282 | -{ | ||
| 283 | - resetlock(lock); | ||
| 284 | -} | ||
| 285 | - | ||
| 286 | -static inline int spin_trylock(spinlock_t *lock) | ||
| 287 | -{ | ||
| 288 | - return !testandset(lock); | ||
| 289 | -} | ||
| 290 | -#else | ||
| 291 | -static inline void spin_lock(spinlock_t *lock) | ||
| 292 | -{ | ||
| 293 | -} | ||
| 294 | - | ||
| 295 | -static inline void spin_unlock(spinlock_t *lock) | ||
| 296 | -{ | ||
| 297 | -} | ||
| 298 | - | ||
| 299 | -static inline int spin_trylock(spinlock_t *lock) | ||
| 300 | -{ | ||
| 301 | - return 1; | ||
| 302 | -} | ||
| 303 | -#endif | ||
| 304 | +#include "qemu_spinlock.h" | ||
| 305 | |||
| 306 | extern spinlock_t tb_lock; | ||
| 307 | |||
| 308 | Index: trunk/linux-user/arm/syscall.h | ||
| 309 | =================================================================== | ||
| 310 | --- trunk.orig/linux-user/arm/syscall.h 2008-04-24 20:16:41.000000000 +0100 | ||
| 311 | +++ trunk/linux-user/arm/syscall.h 2008-04-24 20:16:53.000000000 +0100 | ||
| 312 | @@ -28,7 +28,9 @@ | ||
| 313 | #define ARM_SYSCALL_BASE 0x900000 | ||
| 314 | #define ARM_THUMB_SYSCALL 0 | ||
| 315 | |||
| 316 | -#define ARM_NR_cacheflush (ARM_SYSCALL_BASE + 0xf0000 + 2) | ||
| 317 | +#define ARM_NR_BASE 0xf0000 | ||
| 318 | +#define ARM_NR_cacheflush (ARM_NR_BASE + 2) | ||
| 319 | +#define ARM_NR_set_tls (ARM_NR_BASE + 5) | ||
| 320 | |||
| 321 | #define ARM_NR_semihosting 0x123456 | ||
| 322 | #define ARM_NR_thumb_semihosting 0xAB | ||
| 323 | Index: trunk/linux-user/main.c | ||
| 324 | =================================================================== | ||
| 325 | --- trunk.orig/linux-user/main.c 2008-04-24 20:16:47.000000000 +0100 | ||
| 326 | +++ trunk/linux-user/main.c 2008-04-24 20:17:38.000000000 +0100 | ||
| 327 | @@ -365,6 +365,50 @@ | ||
| 328 | } | ||
| 329 | } | ||
| 330 | |||
| 331 | +/* Handle a jump to the kernel code page. */ | ||
| 332 | +static int | ||
| 333 | +do_kernel_trap(CPUARMState *env) | ||
| 334 | +{ | ||
| 335 | + uint32_t addr; | ||
| 336 | + uint32_t *ptr; | ||
| 337 | + uint32_t cpsr; | ||
| 338 | + | ||
| 339 | + switch (env->regs[15]) { | ||
| 340 | + case 0xffff0fc0: /* __kernel_cmpxchg */ | ||
| 341 | + /* XXX: This only works between threads, not between processes. | ||
| 342 | + Use native atomic operations. */ | ||
| 343 | + /* ??? This probably breaks horribly if the access segfaults. */ | ||
| 344 | + cpu_lock(); | ||
| 345 | + ptr = (uint32_t *)env->regs[2]; | ||
| 346 | + cpsr = cpsr_read(env); | ||
| 347 | + if (*ptr == env->regs[0]) { | ||
| 348 | + *ptr = env->regs[1]; | ||
| 349 | + env->regs[0] = 0; | ||
| 350 | + cpsr |= CPSR_C; | ||
| 351 | + } else { | ||
| 352 | + env->regs[0] = -1; | ||
| 353 | + cpsr &= ~CPSR_C; | ||
| 354 | + } | ||
| 355 | + cpsr_write(env, cpsr, CPSR_C); | ||
| 356 | + cpu_unlock(); | ||
| 357 | + break; | ||
| 358 | + case 0xffff0fe0: /* __kernel_get_tls */ | ||
| 359 | + env->regs[0] = env->cp15.c13_tls2; | ||
| 360 | + break; | ||
| 361 | + default: | ||
| 362 | + return 1; | ||
| 363 | + } | ||
| 364 | + /* Jump back to the caller. */ | ||
| 365 | + addr = env->regs[14]; | ||
| 366 | + if (addr & 1) { | ||
| 367 | + env->thumb = 1; | ||
| 368 | + addr &= ~1; | ||
| 369 | + } | ||
| 370 | + env->regs[15] = addr; | ||
| 371 | + | ||
| 372 | + return 0; | ||
| 373 | +} | ||
| 374 | + | ||
| 375 | void cpu_loop(CPUARMState *env) | ||
| 376 | { | ||
| 377 | int trapnr; | ||
| 378 | @@ -475,10 +519,8 @@ | ||
| 379 | } | ||
| 380 | } | ||
| 381 | |||
| 382 | - if (n == ARM_NR_cacheflush) { | ||
| 383 | - arm_cache_flush(env->regs[0], env->regs[1]); | ||
| 384 | - } else if (n == ARM_NR_semihosting | ||
| 385 | - || n == ARM_NR_thumb_semihosting) { | ||
| 386 | + if (n == ARM_NR_semihosting | ||
| 387 | + || n == ARM_NR_thumb_semihosting) { | ||
| 388 | env->regs[0] = do_arm_semihosting (env); | ||
| 389 | } else if (n == 0 || n >= ARM_SYSCALL_BASE | ||
| 390 | || (env->thumb && n == ARM_THUMB_SYSCALL)) { | ||
| 391 | @@ -489,14 +531,34 @@ | ||
| 392 | n -= ARM_SYSCALL_BASE; | ||
| 393 | env->eabi = 0; | ||
| 394 | } | ||
| 395 | - env->regs[0] = do_syscall(env, | ||
| 396 | - n, | ||
| 397 | - env->regs[0], | ||
| 398 | - env->regs[1], | ||
| 399 | - env->regs[2], | ||
| 400 | - env->regs[3], | ||
| 401 | - env->regs[4], | ||
| 402 | - env->regs[5]); | ||
| 403 | + if ( n > ARM_NR_BASE) { | ||
| 404 | + switch (n) | ||
| 405 | + { | ||
| 406 | + case ARM_NR_cacheflush: | ||
| 407 | + arm_cache_flush(env->regs[0], env->regs[1]); | ||
| 408 | + break; | ||
| 409 | +#ifdef USE_NPTL | ||
| 410 | + case ARM_NR_set_tls: | ||
| 411 | + cpu_set_tls(env, env->regs[0]); | ||
| 412 | + env->regs[0] = 0; | ||
| 413 | + break; | ||
| 414 | +#endif | ||
| 415 | + default: | ||
| 416 | + printf ("Error: Bad syscall: %x\n", n); | ||
| 417 | + goto error; | ||
| 418 | + } | ||
| 419 | + } | ||
| 420 | + else | ||
| 421 | + { | ||
| 422 | + env->regs[0] = do_syscall(env, | ||
| 423 | + n, | ||
| 424 | + env->regs[0], | ||
| 425 | + env->regs[1], | ||
| 426 | + env->regs[2], | ||
| 427 | + env->regs[3], | ||
| 428 | + env->regs[4], | ||
| 429 | + env->regs[5]); | ||
| 430 | + } | ||
| 431 | } else { | ||
| 432 | goto error; | ||
| 433 | } | ||
| 434 | @@ -535,6 +597,10 @@ | ||
| 435 | } | ||
| 436 | } | ||
| 437 | break; | ||
| 438 | + case EXCP_KERNEL_TRAP: | ||
| 439 | + if (do_kernel_trap(env)) | ||
| 440 | + goto error; | ||
| 441 | + break; | ||
| 442 | default: | ||
| 443 | error: | ||
| 444 | fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", | ||
| 445 | @@ -1994,6 +2060,11 @@ | ||
| 446 | int drop_ld_preload = 0, environ_count = 0; | ||
| 447 | char **target_environ, **wrk, **dst; | ||
| 448 | |||
| 449 | + char *assume_kernel = getenv("QEMU_ASSUME_KERNEL"); | ||
| 450 | + | ||
| 451 | + if (assume_kernel) | ||
| 452 | + setenv("LD_ASSUME_KERNEL", assume_kernel, 1); | ||
| 453 | + | ||
| 454 | if (argc <= 1) | ||
| 455 | usage(); | ||
| 456 | |||
| 457 | @@ -2403,6 +2474,10 @@ | ||
| 458 | ts->heap_base = info->brk; | ||
| 459 | /* This will be filled in on the first SYS_HEAPINFO call. */ | ||
| 460 | ts->heap_limit = 0; | ||
| 461 | + /* Register the magic kernel code page. The cpu will generate a | ||
| 462 | + special exception when it tries to execute code here. We can't | ||
| 463 | + put real code here because it may be in use by the host kernel. */ | ||
| 464 | + page_set_flags(0xffff0000, 0xffff0fff, 0); | ||
| 465 | #endif | ||
| 466 | |||
| 467 | if (gdbstub_port) { | ||
| 468 | Index: trunk/linux-user/qemu.h | ||
| 469 | =================================================================== | ||
| 470 | --- trunk.orig/linux-user/qemu.h 2008-04-24 20:16:41.000000000 +0100 | ||
| 471 | +++ trunk/linux-user/qemu.h 2008-04-24 20:16:53.000000000 +0100 | ||
| 472 | @@ -107,6 +107,9 @@ | ||
| 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 | Index: trunk/linux-user/syscall.c | ||
| 483 | =================================================================== | ||
| 484 | --- trunk.orig/linux-user/syscall.c 2008-04-24 20:16:50.000000000 +0100 | ||
| 485 | +++ trunk/linux-user/syscall.c 2008-04-24 20:19:52.000000000 +0100 | ||
| 486 | @@ -61,6 +61,7 @@ | ||
| 487 | #define tchars host_tchars /* same as target */ | ||
| 488 | #define ltchars host_ltchars /* same as target */ | ||
| 489 | |||
| 490 | +#include <linux/futex.h> | ||
| 491 | #include <linux/termios.h> | ||
| 492 | #include <linux/unistd.h> | ||
| 493 | #include <linux/utsname.h> | ||
| 494 | @@ -71,9 +72,18 @@ | ||
| 495 | #include <linux/kd.h> | ||
| 496 | |||
| 497 | #include "qemu.h" | ||
| 498 | +#include "qemu_spinlock.h" | ||
| 499 | |||
| 500 | //#define DEBUG | ||
| 501 | |||
| 502 | +#ifdef USE_NPTL | ||
| 503 | +#define CLONE_NPTL_FLAGS2 (CLONE_SETTLS | \ | ||
| 504 | + CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID) | ||
| 505 | +#else | ||
| 506 | +/* XXX: Hardcode the above values. */ | ||
| 507 | +#define CLONE_NPTL_FLAGS2 0 | ||
| 508 | +#endif | ||
| 509 | + | ||
| 510 | #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ | ||
| 511 | || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) | ||
| 512 | /* 16 bit uid wrappers emulation */ | ||
| 513 | @@ -2695,16 +2705,25 @@ | ||
| 514 | return 0; | ||
| 515 | } | ||
| 516 | #endif | ||
| 517 | - | ||
| 518 | #endif /* defined(TARGET_I386) */ | ||
| 519 | |||
| 520 | /* this stack is the equivalent of the kernel stack associated with a | ||
| 521 | thread/process */ | ||
| 522 | #define NEW_STACK_SIZE 8192 | ||
| 523 | |||
| 524 | +#ifdef USE_NPTL | ||
| 525 | +static spinlock_t nptl_lock = SPIN_LOCK_UNLOCKED; | ||
| 526 | +#endif | ||
| 527 | + | ||
| 528 | static int clone_func(void *arg) | ||
| 529 | { | ||
| 530 | CPUState *env = arg; | ||
| 531 | +#ifdef HAVE_NPTL | ||
| 532 | + /* Wait until the parent has finshed initializing the tls state. */ | ||
| 533 | + while (!spin_trylock(&nptl_lock)) | ||
| 534 | + usleep(1); | ||
| 535 | + spin_unlock(&nptl_lock); | ||
| 536 | +#endif | ||
| 537 | cpu_loop(env); | ||
| 538 | /* never exits */ | ||
| 539 | return 0; | ||
| 540 | @@ -2712,15 +2731,27 @@ | ||
| 541 | |||
| 542 | /* do_fork() Must return host values and target errnos (unlike most | ||
| 543 | do_*() functions). */ | ||
| 544 | -int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp) | ||
| 545 | +int do_fork(CPUState *env, unsigned int flags, unsigned long newsp, | ||
| 546 | + uint32_t *parent_tidptr, void *newtls, | ||
| 547 | + uint32_t *child_tidptr) | ||
| 548 | { | ||
| 549 | int ret; | ||
| 550 | TaskState *ts; | ||
| 551 | uint8_t *new_stack; | ||
| 552 | CPUState *new_env; | ||
| 553 | +#if defined(TARGET_I386) | ||
| 554 | + uint64_t *new_gdt_table; | ||
| 555 | +#endif | ||
| 556 | +#ifdef USE_NPTL | ||
| 557 | + unsigned int nptl_flags; | ||
| 558 | |||
| 559 | + if (flags & CLONE_PARENT_SETTID) | ||
| 560 | + *parent_tidptr = gettid(); | ||
| 561 | +#endif | ||
| 562 | if (flags & CLONE_VM) { | ||
| 563 | ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE); | ||
| 564 | + if (!ts) | ||
| 565 | + return -ENOMEM; | ||
| 566 | memset(ts, 0, sizeof(TaskState)); | ||
| 567 | new_stack = ts->stack; | ||
| 568 | ts->used = 1; | ||
| 569 | @@ -2732,6 +2763,29 @@ | ||
| 570 | #if defined(TARGET_I386) | ||
| 571 | if (!newsp) | ||
| 572 | newsp = env->regs[R_ESP]; | ||
| 573 | + new_gdt_table = malloc(9 * 8); | ||
| 574 | + if (!new_gdt_table) { | ||
| 575 | + free(new_env); | ||
| 576 | + return -ENOMEM; | ||
| 577 | + } | ||
| 578 | + /* Copy main GDT table from parent, but clear TLS entries */ | ||
| 579 | + memcpy(new_gdt_table, g2h(env->gdt.base), 6 * 8); | ||
| 580 | + memset(&new_gdt_table[6], 0, 3 * 8); | ||
| 581 | + new_env->gdt.base = h2g(new_gdt_table); | ||
| 582 | + if (flags & 0x00080000 /* CLONE_SETTLS */) { | ||
| 583 | + ret = do_set_thread_area(new_env, new_env->regs[R_ESI]); | ||
| 584 | + if (ret) { | ||
| 585 | + free(new_gdt_table); | ||
| 586 | + free(new_env); | ||
| 587 | + return ret; | ||
| 588 | + } | ||
| 589 | + } | ||
| 590 | + cpu_x86_load_seg(env, R_CS, new_env->regs[R_CS]); | ||
| 591 | + cpu_x86_load_seg(env, R_DS, new_env->regs[R_DS]); | ||
| 592 | + cpu_x86_load_seg(env, R_ES, new_env->regs[R_ES]); | ||
| 593 | + cpu_x86_load_seg(env, R_SS, new_env->regs[R_SS]); | ||
| 594 | + cpu_x86_load_seg(env, R_FS, new_env->regs[R_FS]); | ||
| 595 | + cpu_x86_load_seg(env, R_GS, new_env->regs[R_GS]); | ||
| 596 | new_env->regs[R_ESP] = newsp; | ||
| 597 | new_env->regs[R_EAX] = 0; | ||
| 598 | #elif defined(TARGET_ARM) | ||
| 599 | @@ -2784,16 +2838,67 @@ | ||
| 600 | #error unsupported target CPU | ||
| 601 | #endif | ||
| 602 | new_env->opaque = ts; | ||
| 603 | +#ifdef USE_NPTL | ||
| 604 | + nptl_flags = flags; | ||
| 605 | + flags &= ~CLONE_NPTL_FLAGS2; | ||
| 606 | + | ||
| 607 | + if (nptl_flags & CLONE_CHILD_CLEARTID) { | ||
| 608 | + ts->child_tidptr = child_tidptr; | ||
| 609 | + } | ||
| 610 | + | ||
| 611 | + if (nptl_flags & CLONE_SETTLS) | ||
| 612 | + cpu_set_tls (new_env, newtls); | ||
| 613 | + | ||
| 614 | + /* Grab the global cpu lock so that the thread setup appears | ||
| 615 | + atomic. */ | ||
| 616 | + if (nptl_flags & CLONE_CHILD_SETTID) | ||
| 617 | + spin_lock(&nptl_lock); | ||
| 618 | + | ||
| 619 | +#else | ||
| 620 | + if (flags & CLONE_NPTL_FLAGS2) | ||
| 621 | + return -EINVAL; | ||
| 622 | +#endif | ||
| 623 | + | ||
| 624 | + if (CLONE_VFORK & flags) | ||
| 625 | + flags ^= CLONE_VM; | ||
| 626 | #ifdef __ia64__ | ||
| 627 | ret = __clone2(clone_func, new_stack + NEW_STACK_SIZE, flags, new_env); | ||
| 628 | #else | ||
| 629 | ret = clone(clone_func, new_stack + NEW_STACK_SIZE, flags, new_env); | ||
| 630 | #endif | ||
| 631 | +#ifdef USE_NPTL | ||
| 632 | + if (ret != -1) { | ||
| 633 | + if (nptl_flags & CLONE_CHILD_SETTID) | ||
| 634 | + *child_tidptr = ret; | ||
| 635 | + } | ||
| 636 | + | ||
| 637 | + /* Allow the child to continue. */ | ||
| 638 | + if (nptl_flags & CLONE_CHILD_SETTID) | ||
| 639 | + spin_unlock(&nptl_lock); | ||
| 640 | +#endif | ||
| 641 | } else { | ||
| 642 | /* if no CLONE_VM, we consider it is a fork */ | ||
| 643 | - if ((flags & ~CSIGNAL) != 0) | ||
| 644 | + if ((flags & ~(CSIGNAL | CLONE_NPTL_FLAGS2)) != 0) | ||
| 645 | return -EINVAL; | ||
| 646 | ret = fork(); | ||
| 647 | +#ifdef USE_NPTL | ||
| 648 | + /* There is a race condition here. The parent process could | ||
| 649 | + theoretically read the TID in the child process before the child | ||
| 650 | + tid is set. This would require using either ptrace | ||
| 651 | + (not implemented) or having *_tidptr to point at a shared memory | ||
| 652 | + mapping. We can't repeat the spinlock hack used above because | ||
| 653 | + the child process gets its own copy of the lock. */ | ||
| 654 | + if (ret == 0) { | ||
| 655 | + /* Child Process. */ | ||
| 656 | + if (flags & CLONE_CHILD_SETTID) | ||
| 657 | + *child_tidptr = gettid(); | ||
| 658 | + ts = (TaskState *)env->opaque; | ||
| 659 | + if (flags & CLONE_CHILD_CLEARTID) | ||
| 660 | + ts->child_tidptr = child_tidptr; | ||
| 661 | + if (flags & CLONE_SETTLS) | ||
| 662 | + cpu_set_tls (env, newtls); | ||
| 663 | + } | ||
| 664 | +#endif | ||
| 665 | } | ||
| 666 | return ret; | ||
| 667 | } | ||
| 668 | @@ -3052,6 +3157,68 @@ | ||
| 669 | unlock_user_struct(target_ts, target_addr, 1); | ||
| 670 | } | ||
| 671 | |||
| 672 | +static long do_futex(target_ulong uaddr, int op, uint32_t val, | ||
| 673 | + target_ulong utime, target_ulong uaddr2, | ||
| 674 | + uint32_t val3) | ||
| 675 | +{ | ||
| 676 | + struct timespec host_utime; | ||
| 677 | + unsigned long val2 = utime; | ||
| 678 | + | ||
| 679 | + if (utime && (op == FUTEX_WAIT || op == FUTEX_LOCK_PI)) { | ||
| 680 | + target_to_host_timespec(&host_utime, utime); | ||
| 681 | + val2 = (unsigned long)&host_utime; | ||
| 682 | + } | ||
| 683 | + | ||
| 684 | +#ifdef BSWAP_NEEDED | ||
| 685 | + switch(op) { | ||
| 686 | + case FUTEX_CMP_REQUEUE: | ||
| 687 | + val3 = tswap32(val3); | ||
| 688 | + case FUTEX_REQUEUE: | ||
| 689 | + val2 = tswap32(val2); | ||
| 690 | + case FUTEX_WAIT: | ||
| 691 | + case FUTEX_WAKE: | ||
| 692 | + val = tswap32(val); | ||
| 693 | + case FUTEX_LOCK_PI: /* This one's icky, but comes out OK */ | ||
| 694 | + case FUTEX_UNLOCK_PI: | ||
| 695 | + break; | ||
| 696 | + default: | ||
| 697 | + gemu_log("qemu: Unsupported futex op %d\n", op); | ||
| 698 | + return -ENOSYS; | ||
| 699 | + } | ||
| 700 | +#if 0 /* No, it's worse than this */ | ||
| 701 | + if (op == FUTEX_WAKE_OP) { | ||
| 702 | + /* Need to munge the secondary operation (val3) */ | ||
| 703 | + val3 = tswap32(val3); | ||
| 704 | + int op2 = (val3 >> 28) & 7; | ||
| 705 | + int cmp = (val3 >> 24) & 15; | ||
| 706 | + int oparg = (val3 << 8) >> 20; | ||
| 707 | + int cmparg = (val3 << 20) >> 20; | ||
| 708 | + int shift = val3 & (FUTEX_OP_OPARG_SHIFT << 28); | ||
| 709 | + | ||
| 710 | + if (shift) | ||
| 711 | + oparg = (oparg & 7) + 24 - (oparg & 24); | ||
| 712 | + else oparg = | ||
| 713 | + if (op2 == FUTEX_OP_ADD) { | ||
| 714 | + gemu_log("qemu: Unsupported wrong-endian FUTEX_OP_ADD\n"); | ||
| 715 | + return -ENOSYS; | ||
| 716 | + } | ||
| 717 | + if (cmparg == FUTEX_OP_CMP_LT || cmparg == FUTEX_OP_CMP_GE || | ||
| 718 | + cmparg == FUTEX_OP_CMP_LE || cmparg == FUTEX_OP_CMP_GT) { | ||
| 719 | + gemu_log("qemu: Unsupported wrong-endian futex cmparg %d\n", cmparg); | ||
| 720 | + return -ENOSYS; | ||
| 721 | + } | ||
| 722 | + val3 = shift | (op2<<28) | (cmp<<24) | (oparg<<12) | cmparg; | ||
| 723 | + } | ||
| 724 | +#endif | ||
| 725 | +#endif | ||
| 726 | + return syscall(__NR_futex, g2h(uaddr), op, val, val2, g2h(uaddr2), val3); | ||
| 727 | +} | ||
| 728 | + | ||
| 729 | +int do_set_tid_address(target_ulong tidptr) | ||
| 730 | +{ | ||
| 731 | + return syscall(__NR_set_tid_address, g2h(tidptr)); | ||
| 732 | +} | ||
| 733 | + | ||
| 734 | /* do_syscall() should always have a single exit point at the end so | ||
| 735 | that actions, such as logging of syscall results, can be performed. | ||
| 736 | All errnos that do_syscall() returns must be -TARGET_<errcode>. */ | ||
| 737 | @@ -3076,7 +3243,7 @@ | ||
| 738 | _mcleanup(); | ||
| 739 | #endif | ||
| 740 | gdb_exit(cpu_env, arg1); | ||
| 741 | - /* XXX: should free thread stack and CPU env */ | ||
| 742 | + /* XXX: should free thread stack, GDT and CPU env */ | ||
| 743 | _exit(arg1); | ||
| 744 | ret = 0; /* avoid warning */ | ||
| 745 | break; | ||
| 746 | @@ -3118,7 +3285,7 @@ | ||
| 747 | ret = do_brk(arg1); | ||
| 748 | break; | ||
| 749 | case TARGET_NR_fork: | ||
| 750 | - ret = get_errno(do_fork(cpu_env, SIGCHLD, 0)); | ||
| 751 | + ret = get_errno(do_fork(cpu_env, SIGCHLD, 0, NULL, NULL, NULL)); | ||
| 752 | break; | ||
| 753 | #ifdef TARGET_NR_waitpid | ||
| 754 | case TARGET_NR_waitpid: | ||
| 755 | @@ -4482,7 +4649,8 @@ | ||
| 756 | ret = get_errno(fsync(arg1)); | ||
| 757 | break; | ||
| 758 | case TARGET_NR_clone: | ||
| 759 | - ret = get_errno(do_fork(cpu_env, arg1, arg2)); | ||
| 760 | + ret = get_errno(do_fork(cpu_env, arg1, arg2, (uint32_t *)arg3, | ||
| 761 | + (void *)arg4, (uint32_t *)arg5)); | ||
| 762 | break; | ||
| 763 | #ifdef __NR_exit_group | ||
| 764 | /* new thread calls */ | ||
| 765 | @@ -4943,7 +5111,8 @@ | ||
| 766 | #endif | ||
| 767 | #ifdef TARGET_NR_vfork | ||
| 768 | case TARGET_NR_vfork: | ||
| 769 | - ret = get_errno(do_fork(cpu_env, CLONE_VFORK | CLONE_VM | SIGCHLD, 0)); | ||
| 770 | + ret = get_errno(do_fork(cpu_env, CLONE_VFORK | CLONE_VM | SIGCHLD, 0, | ||
| 771 | + NULL, NULL, NULL)); | ||
| 772 | break; | ||
| 773 | #endif | ||
| 774 | #ifdef TARGET_NR_ugetrlimit | ||
| 775 | @@ -5521,6 +5690,9 @@ | ||
| 776 | #elif defined(TARGET_I386) && defined(TARGET_ABI32) | ||
| 777 | ret = do_set_thread_area(cpu_env, arg1); | ||
| 778 | break; | ||
| 779 | +#elif TARGET_i386 | ||
| 780 | + ret = get_errno(do_set_thread_area(cpu_env, arg1)); | ||
| 781 | + break; | ||
| 782 | #else | ||
| 783 | goto unimplemented_nowarn; | ||
| 784 | #endif | ||
| 785 | @@ -5538,6 +5710,12 @@ | ||
| 786 | goto unimplemented_nowarn; | ||
| 787 | #endif | ||
| 788 | |||
| 789 | +#ifdef TARGET_NR_futex | ||
| 790 | + case TARGET_NR_futex: | ||
| 791 | + ret = get_errno(do_futex(arg1, arg2, arg3, arg4, arg5, arg6)); | ||
| 792 | + break; | ||
| 793 | +#endif | ||
| 794 | + | ||
| 795 | #ifdef TARGET_NR_clock_gettime | ||
| 796 | case TARGET_NR_clock_gettime: | ||
| 797 | { | ||
| 798 | Index: trunk/qemu_spinlock.h | ||
| 799 | =================================================================== | ||
| 800 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
| 801 | +++ trunk/qemu_spinlock.h 2008-04-24 20:16:53.000000000 +0100 | ||
| 802 | @@ -0,0 +1,250 @@ | ||
| 803 | +/* | ||
| 804 | + * Atomic operation helper include | ||
| 805 | + * | ||
| 806 | + * Copyright (c) 2005 Fabrice Bellard | ||
| 807 | + * | ||
| 808 | + * This library is free software; you can redistribute it and/or | ||
| 809 | + * modify it under the terms of the GNU Lesser General Public | ||
| 810 | + * License as published by the Free Software Foundation; either | ||
| 811 | + * version 2 of the License, or (at your option) any later version. | ||
| 812 | + * | ||
| 813 | + * This library is distributed in the hope that it will be useful, | ||
| 814 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 815 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 816 | + * Lesser General Public License for more details. | ||
| 817 | + * | ||
| 818 | + * You should have received a copy of the GNU Lesser General Public | ||
| 819 | + * License along with this library; if not, write to the Free Software | ||
| 820 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 821 | + */ | ||
| 822 | +#ifndef QEMU_SPINLOCK_H | ||
| 823 | +#define QEMU_SPINLOCK_H | ||
| 824 | + | ||
| 825 | +#ifdef __powerpc__ | ||
| 826 | +static inline int testandset (int *p) | ||
| 827 | +{ | ||
| 828 | + int ret; | ||
| 829 | + __asm__ __volatile__ ( | ||
| 830 | + "0: lwarx %0,0,%1\n" | ||
| 831 | + " xor. %0,%3,%0\n" | ||
| 832 | + " bne 1f\n" | ||
| 833 | + " stwcx. %2,0,%1\n" | ||
| 834 | + " bne- 0b\n" | ||
| 835 | + "1: " | ||
| 836 | + : "=&r" (ret) | ||
| 837 | + : "r" (p), "r" (1), "r" (0) | ||
| 838 | + : "cr0", "memory"); | ||
| 839 | + return ret; | ||
| 840 | +} | ||
| 841 | +#endif | ||
| 842 | + | ||
| 843 | +#ifdef __i386__ | ||
| 844 | +static inline int testandset (int *p) | ||
| 845 | +{ | ||
| 846 | + long int readval = 0; | ||
| 847 | + | ||
| 848 | + __asm__ __volatile__ ("lock; cmpxchgl %2, %0" | ||
| 849 | + : "+m" (*p), "+a" (readval) | ||
| 850 | + : "r" (1) | ||
| 851 | + : "cc"); | ||
| 852 | + return readval; | ||
| 853 | +} | ||
| 854 | +#endif | ||
| 855 | + | ||
| 856 | +#ifdef __x86_64__ | ||
| 857 | +static inline int testandset (int *p) | ||
| 858 | +{ | ||
| 859 | + long int readval = 0; | ||
| 860 | + | ||
| 861 | + __asm__ __volatile__ ("lock; cmpxchgl %2, %0" | ||
| 862 | + : "+m" (*p), "+a" (readval) | ||
| 863 | + : "r" (1) | ||
| 864 | + : "cc"); | ||
| 865 | + return readval; | ||
| 866 | +} | ||
| 867 | +#endif | ||
| 868 | + | ||
| 869 | +#ifdef __s390__ | ||
| 870 | +static inline int testandset (int *p) | ||
| 871 | +{ | ||
| 872 | + int ret; | ||
| 873 | + | ||
| 874 | + __asm__ __volatile__ ("0: cs %0,%1,0(%2)\n" | ||
| 875 | + " jl 0b" | ||
| 876 | + : "=&d" (ret) | ||
| 877 | + : "r" (1), "a" (p), "0" (*p) | ||
| 878 | + : "cc", "memory" ); | ||
| 879 | + return ret; | ||
| 880 | +} | ||
| 881 | +#endif | ||
| 882 | + | ||
| 883 | +#ifdef __alpha__ | ||
| 884 | +static inline int testandset (int *p) | ||
| 885 | +{ | ||
| 886 | + int ret; | ||
| 887 | + unsigned long one; | ||
| 888 | + | ||
| 889 | + __asm__ __volatile__ ("0: mov 1,%2\n" | ||
| 890 | + " ldl_l %0,%1\n" | ||
| 891 | + " stl_c %2,%1\n" | ||
| 892 | + " beq %2,1f\n" | ||
| 893 | + ".subsection 2\n" | ||
| 894 | + "1: br 0b\n" | ||
| 895 | + ".previous" | ||
| 896 | + : "=r" (ret), "=m" (*p), "=r" (one) | ||
| 897 | + : "m" (*p)); | ||
| 898 | + return ret; | ||
| 899 | +} | ||
| 900 | +#endif | ||
| 901 | + | ||
| 902 | +#ifdef __sparc__ | ||
| 903 | +static inline int testandset (int *p) | ||
| 904 | +{ | ||
| 905 | + int ret; | ||
| 906 | + | ||
| 907 | + __asm__ __volatile__("ldstub [%1], %0" | ||
| 908 | + : "=r" (ret) | ||
| 909 | + : "r" (p) | ||
| 910 | + : "memory"); | ||
| 911 | + | ||
| 912 | + return (ret ? 1 : 0); | ||
| 913 | +} | ||
| 914 | +#endif | ||
| 915 | + | ||
| 916 | +#ifdef __arm__ | ||
| 917 | +static inline int testandset (int *spinlock) | ||
| 918 | +{ | ||
| 919 | + register unsigned int ret; | ||
| 920 | + __asm__ __volatile__("swp %0, %1, [%2]" | ||
| 921 | + : "=r"(ret) | ||
| 922 | + : "0"(1), "r"(spinlock)); | ||
| 923 | + | ||
| 924 | + return ret; | ||
| 925 | +} | ||
| 926 | +#endif | ||
| 927 | + | ||
| 928 | +#ifdef __mc68000 | ||
| 929 | +static inline int testandset (int *p) | ||
| 930 | +{ | ||
| 931 | + char ret; | ||
| 932 | + __asm__ __volatile__("tas %1; sne %0" | ||
| 933 | + : "=r" (ret) | ||
| 934 | + : "m" (p) | ||
| 935 | + : "cc","memory"); | ||
| 936 | + return ret; | ||
| 937 | +} | ||
| 938 | +#endif | ||
| 939 | + | ||
| 940 | +#ifdef __hppa__ | ||
| 941 | +/* Because malloc only guarantees 8-byte alignment for malloc'd data, | ||
| 942 | + and GCC only guarantees 8-byte alignment for stack locals, we can't | ||
| 943 | + be assured of 16-byte alignment for atomic lock data even if we | ||
| 944 | + specify "__attribute ((aligned(16)))" in the type declaration. So, | ||
| 945 | + we use a struct containing an array of four ints for the atomic lock | ||
| 946 | + type and dynamically select the 16-byte aligned int from the array | ||
| 947 | + for the semaphore. */ | ||
| 948 | +#define __PA_LDCW_ALIGNMENT 16 | ||
| 949 | +static inline void *ldcw_align (void *p) { | ||
| 950 | + unsigned long a = (unsigned long)p; | ||
| 951 | + a = (a + __PA_LDCW_ALIGNMENT - 1) & ~(__PA_LDCW_ALIGNMENT - 1); | ||
| 952 | + return (void *)a; | ||
| 953 | +} | ||
| 954 | + | ||
| 955 | +static inline int testandset (spinlock_t *p) | ||
| 956 | +{ | ||
| 957 | + unsigned int ret; | ||
| 958 | + p = ldcw_align(p); | ||
| 959 | + __asm__ __volatile__("ldcw 0(%1),%0" | ||
| 960 | + : "=r" (ret) | ||
| 961 | + : "r" (p) | ||
| 962 | + : "memory" ); | ||
| 963 | + return !ret; | ||
| 964 | +} | ||
| 965 | +#endif | ||
| 966 | + | ||
| 967 | +#ifdef __ia64 | ||
| 968 | +#include <ia64intrin.h> | ||
| 969 | + | ||
| 970 | +static inline int testandset (int *p) | ||
| 971 | +{ | ||
| 972 | + return __sync_lock_test_and_set (p, 1); | ||
| 973 | +} | ||
| 974 | +#endif | ||
| 975 | + | ||
| 976 | +#ifdef __mips__ | ||
| 977 | +static inline int testandset (int *p) | ||
| 978 | +{ | ||
| 979 | + int ret; | ||
| 980 | + | ||
| 981 | + __asm__ __volatile__ ( | ||
| 982 | + " .set push \n" | ||
| 983 | + " .set noat \n" | ||
| 984 | + " .set mips2 \n" | ||
| 985 | + "1: li $1, 1 \n" | ||
| 986 | + " ll %0, %1 \n" | ||
| 987 | + " sc $1, %1 \n" | ||
| 988 | + " beqz $1, 1b \n" | ||
| 989 | + " .set pop " | ||
| 990 | + : "=r" (ret), "+R" (*p) | ||
| 991 | + : | ||
| 992 | + : "memory"); | ||
| 993 | + | ||
| 994 | + return ret; | ||
| 995 | +} | ||
| 996 | +#endif | ||
| 997 | + | ||
| 998 | +#if defined(__hppa__) | ||
| 999 | + | ||
| 1000 | +typedef int spinlock_t[4]; | ||
| 1001 | + | ||
| 1002 | +#define SPIN_LOCK_UNLOCKED { 1, 1, 1, 1 } | ||
| 1003 | + | ||
| 1004 | +static inline void resetlock (spinlock_t *p) | ||
| 1005 | +{ | ||
| 1006 | + (*p)[0] = (*p)[1] = (*p)[2] = (*p)[3] = 1; | ||
| 1007 | +} | ||
| 1008 | + | ||
| 1009 | +#else | ||
| 1010 | + | ||
| 1011 | +typedef int spinlock_t; | ||
| 1012 | + | ||
| 1013 | +#define SPIN_LOCK_UNLOCKED 0 | ||
| 1014 | + | ||
| 1015 | +static inline void resetlock (spinlock_t *p) | ||
| 1016 | +{ | ||
| 1017 | + *p = SPIN_LOCK_UNLOCKED; | ||
| 1018 | +} | ||
| 1019 | + | ||
| 1020 | +#endif | ||
| 1021 | + | ||
| 1022 | +#if defined(CONFIG_USER_ONLY) | ||
| 1023 | +static inline void spin_lock(spinlock_t *lock) | ||
| 1024 | +{ | ||
| 1025 | + while (testandset(lock)); | ||
| 1026 | +} | ||
| 1027 | + | ||
| 1028 | +static inline void spin_unlock(spinlock_t *lock) | ||
| 1029 | +{ | ||
| 1030 | + resetlock(lock); | ||
| 1031 | +} | ||
| 1032 | + | ||
| 1033 | +static inline int spin_trylock(spinlock_t *lock) | ||
| 1034 | +{ | ||
| 1035 | + return !testandset(lock); | ||
| 1036 | +} | ||
| 1037 | +#else | ||
| 1038 | +static inline void spin_lock(spinlock_t *lock) | ||
| 1039 | +{ | ||
| 1040 | +} | ||
| 1041 | + | ||
| 1042 | +static inline void spin_unlock(spinlock_t *lock) | ||
| 1043 | +{ | ||
| 1044 | +} | ||
| 1045 | + | ||
| 1046 | +static inline int spin_trylock(spinlock_t *lock) | ||
| 1047 | +{ | ||
| 1048 | + return 1; | ||
| 1049 | +} | ||
| 1050 | +#endif | ||
| 1051 | + | ||
| 1052 | +#endif | ||
| 1053 | Index: trunk/target-arm/cpu.h | ||
| 1054 | =================================================================== | ||
| 1055 | --- trunk.orig/target-arm/cpu.h 2008-04-24 20:16:41.000000000 +0100 | ||
| 1056 | +++ trunk/target-arm/cpu.h 2008-04-24 20:16:53.000000000 +0100 | ||
| 1057 | @@ -38,6 +38,7 @@ | ||
| 1058 | #define EXCP_FIQ 6 | ||
| 1059 | #define EXCP_BKPT 7 | ||
| 1060 | #define EXCP_EXCEPTION_EXIT 8 /* Return from v7M exception. */ | ||
| 1061 | +#define EXCP_KERNEL_TRAP 9 /* Jumped to kernel code page. */ | ||
| 1062 | |||
| 1063 | #define ARMV7M_EXCP_RESET 1 | ||
| 1064 | #define ARMV7M_EXCP_NMI 2 | ||
| 1065 | @@ -218,6 +219,15 @@ | ||
| 1066 | void cpu_lock(void); | ||
| 1067 | void cpu_unlock(void); | ||
| 1068 | |||
| 1069 | +void cpu_lock(void); | ||
| 1070 | +void cpu_unlock(void); | ||
| 1071 | +#if defined(USE_NPTL) | ||
| 1072 | +static inline void cpu_set_tls(CPUARMState *env, void *newtls) | ||
| 1073 | +{ | ||
| 1074 | + env->cp15.c13_tls2 = (uint32_t)(long)newtls; | ||
| 1075 | +} | ||
| 1076 | +#endif | ||
| 1077 | + | ||
| 1078 | #define CPSR_M (0x1f) | ||
| 1079 | #define CPSR_T (1 << 5) | ||
| 1080 | #define CPSR_F (1 << 6) | ||
| 1081 | Index: trunk/target-arm/translate.c | ||
| 1082 | =================================================================== | ||
| 1083 | --- trunk.orig/target-arm/translate.c 2008-04-24 20:16:41.000000000 +0100 | ||
| 1084 | +++ trunk/target-arm/translate.c 2008-04-24 20:16:53.000000000 +0100 | ||
| 1085 | @@ -8606,7 +8606,14 @@ | ||
| 1086 | gen_exception(EXCP_EXCEPTION_EXIT); | ||
| 1087 | } | ||
| 1088 | #endif | ||
| 1089 | - | ||
| 1090 | +#ifdef CONFIG_USER_ONLY | ||
| 1091 | + /* Intercept jump to the magic kernel page. */ | ||
| 1092 | + if (dc->pc > 0xffff0000) { | ||
| 1093 | + gen_exception(EXCP_KERNEL_TRAP); | ||
| 1094 | + dc->is_jmp = DISAS_UPDATE; | ||
| 1095 | + break; | ||
| 1096 | + } | ||
| 1097 | +#endif | ||
| 1098 | if (env->nb_breakpoints > 0) { | ||
| 1099 | for(j = 0; j < env->nb_breakpoints; j++) { | ||
| 1100 | if (env->breakpoints[j] == dc->pc) { | ||
diff --git a/meta/packages/qemu/qemu-0.9.1+svn/qemu-amd64-32b-mapping-0.9.0.patch b/meta/packages/qemu/qemu-0.9.1+svn/qemu-amd64-32b-mapping-0.9.0.patch deleted file mode 100644 index 02f093abb9..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/qemu-amd64-32b-mapping-0.9.0.patch +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | --- | ||
| 2 | linux-user/mmap.c | 8 ++++++-- | ||
| 3 | 1 file changed, 6 insertions(+), 2 deletions(-) | ||
| 4 | |||
| 5 | Index: trunk/linux-user/mmap.c | ||
| 6 | =================================================================== | ||
| 7 | --- trunk.orig/linux-user/mmap.c 2008-04-24 20:15:37.000000000 +0100 | ||
| 8 | +++ trunk/linux-user/mmap.c 2008-04-24 20:16:16.000000000 +0100 | ||
| 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 @@ | ||
| 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 @@ | ||
| 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+svn/qemu-n800-support.patch b/meta/packages/qemu/qemu-0.9.1+svn/qemu-n800-support.patch deleted file mode 100644 index 1224fb4cbd..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/qemu-n800-support.patch +++ /dev/null | |||
| @@ -1,2381 +0,0 @@ | |||
| 1 | diff -urN 4242/cpu-all.h qemu-omap/cpu-all.h | ||
| 2 | --- 4242/cpu-all.h 2008-04-24 21:26:19.000000000 +0100 | ||
| 3 | +++ qemu-omap/cpu-all.h 2008-04-23 09:57:55.000000000 +0100 | ||
| 4 | @@ -816,7 +816,7 @@ | ||
| 5 | /* physical memory access */ | ||
| 6 | #define TLB_INVALID_MASK (1 << 3) | ||
| 7 | #define IO_MEM_SHIFT 4 | ||
| 8 | -#define IO_MEM_NB_ENTRIES (1 << (TARGET_PAGE_BITS - IO_MEM_SHIFT)) | ||
| 9 | +#define IO_MEM_NB_ENTRIES (16 << (TARGET_PAGE_BITS - IO_MEM_SHIFT)) | ||
| 10 | |||
| 11 | #define IO_MEM_RAM (0 << IO_MEM_SHIFT) /* hardcoded offset */ | ||
| 12 | #define IO_MEM_ROM (1 << IO_MEM_SHIFT) /* hardcoded offset */ | ||
| 13 | diff -urN 4242/exec.c qemu-omap/exec.c | ||
| 14 | --- 4242/exec.c 2008-04-24 18:11:49.000000000 +0100 | ||
| 15 | +++ qemu-omap/exec.c 2008-04-23 09:57:55.000000000 +0100 | ||
| 16 | @@ -1664,7 +1664,7 @@ | ||
| 17 | { | ||
| 18 | if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && !(pd & IO_MEM_ROMD)) { | ||
| 19 | /* IO memory case */ | ||
| 20 | - address = vaddr | pd; | ||
| 21 | + address = vaddr | (pd & ~TARGET_PAGE_MASK); | ||
| 22 | addend = paddr; | ||
| 23 | } else { | ||
| 24 | /* standard memory */ | ||
| 25 | @@ -1698,7 +1698,9 @@ | ||
| 26 | } else { | ||
| 27 | te->addr_read = -1; | ||
| 28 | } | ||
| 29 | - if (prot & PAGE_EXEC) { | ||
| 30 | + if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && !(pd & IO_MEM_ROMD)) { | ||
| 31 | + te->addr_code = pd; | ||
| 32 | + } else if (prot & PAGE_EXEC) { | ||
| 33 | te->addr_code = address; | ||
| 34 | } else { | ||
| 35 | te->addr_code = -1; | ||
| 36 | @@ -2493,7 +2495,9 @@ | ||
| 37 | if (io_index <= 0) { | ||
| 38 | if (io_mem_nb >= IO_MEM_NB_ENTRIES) | ||
| 39 | return -1; | ||
| 40 | - io_index = io_mem_nb++; | ||
| 41 | + do io_index = io_mem_nb++; | ||
| 42 | + while (((io_index << IO_MEM_SHIFT) & ~TARGET_PAGE_MASK) | ||
| 43 | + <= IO_MEM_NOTDIRTY); | ||
| 44 | } else { | ||
| 45 | if (io_index >= IO_MEM_NB_ENTRIES) | ||
| 46 | return -1; | ||
| 47 | diff -urN 4242/hw/max7310.c qemu-omap/hw/max7310.c | ||
| 48 | --- 4242/hw/max7310.c 2008-04-24 18:11:49.000000000 +0100 | ||
| 49 | +++ qemu-omap/hw/max7310.c 2008-03-02 19:31:55.000000000 +0000 | ||
| 50 | @@ -134,8 +134,8 @@ | ||
| 51 | s->i2c_command_byte = 1; | ||
| 52 | break; | ||
| 53 | case I2C_FINISH: | ||
| 54 | - if (s->len == 1) | ||
| 55 | #ifdef VERBOSE | ||
| 56 | + if (s->len == 1) | ||
| 57 | printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->len); | ||
| 58 | #endif | ||
| 59 | break; | ||
| 60 | diff -urN 4242/hw/ndis.h qemu-omap/hw/ndis.h | ||
| 61 | --- 4242/hw/ndis.h 1970-01-01 01:00:00.000000000 +0100 | ||
| 62 | +++ qemu-omap/hw/ndis.h 2008-04-23 09:57:56.000000000 +0100 | ||
| 63 | @@ -0,0 +1,217 @@ | ||
| 64 | +/* | ||
| 65 | + * ndis.h | ||
| 66 | + * | ||
| 67 | + * ntddndis.h modified by Benedikt Spranger <b.spranger@pengutronix.de> | ||
| 68 | + * | ||
| 69 | + * Thanks to the cygwin development team, | ||
| 70 | + * espacially to Casper S. Hornstrup <chorns@users.sourceforge.net> | ||
| 71 | + * | ||
| 72 | + * THIS SOFTWARE IS NOT COPYRIGHTED | ||
| 73 | + * | ||
| 74 | + * This source code is offered for use in the public domain. You may | ||
| 75 | + * use, modify or distribute it freely. | ||
| 76 | + * | ||
| 77 | + * This code is distributed in the hope that it will be useful but | ||
| 78 | + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY | ||
| 79 | + * DISCLAIMED. This includes but is not limited to warranties of | ||
| 80 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 81 | + * | ||
| 82 | + */ | ||
| 83 | + | ||
| 84 | +#ifndef _LINUX_NDIS_H | ||
| 85 | +#define _LINUX_NDIS_H | ||
| 86 | + | ||
| 87 | + | ||
| 88 | +#define NDIS_STATUS_MULTICAST_FULL 0xC0010009 | ||
| 89 | +#define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A | ||
| 90 | +#define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B | ||
| 91 | + | ||
| 92 | +enum NDIS_DEVICE_POWER_STATE { | ||
| 93 | + NdisDeviceStateUnspecified = 0, | ||
| 94 | + NdisDeviceStateD0, | ||
| 95 | + NdisDeviceStateD1, | ||
| 96 | + NdisDeviceStateD2, | ||
| 97 | + NdisDeviceStateD3, | ||
| 98 | + NdisDeviceStateMaximum | ||
| 99 | +}; | ||
| 100 | + | ||
| 101 | +struct NDIS_PM_WAKE_UP_CAPABILITIES { | ||
| 102 | + enum NDIS_DEVICE_POWER_STATE MinMagicPacketWakeUp; | ||
| 103 | + enum NDIS_DEVICE_POWER_STATE MinPatternWakeUp; | ||
| 104 | + enum NDIS_DEVICE_POWER_STATE MinLinkChangeWakeUp; | ||
| 105 | +}; | ||
| 106 | + | ||
| 107 | +/* NDIS_PNP_CAPABILITIES.Flags constants */ | ||
| 108 | +#define NDIS_DEVICE_WAKE_UP_ENABLE 0x00000001 | ||
| 109 | +#define NDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002 | ||
| 110 | +#define NDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004 | ||
| 111 | + | ||
| 112 | +struct NDIS_PNP_CAPABILITIES { | ||
| 113 | + __le32 Flags; | ||
| 114 | + struct NDIS_PM_WAKE_UP_CAPABILITIES WakeUpCapabilities; | ||
| 115 | +}; | ||
| 116 | + | ||
| 117 | +struct NDIS_PM_PACKET_PATTERN { | ||
| 118 | + __le32 Priority; | ||
| 119 | + __le32 Reserved; | ||
| 120 | + __le32 MaskSize; | ||
| 121 | + __le32 PatternOffset; | ||
| 122 | + __le32 PatternSize; | ||
| 123 | + __le32 PatternFlags; | ||
| 124 | +}; | ||
| 125 | + | ||
| 126 | + | ||
| 127 | +/* Required Object IDs (OIDs) */ | ||
| 128 | +#define OID_GEN_SUPPORTED_LIST 0x00010101 | ||
| 129 | +#define OID_GEN_HARDWARE_STATUS 0x00010102 | ||
| 130 | +#define OID_GEN_MEDIA_SUPPORTED 0x00010103 | ||
| 131 | +#define OID_GEN_MEDIA_IN_USE 0x00010104 | ||
| 132 | +#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 | ||
| 133 | +#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 | ||
| 134 | +#define OID_GEN_LINK_SPEED 0x00010107 | ||
| 135 | +#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 | ||
| 136 | +#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 | ||
| 137 | +#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A | ||
| 138 | +#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B | ||
| 139 | +#define OID_GEN_VENDOR_ID 0x0001010C | ||
| 140 | +#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D | ||
| 141 | +#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E | ||
| 142 | +#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F | ||
| 143 | +#define OID_GEN_DRIVER_VERSION 0x00010110 | ||
| 144 | +#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 | ||
| 145 | +#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 | ||
| 146 | +#define OID_GEN_MAC_OPTIONS 0x00010113 | ||
| 147 | +#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 | ||
| 148 | +#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 | ||
| 149 | +#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 | ||
| 150 | +#define OID_GEN_SUPPORTED_GUIDS 0x00010117 | ||
| 151 | +#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118 | ||
| 152 | +#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119 | ||
| 153 | +#define OID_GEN_MACHINE_NAME 0x0001021A | ||
| 154 | +#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B | ||
| 155 | +#define OID_GEN_VLAN_ID 0x0001021C | ||
| 156 | + | ||
| 157 | +/* Optional OIDs */ | ||
| 158 | +#define OID_GEN_MEDIA_CAPABILITIES 0x00010201 | ||
| 159 | +#define OID_GEN_PHYSICAL_MEDIUM 0x00010202 | ||
| 160 | + | ||
| 161 | +/* Required statistics OIDs */ | ||
| 162 | +#define OID_GEN_XMIT_OK 0x00020101 | ||
| 163 | +#define OID_GEN_RCV_OK 0x00020102 | ||
| 164 | +#define OID_GEN_XMIT_ERROR 0x00020103 | ||
| 165 | +#define OID_GEN_RCV_ERROR 0x00020104 | ||
| 166 | +#define OID_GEN_RCV_NO_BUFFER 0x00020105 | ||
| 167 | + | ||
| 168 | +/* Optional statistics OIDs */ | ||
| 169 | +#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 | ||
| 170 | +#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 | ||
| 171 | +#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 | ||
| 172 | +#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 | ||
| 173 | +#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 | ||
| 174 | +#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 | ||
| 175 | +#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 | ||
| 176 | +#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 | ||
| 177 | +#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 | ||
| 178 | +#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A | ||
| 179 | +#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B | ||
| 180 | +#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C | ||
| 181 | +#define OID_GEN_RCV_CRC_ERROR 0x0002020D | ||
| 182 | +#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E | ||
| 183 | +#define OID_GEN_GET_TIME_CAPS 0x0002020F | ||
| 184 | +#define OID_GEN_GET_NETCARD_TIME 0x00020210 | ||
| 185 | +#define OID_GEN_NETCARD_LOAD 0x00020211 | ||
| 186 | +#define OID_GEN_DEVICE_PROFILE 0x00020212 | ||
| 187 | +#define OID_GEN_INIT_TIME_MS 0x00020213 | ||
| 188 | +#define OID_GEN_RESET_COUNTS 0x00020214 | ||
| 189 | +#define OID_GEN_MEDIA_SENSE_COUNTS 0x00020215 | ||
| 190 | +#define OID_GEN_FRIENDLY_NAME 0x00020216 | ||
| 191 | +#define OID_GEN_MINIPORT_INFO 0x00020217 | ||
| 192 | +#define OID_GEN_RESET_VERIFY_PARAMETERS 0x00020218 | ||
| 193 | + | ||
| 194 | +/* IEEE 802.3 (Ethernet) OIDs */ | ||
| 195 | +#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 | ||
| 196 | + | ||
| 197 | +#define OID_802_3_PERMANENT_ADDRESS 0x01010101 | ||
| 198 | +#define OID_802_3_CURRENT_ADDRESS 0x01010102 | ||
| 199 | +#define OID_802_3_MULTICAST_LIST 0x01010103 | ||
| 200 | +#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 | ||
| 201 | +#define OID_802_3_MAC_OPTIONS 0x01010105 | ||
| 202 | +#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 | ||
| 203 | +#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 | ||
| 204 | +#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 | ||
| 205 | +#define OID_802_3_XMIT_DEFERRED 0x01020201 | ||
| 206 | +#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 | ||
| 207 | +#define OID_802_3_RCV_OVERRUN 0x01020203 | ||
| 208 | +#define OID_802_3_XMIT_UNDERRUN 0x01020204 | ||
| 209 | +#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 | ||
| 210 | +#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 | ||
| 211 | +#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 | ||
| 212 | + | ||
| 213 | +/* OID_GEN_MINIPORT_INFO constants */ | ||
| 214 | +#define NDIS_MINIPORT_BUS_MASTER 0x00000001 | ||
| 215 | +#define NDIS_MINIPORT_WDM_DRIVER 0x00000002 | ||
| 216 | +#define NDIS_MINIPORT_SG_LIST 0x00000004 | ||
| 217 | +#define NDIS_MINIPORT_SUPPORTS_MEDIA_QUERY 0x00000008 | ||
| 218 | +#define NDIS_MINIPORT_INDICATES_PACKETS 0x00000010 | ||
| 219 | +#define NDIS_MINIPORT_IGNORE_PACKET_QUEUE 0x00000020 | ||
| 220 | +#define NDIS_MINIPORT_IGNORE_REQUEST_QUEUE 0x00000040 | ||
| 221 | +#define NDIS_MINIPORT_IGNORE_TOKEN_RING_ERRORS 0x00000080 | ||
| 222 | +#define NDIS_MINIPORT_INTERMEDIATE_DRIVER 0x00000100 | ||
| 223 | +#define NDIS_MINIPORT_IS_NDIS_5 0x00000200 | ||
| 224 | +#define NDIS_MINIPORT_IS_CO 0x00000400 | ||
| 225 | +#define NDIS_MINIPORT_DESERIALIZE 0x00000800 | ||
| 226 | +#define NDIS_MINIPORT_REQUIRES_MEDIA_POLLING 0x00001000 | ||
| 227 | +#define NDIS_MINIPORT_SUPPORTS_MEDIA_SENSE 0x00002000 | ||
| 228 | +#define NDIS_MINIPORT_NETBOOT_CARD 0x00004000 | ||
| 229 | +#define NDIS_MINIPORT_PM_SUPPORTED 0x00008000 | ||
| 230 | +#define NDIS_MINIPORT_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00010000 | ||
| 231 | +#define NDIS_MINIPORT_USES_SAFE_BUFFER_APIS 0x00020000 | ||
| 232 | +#define NDIS_MINIPORT_HIDDEN 0x00040000 | ||
| 233 | +#define NDIS_MINIPORT_SWENUM 0x00080000 | ||
| 234 | +#define NDIS_MINIPORT_SURPRISE_REMOVE_OK 0x00100000 | ||
| 235 | +#define NDIS_MINIPORT_NO_HALT_ON_SUSPEND 0x00200000 | ||
| 236 | +#define NDIS_MINIPORT_HARDWARE_DEVICE 0x00400000 | ||
| 237 | +#define NDIS_MINIPORT_SUPPORTS_CANCEL_SEND_PACKETS 0x00800000 | ||
| 238 | +#define NDIS_MINIPORT_64BITS_DMA 0x01000000 | ||
| 239 | + | ||
| 240 | +#define NDIS_MEDIUM_802_3 0x00000000 | ||
| 241 | +#define NDIS_MEDIUM_802_5 0x00000001 | ||
| 242 | +#define NDIS_MEDIUM_FDDI 0x00000002 | ||
| 243 | +#define NDIS_MEDIUM_WAN 0x00000003 | ||
| 244 | +#define NDIS_MEDIUM_LOCAL_TALK 0x00000004 | ||
| 245 | +#define NDIS_MEDIUM_DIX 0x00000005 | ||
| 246 | +#define NDIS_MEDIUM_ARCENT_RAW 0x00000006 | ||
| 247 | +#define NDIS_MEDIUM_ARCENT_878_2 0x00000007 | ||
| 248 | +#define NDIS_MEDIUM_ATM 0x00000008 | ||
| 249 | +#define NDIS_MEDIUM_WIRELESS_LAN 0x00000009 | ||
| 250 | +#define NDIS_MEDIUM_IRDA 0x0000000A | ||
| 251 | +#define NDIS_MEDIUM_BPC 0x0000000B | ||
| 252 | +#define NDIS_MEDIUM_CO_WAN 0x0000000C | ||
| 253 | +#define NDIS_MEDIUM_1394 0x0000000D | ||
| 254 | + | ||
| 255 | +#define NDIS_PACKET_TYPE_DIRECTED 0x00000001 | ||
| 256 | +#define NDIS_PACKET_TYPE_MULTICAST 0x00000002 | ||
| 257 | +#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 | ||
| 258 | +#define NDIS_PACKET_TYPE_BROADCAST 0x00000008 | ||
| 259 | +#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 | ||
| 260 | +#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 | ||
| 261 | +#define NDIS_PACKET_TYPE_SMT 0x00000040 | ||
| 262 | +#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 | ||
| 263 | +#define NDIS_PACKET_TYPE_GROUP 0x00000100 | ||
| 264 | +#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200 | ||
| 265 | +#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400 | ||
| 266 | +#define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800 | ||
| 267 | + | ||
| 268 | +#define NDIS_MEDIA_STATE_CONNECTED 0x00000000 | ||
| 269 | +#define NDIS_MEDIA_STATE_DISCONNECTED 0x00000001 | ||
| 270 | + | ||
| 271 | +#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 | ||
| 272 | +#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 | ||
| 273 | +#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 | ||
| 274 | +#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 | ||
| 275 | +#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 | ||
| 276 | +#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 | ||
| 277 | +#define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040 | ||
| 278 | +#define NDIS_MAC_OPTION_RESERVED 0x80000000 | ||
| 279 | + | ||
| 280 | +#endif /* _LINUX_NDIS_H */ | ||
| 281 | diff -urN 4242/hw/nseries.c qemu-omap/hw/nseries.c | ||
| 282 | --- 4242/hw/nseries.c 2008-04-24 18:11:49.000000000 +0100 | ||
| 283 | +++ qemu-omap/hw/nseries.c 2008-04-23 09:57:56.000000000 +0100 | ||
| 284 | @@ -602,6 +602,37 @@ | ||
| 285 | (void *) &config7, sizeof(config7)); | ||
| 286 | } | ||
| 287 | |||
| 288 | +#if 0 | ||
| 289 | +static uint32_t n800_pinout[104] = { | ||
| 290 | + 0x080f00d8, 0x00d40808, 0x03080808, 0x080800d0, | ||
| 291 | + 0x00dc0808, 0x0b0f0f00, 0x080800b4, 0x00c00808, | ||
| 292 | + 0x08080808, 0x180800c4, 0x00b80000, 0x08080808, | ||
| 293 | + 0x080800bc, 0x00cc0808, 0x08081818, 0x18180128, | ||
| 294 | + 0x01241800, 0x18181818, 0x000000f0, 0x01300000, | ||
| 295 | + 0x00001b0b, 0x1b0f0138, 0x00e0181b, 0x1b031b0b, | ||
| 296 | + 0x180f0078, 0x00740018, 0x0f0f0f1a, 0x00000080, | ||
| 297 | + 0x007c0000, 0x00000000, 0x00000088, 0x00840000, | ||
| 298 | + 0x00000000, 0x00000094, 0x00980300, 0x0f180003, | ||
| 299 | + 0x0000008c, 0x00900f0f, 0x0f0f1b00, 0x0f00009c, | ||
| 300 | + 0x01140000, 0x1b1b0f18, 0x0818013c, 0x01400008, | ||
| 301 | + 0x00001818, 0x000b0110, 0x010c1800, 0x0b030b0f, | ||
| 302 | + 0x181800f4, 0x00f81818, 0x00000018, 0x000000fc, | ||
| 303 | + 0x00401808, 0x00000000, 0x0f1b0030, 0x003c0008, | ||
| 304 | + 0x00000000, 0x00000038, 0x00340000, 0x00000000, | ||
| 305 | + 0x1a080070, 0x00641a1a, 0x08080808, 0x08080060, | ||
| 306 | + 0x005c0808, 0x08080808, 0x08080058, 0x00540808, | ||
| 307 | + 0x08080808, 0x0808006c, 0x00680808, 0x08080808, | ||
| 308 | + 0x000000a8, 0x00b00000, 0x08080808, 0x000000a0, | ||
| 309 | + 0x00a40000, 0x00000000, 0x08ff0050, 0x004c0808, | ||
| 310 | + 0xffffffff, 0xffff0048, 0x0044ffff, 0xffffffff, | ||
| 311 | + 0x000000ac, 0x01040800, 0x08080b0f, 0x18180100, | ||
| 312 | + 0x01081818, 0x0b0b1808, 0x1a0300e4, 0x012c0b1a, | ||
| 313 | + 0x02020018, 0x0b000134, 0x011c0800, 0x0b1b1b00, | ||
| 314 | + 0x0f0000c8, 0x00ec181b, 0x000f0f02, 0x00180118, | ||
| 315 | + 0x01200000, 0x0f0b1b1b, 0x0f0200e8, 0x0000020b, | ||
| 316 | +}; | ||
| 317 | +#endif | ||
| 318 | + | ||
| 319 | /* Setup sequence done by the bootloader */ | ||
| 320 | static void n800_boot_init(void *opaque) | ||
| 321 | { | ||
| 322 | @@ -942,3 +973,71 @@ | ||
| 323 | "Nokia N800 aka. RX-34 tablet (OMAP2420)", | ||
| 324 | n800_init, | ||
| 325 | }; | ||
| 326 | + | ||
| 327 | +#if 0 | ||
| 328 | +/* cx3110x.c */ | ||
| 329 | +#define CY_ARM_INT 0x00 | ||
| 330 | +#define CY_ARM_INT_ENA 0x00 | ||
| 331 | +#define CY_HOST_INT 0x00 | ||
| 332 | +#define CY_HOST_INT_ENA 0x00 | ||
| 333 | +#define CY_HOST_INT_ACK 0x00 | ||
| 334 | +#define CY_GP1_COMM 0x00 | ||
| 335 | +#define CY_GP2_COMM 0x00 | ||
| 336 | +#define CY_DEV_CTRL_STA 0x00 | ||
| 337 | +#define CY_DMA_DATA 0x00 /* 16-bit */ | ||
| 338 | +#define CY_DMA_WR_CTRL 0x00 /* 16-bit */ | ||
| 339 | +#define CY_DMA_WR_LEN 0x00 /* 16-bit */ | ||
| 340 | +#define CY_DMA_WR_BASE 0x00 | ||
| 341 | +#define CY_DMA_RD_CTRL 0x00 /* 16-bit */ | ||
| 342 | +#define CY_DMA_RD_LEN 0x00 /* 16-bit */ | ||
| 343 | +#define CY_DMA_RD_BASE 0x00 | ||
| 344 | + | ||
| 345 | +HW: | ||
| 346 | +(spi bus 1.0) | ||
| 347 | + tsc2005 | ||
| 348 | +(spi bus 1.1) | ||
| 349 | + lcd_mipid | ||
| 350 | +(spi bus 2.0) | ||
| 351 | + cx3110x (WLAN) | ||
| 352 | +(spi somewhere?) | ||
| 353 | + pc2400m (WiMAX) | ||
| 354 | +(i2c bus 0) | ||
| 355 | + TLV320AIC33 (audio codec on i2c) | ||
| 356 | + TCM825x (camera on i2c) | ||
| 357 | + lp5521 (LED on i2c) | ||
| 358 | + tsl2563 (light sensor, hwmon on i2c) | ||
| 359 | + lm8323 (keypad on i2c) | ||
| 360 | +(i2c bus 1) | ||
| 361 | + tmp105 (temperature sensor, hwmon on i2c) | ||
| 362 | + menelaus (power on i2c) | ||
| 363 | + | ||
| 364 | +GPIO 0: out hi | ||
| 365 | +GPIO 8: in hi | ||
| 366 | +GPIO 9: out hi | ||
| 367 | +GPIO 10: out lo | ||
| 368 | +GPIO 12: out lo | ||
| 369 | +GPIO 15: out lo | ||
| 370 | +GPIO 23: out hi | ||
| 371 | +GPIO 26: in hi, irq-186 rising | ||
| 372 | +GPIO 53: out lo | ||
| 373 | +GPIO 58: in hi, irq-218 low wakeup | ||
| 374 | +GPIO 62: out lo | ||
| 375 | +GPIO 64: out hi | ||
| 376 | +GPIO 65: in hi | ||
| 377 | +GPIO 66: out lo | ||
| 378 | +GPIO 93: out lo | ||
| 379 | +GPIO 94: in hi | ||
| 380 | +GPIO 95: out lo | ||
| 381 | +GPIO 96: out hi | ||
| 382 | +GPIO 101: out lo | ||
| 383 | +GPIO 102: in hi, irq-262 bothedge | ||
| 384 | +GPIO 106: in hi, irq-266 falling wakeup | ||
| 385 | +GPIO 107: in hi, irq-267 bothedge | ||
| 386 | +GPIO 108: in lo, irq-268 rising wakeup | ||
| 387 | +GPIO 109: in hi, irq-269 falling wakeup | ||
| 388 | +GPIO 110: in hi, irq-270 bothedge | ||
| 389 | +GPIO 111: in lo, irq-271 rising | ||
| 390 | +GPIO 112: out hi | ||
| 391 | +GPIO 118: out hi | ||
| 392 | +GPIO 125: in lo, irq-285 rising | ||
| 393 | +#endif | ||
| 394 | diff -urN 4242/hw/omap2.c qemu-omap/hw/omap2.c | ||
| 395 | --- 4242/hw/omap2.c 2008-04-24 18:11:49.000000000 +0100 | ||
| 396 | +++ qemu-omap/hw/omap2.c 2008-04-23 09:57:56.000000000 +0100 | ||
| 397 | @@ -3675,152 +3675,152 @@ | ||
| 398 | omap_findclk(s, "dss_l4_iclk")); | ||
| 399 | |||
| 400 | /* All register mappings (includin those not currenlty implemented): | ||
| 401 | - * SystemControlMod 48000000 - 48000fff | ||
| 402 | - * SystemControlL4 48001000 - 48001fff | ||
| 403 | - * 32kHz Timer Mod 48004000 - 48004fff | ||
| 404 | - * 32kHz Timer L4 48005000 - 48005fff | ||
| 405 | - * PRCM ModA 48008000 - 480087ff | ||
| 406 | + * SystemControlMod 48000000 - 48000fff (REV 0x00000010) | ||
| 407 | + * SystemControlL4 48001000 - 48001fff (0x00200010, 0x01000200, 0x00000000) | ||
| 408 | + * 32kHz Timer Mod 48004000 - 48004fff (REV 0x00000011) | ||
| 409 | + * 32kHz Timer L4 48005000 - 48005fff (0x00200010, 0x01000200, 0x00000000) | ||
| 410 | + * PRCM ModA 48008000 - 480087ff (REV 0x00000010) | ||
| 411 | * PRCM ModB 48008800 - 48008fff | ||
| 412 | - * PRCM L4 48009000 - 48009fff | ||
| 413 | - * TEST-BCM Mod 48012000 - 48012fff | ||
| 414 | - * TEST-BCM L4 48013000 - 48013fff | ||
| 415 | - * TEST-TAP Mod 48014000 - 48014fff | ||
| 416 | - * TEST-TAP L4 48015000 - 48015fff | ||
| 417 | - * GPIO1 Mod 48018000 - 48018fff | ||
| 418 | - * GPIO Top 48019000 - 48019fff | ||
| 419 | - * GPIO2 Mod 4801a000 - 4801afff | ||
| 420 | - * GPIO L4 4801b000 - 4801bfff | ||
| 421 | - * GPIO3 Mod 4801c000 - 4801cfff | ||
| 422 | - * GPIO4 Mod 4801e000 - 4801efff | ||
| 423 | - * WDTIMER1 Mod 48020000 - 48010fff | ||
| 424 | + * PRCM L4 48009000 - 48009fff (0x00200010, 0x00000200, 0x00000000) | ||
| 425 | + * TEST-BCM Mod 48012000 - 48012fff (REV 0x00000010) | ||
| 426 | + * TEST-BCM L4 48013000 - 48013fff (0x00200010, 0x00000200, 0x00000000) | ||
| 427 | + * TEST-TAP Mod 48014000 - 48014fff (REV 0x00000010) | ||
| 428 | + * TEST-TAP L4 48015000 - 48015fff (0x00200010, 0x00000200, 0x00000000) | ||
| 429 | + * GPIO1 Mod 48018000 - 48018fff (REV 0x00000018) | ||
| 430 | + * GPIO Top 48019000 - 48019fff (REV 0x00000011) | ||
| 431 | + * GPIO2 Mod 4801a000 - 4801afff (REV 0x00000018) | ||
| 432 | + * GPIO L4 4801b000 - 4801bfff (0x00200010, 0x00000200, 0x00000000) | ||
| 433 | + * GPIO3 Mod 4801c000 - 4801cfff (REV 0x00000018) | ||
| 434 | + * GPIO4 Mod 4801e000 - 4801efff (REV 0x00000018) | ||
| 435 | + * WDTIMER1 Mod 48020000 - 48010fff (REV Abort) | ||
| 436 | * WDTIMER Top 48021000 - 48011fff | ||
| 437 | - * WDTIMER2 Mod 48022000 - 48012fff | ||
| 438 | - * WDTIMER L4 48023000 - 48013fff | ||
| 439 | - * WDTIMER3 Mod 48024000 - 48014fff | ||
| 440 | - * WDTIMER3 L4 48025000 - 48015fff | ||
| 441 | - * WDTIMER4 Mod 48026000 - 48016fff | ||
| 442 | - * WDTIMER4 L4 48027000 - 48017fff | ||
| 443 | - * GPTIMER1 Mod 48028000 - 48018fff | ||
| 444 | - * GPTIMER1 L4 48029000 - 48019fff | ||
| 445 | - * GPTIMER2 Mod 4802a000 - 4801afff | ||
| 446 | - * GPTIMER2 L4 4802b000 - 4801bfff | ||
| 447 | + * WDTIMER2 Mod 48022000 - 48012fff (REV 0x00000011) | ||
| 448 | + * WDTIMER L4 48023000 - 48013fff (0x00200010, 0x00000200, 0x00000000) | ||
| 449 | + * WDTIMER3 Mod 48024000 - 48014fff (REV 0x00000011) | ||
| 450 | + * WDTIMER3 L4 48025000 - 48015fff (0x00200010, 0x00000200, 0x00000000) | ||
| 451 | + * WDTIMER4 Mod 48026000 - 48016fff (REV 0x00000011) | ||
| 452 | + * WDTIMER4 L4 48027000 - 48017fff (0x00200010, 0x00000200, 0x00000000) | ||
| 453 | + * GPTIMER1 Mod 48028000 - 48018fff (REV 0x00000013) | ||
| 454 | + * GPTIMER1 L4 48029000 - 48019fff (0x00200010, 0x00000200, 0x00000000) | ||
| 455 | + * GPTIMER2 Mod 4802a000 - 4801afff (REV Abort) | ||
| 456 | + * GPTIMER2 L4 4802b000 - 4801bfff (0x00200010, 0x00000200, 0x00000000) | ||
| 457 | * L4-Config AP 48040000 - 480407ff | ||
| 458 | * L4-Config IP 48040800 - 48040fff | ||
| 459 | * L4-Config LA 48041000 - 48041fff | ||
| 460 | - * ARM11ETB Mod 48048000 - 48049fff | ||
| 461 | - * ARM11ETB L4 4804a000 - 4804afff | ||
| 462 | - * DISPLAY Top 48050000 - 480503ff | ||
| 463 | - * DISPLAY DISPC 48050400 - 480507ff | ||
| 464 | - * DISPLAY RFBI 48050800 - 48050bff | ||
| 465 | - * DISPLAY VENC 48050c00 - 48050fff | ||
| 466 | - * DISPLAY L4 48051000 - 48051fff | ||
| 467 | - * CAMERA Top 48052000 - 480523ff | ||
| 468 | - * CAMERA core 48052400 - 480527ff | ||
| 469 | - * CAMERA DMA 48052800 - 48052bff | ||
| 470 | - * CAMERA MMU 48052c00 - 48052fff | ||
| 471 | - * CAMERA L4 48053000 - 48053fff | ||
| 472 | - * SDMA Mod 48056000 - 48056fff | ||
| 473 | - * SDMA L4 48057000 - 48057fff | ||
| 474 | - * SSI Top 48058000 - 48058fff | ||
| 475 | - * SSI GDD 48059000 - 48059fff | ||
| 476 | - * SSI Port1 4805a000 - 4805afff | ||
| 477 | - * SSI Port2 4805b000 - 4805bfff | ||
| 478 | - * SSI L4 4805c000 - 4805cfff | ||
| 479 | - * USB Mod 4805e000 - 480fefff | ||
| 480 | - * USB L4 4805f000 - 480fffff | ||
| 481 | - * WIN_TRACER1 Mod 48060000 - 48060fff | ||
| 482 | - * WIN_TRACER1 L4 48061000 - 48061fff | ||
| 483 | - * WIN_TRACER2 Mod 48062000 - 48062fff | ||
| 484 | - * WIN_TRACER2 L4 48063000 - 48063fff | ||
| 485 | - * WIN_TRACER3 Mod 48064000 - 48064fff | ||
| 486 | - * WIN_TRACER3 L4 48065000 - 48065fff | ||
| 487 | - * WIN_TRACER4 Top 48066000 - 480660ff | ||
| 488 | - * WIN_TRACER4 ETT 48066100 - 480661ff | ||
| 489 | - * WIN_TRACER4 WT 48066200 - 480662ff | ||
| 490 | - * WIN_TRACER4 L4 48067000 - 48067fff | ||
| 491 | - * XTI Mod 48068000 - 48068fff | ||
| 492 | - * XTI L4 48069000 - 48069fff | ||
| 493 | - * UART1 Mod 4806a000 - 4806afff | ||
| 494 | - * UART1 L4 4806b000 - 4806bfff | ||
| 495 | - * UART2 Mod 4806c000 - 4806cfff | ||
| 496 | - * UART2 L4 4806d000 - 4806dfff | ||
| 497 | - * UART3 Mod 4806e000 - 4806efff | ||
| 498 | - * UART3 L4 4806f000 - 4806ffff | ||
| 499 | - * I2C1 Mod 48070000 - 48070fff | ||
| 500 | - * I2C1 L4 48071000 - 48071fff | ||
| 501 | - * I2C2 Mod 48072000 - 48072fff | ||
| 502 | - * I2C2 L4 48073000 - 48073fff | ||
| 503 | - * McBSP1 Mod 48074000 - 48074fff | ||
| 504 | - * McBSP1 L4 48075000 - 48075fff | ||
| 505 | - * McBSP2 Mod 48076000 - 48076fff | ||
| 506 | - * McBSP2 L4 48077000 - 48077fff | ||
| 507 | - * GPTIMER3 Mod 48078000 - 48078fff | ||
| 508 | - * GPTIMER3 L4 48079000 - 48079fff | ||
| 509 | - * GPTIMER4 Mod 4807a000 - 4807afff | ||
| 510 | - * GPTIMER4 L4 4807b000 - 4807bfff | ||
| 511 | - * GPTIMER5 Mod 4807c000 - 4807cfff | ||
| 512 | - * GPTIMER5 L4 4807d000 - 4807dfff | ||
| 513 | - * GPTIMER6 Mod 4807e000 - 4807efff | ||
| 514 | - * GPTIMER6 L4 4807f000 - 4807ffff | ||
| 515 | - * GPTIMER7 Mod 48080000 - 48080fff | ||
| 516 | - * GPTIMER7 L4 48081000 - 48081fff | ||
| 517 | - * GPTIMER8 Mod 48082000 - 48082fff | ||
| 518 | - * GPTIMER8 L4 48083000 - 48083fff | ||
| 519 | - * GPTIMER9 Mod 48084000 - 48084fff | ||
| 520 | - * GPTIMER9 L4 48085000 - 48085fff | ||
| 521 | - * GPTIMER10 Mod 48086000 - 48086fff | ||
| 522 | - * GPTIMER10 L4 48087000 - 48087fff | ||
| 523 | - * GPTIMER11 Mod 48088000 - 48088fff | ||
| 524 | - * GPTIMER11 L4 48089000 - 48089fff | ||
| 525 | - * GPTIMER12 Mod 4808a000 - 4808afff | ||
| 526 | - * GPTIMER12 L4 4808b000 - 4808bfff | ||
| 527 | - * EAC Mod 48090000 - 48090fff | ||
| 528 | - * EAC L4 48091000 - 48091fff | ||
| 529 | - * FAC Mod 48092000 - 48092fff | ||
| 530 | - * FAC L4 48093000 - 48093fff | ||
| 531 | - * MAILBOX Mod 48094000 - 48094fff | ||
| 532 | - * MAILBOX L4 48095000 - 48095fff | ||
| 533 | - * SPI1 Mod 48098000 - 48098fff | ||
| 534 | - * SPI1 L4 48099000 - 48099fff | ||
| 535 | - * SPI2 Mod 4809a000 - 4809afff | ||
| 536 | - * SPI2 L4 4809b000 - 4809bfff | ||
| 537 | - * MMC/SDIO Mod 4809c000 - 4809cfff | ||
| 538 | - * MMC/SDIO L4 4809d000 - 4809dfff | ||
| 539 | - * MS_PRO Mod 4809e000 - 4809efff | ||
| 540 | - * MS_PRO L4 4809f000 - 4809ffff | ||
| 541 | - * RNG Mod 480a0000 - 480a0fff | ||
| 542 | - * RNG L4 480a1000 - 480a1fff | ||
| 543 | - * DES3DES Mod 480a2000 - 480a2fff | ||
| 544 | - * DES3DES L4 480a3000 - 480a3fff | ||
| 545 | - * SHA1MD5 Mod 480a4000 - 480a4fff | ||
| 546 | - * SHA1MD5 L4 480a5000 - 480a5fff | ||
| 547 | - * AES Mod 480a6000 - 480a6fff | ||
| 548 | - * AES L4 480a7000 - 480a7fff | ||
| 549 | - * PKA Mod 480a8000 - 480a9fff | ||
| 550 | - * PKA L4 480aa000 - 480aafff | ||
| 551 | - * MG Mod 480b0000 - 480b0fff | ||
| 552 | - * MG L4 480b1000 - 480b1fff | ||
| 553 | - * HDQ/1-wire Mod 480b2000 - 480b2fff | ||
| 554 | - * HDQ/1-wire L4 480b3000 - 480b3fff | ||
| 555 | - * MPU interrupt 480fe000 - 480fefff | ||
| 556 | - * IVA RAM 5c000000 - 5c01ffff | ||
| 557 | - * IVA ROM 5c020000 - 5c027fff | ||
| 558 | - * IMG_BUF_A 5c040000 - 5c040fff | ||
| 559 | - * IMG_BUF_B 5c042000 - 5c042fff | ||
| 560 | - * VLCDS 5c048000 - 5c0487ff | ||
| 561 | - * IMX_COEF 5c049000 - 5c04afff | ||
| 562 | - * IMX_CMD 5c051000 - 5c051fff | ||
| 563 | - * VLCDQ 5c053000 - 5c0533ff | ||
| 564 | - * VLCDH 5c054000 - 5c054fff | ||
| 565 | - * SEQ_CMD 5c055000 - 5c055fff | ||
| 566 | - * IMX_REG 5c056000 - 5c0560ff | ||
| 567 | - * VLCD_REG 5c056100 - 5c0561ff | ||
| 568 | - * SEQ_REG 5c056200 - 5c0562ff | ||
| 569 | - * IMG_BUF_REG 5c056300 - 5c0563ff | ||
| 570 | - * SEQIRQ_REG 5c056400 - 5c0564ff | ||
| 571 | - * OCP_REG 5c060000 - 5c060fff | ||
| 572 | - * SYSC_REG 5c070000 - 5c070fff | ||
| 573 | - * MMU_REG 5d000000 - 5d000fff | ||
| 574 | + * ARM11ETB Mod 48048000 - 48049fff (REV 0x00000011) | ||
| 575 | + * ARM11ETB L4 4804a000 - 4804afff (0x00200010, 0x00000200, 0x00000000) | ||
| 576 | + * DISPLAY Top 48050000 - 480503ff (REV 0x00000003) | ||
| 577 | + * DISPLAY DISPC 48050400 - 480507ff (REV 0x00000020) | ||
| 578 | + * DISPLAY RFBI 48050800 - 48050bff (REV 0x00000010) | ||
| 579 | + * DISPLAY VENC 48050c00 - 48050fff (REV Abort) | ||
| 580 | + * DISPLAY L4 48051000 - 48051fff (0x00200010, 0x00000200, 0x00000100) | ||
| 581 | + * CAMERA Top 48052000 - 480523ff (REV 0x00000020) | ||
| 582 | + * CAMERA core 48052400 - 480527ff (REV 0x00000020) | ||
| 583 | + * CAMERA DMA 48052800 - 48052bff (REV 0x00000020) | ||
| 584 | + * CAMERA MMU 48052c00 - 48052fff (REV 0x00000010) | ||
| 585 | + * CAMERA L4 48053000 - 48053fff (0x00200010, 0x00000200, 0x00000000) | ||
| 586 | + * SDMA Mod 48056000 - 48056fff (REV 0x00000020) | ||
| 587 | + * SDMA L4 48057000 - 48057fff (0x00200010, 0x00000200, 0x00000000) | ||
| 588 | + * SSI Top 48058000 - 48058fff (REV Abort) | ||
| 589 | + * SSI GDD 48059000 - 48059fff (REV Abort) | ||
| 590 | + * SSI Port1 4805a000 - 4805afff (REV Abort) | ||
| 591 | + * SSI Port2 4805b000 - 4805bfff (REV Abort) | ||
| 592 | + * SSI L4 4805c000 - 4805cfff (0x00200010, 0x00000200, 0x00000100) | ||
| 593 | + * USB Mod 4805e000 - 480fefff (REV Abort) | ||
| 594 | + * USB L4 4805f000 - 480fffff (0x00200010, 0x01000200, 0x00000100) | ||
| 595 | + * WIN_TRACER1 Mod 48060000 - 48060fff (REV 0x00000020) | ||
| 596 | + * WIN_TRACER1 L4 48061000 - 48061fff (0x00200010, 0x00000200, 0x00000000) | ||
| 597 | + * WIN_TRACER2 Mod 48062000 - 48062fff (REV 0x00000020) | ||
| 598 | + * WIN_TRACER2 L4 48063000 - 48063fff (0x00200010, 0x00000200, 0x00000000) | ||
| 599 | + * WIN_TRACER3 Mod 48064000 - 48064fff (REV 0x00000020) | ||
| 600 | + * WIN_TRACER3 L4 48065000 - 48065fff (0x00200010, 0x00000200, 0x00000000) | ||
| 601 | + * WIN_TRACER4 Top 48066000 - 480660ff (REV 0x00000011) | ||
| 602 | + * WIN_TRACER4 ETT 48066100 - 480661ff (REV 0x00000011) | ||
| 603 | + * WIN_TRACER4 WT 48066200 - 480662ff (REV 0x00000020) | ||
| 604 | + * WIN_TRACER4 L4 48067000 - 48067fff (0x00200010, 0x00000200, 0x00000000) | ||
| 605 | + * XTI Mod 48068000 - 48068fff (REV 0x00000010) | ||
| 606 | + * XTI L4 48069000 - 48069fff (0x00200010, 0x00000200, 0x00000000) | ||
| 607 | + * UART1 Mod 4806a000 - 4806afff (MVR Abort) | ||
| 608 | + * UART1 L4 4806b000 - 4806bfff (0x00200010, 0x00000200, 0x00000000) | ||
| 609 | + * UART2 Mod 4806c000 - 4806cfff (MVR Abort) | ||
| 610 | + * UART2 L4 4806d000 - 4806dfff (0x00200010, 0x00000200, 0x00000000) | ||
| 611 | + * UART3 Mod 4806e000 - 4806efff (MVR 0x20) | ||
| 612 | + * UART3 L4 4806f000 - 4806ffff (0x00200010, 0x00000200, 0x00000000) | ||
| 613 | + * I2C1 Mod 48070000 - 48070fff (REV 0x0034) | ||
| 614 | + * I2C1 L4 48071000 - 48071fff (0x00200010, 0x01000200, 0x01000000) | ||
| 615 | + * I2C2 Mod 48072000 - 48072fff (REV 0x0034) | ||
| 616 | + * I2C2 L4 48073000 - 48073fff (0x00200010, 0x01000200, 0x01000000) | ||
| 617 | + * McBSP1 Mod 48074000 - 48074fff (REV Abort) | ||
| 618 | + * McBSP1 L4 48075000 - 48075fff (0x00200010, 0x01000200, 0x01000000) | ||
| 619 | + * McBSP2 Mod 48076000 - 48076fff (REV Abort) | ||
| 620 | + * McBSP2 L4 48077000 - 48077fff (0x00200010, 0x01000200, 0x01000000) | ||
| 621 | + * GPTIMER3 Mod 48078000 - 48078fff (REV Abort) | ||
| 622 | + * GPTIMER3 L4 48079000 - 48079fff (0x00200010, 0x00000200, 0x00000000) | ||
| 623 | + * GPTIMER4 Mod 4807a000 - 4807afff (REV Abort) | ||
| 624 | + * GPTIMER4 L4 4807b000 - 4807bfff (0x00200010, 0x00000200, 0x00000000) | ||
| 625 | + * GPTIMER5 Mod 4807c000 - 4807cfff (REV Abort) | ||
| 626 | + * GPTIMER5 L4 4807d000 - 4807dfff (0x00200010, 0x00000200, 0x00000000) | ||
| 627 | + * GPTIMER6 Mod 4807e000 - 4807efff (REV Abort) | ||
| 628 | + * GPTIMER6 L4 4807f000 - 4807ffff (0x00200010, 0x00000200, 0x00000000) | ||
| 629 | + * GPTIMER7 Mod 48080000 - 48080fff (REV Abort) | ||
| 630 | + * GPTIMER7 L4 48081000 - 48081fff (0x00200010, 0x00000200, 0x00000000) | ||
| 631 | + * GPTIMER8 Mod 48082000 - 48082fff (REV Abort) | ||
| 632 | + * GPTIMER8 L4 48083000 - 48083fff (0x00200010, 0x00000200, 0x00000000) | ||
| 633 | + * GPTIMER9 Mod 48084000 - 48084fff (REV Abort) | ||
| 634 | + * GPTIMER9 L4 48085000 - 48085fff (0x00200010, 0x00000200, 0x00000000) | ||
| 635 | + * GPTIMER10 Mod 48086000 - 48086fff (REV Abort) | ||
| 636 | + * GPTIMER10 L4 48087000 - 48087fff (0x00200010, 0x00000200, 0x00000000) | ||
| 637 | + * GPTIMER11 Mod 48088000 - 48088fff (REV Abort) | ||
| 638 | + * GPTIMER11 L4 48089000 - 48089fff (0x00200010, 0x00000200, 0x00000000) | ||
| 639 | + * GPTIMER12 Mod 4808a000 - 4808afff (REV Abort) | ||
| 640 | + * GPTIMER12 L4 4808b000 - 4808bfff (0x00200010, 0x00000200, 0x00000000) | ||
| 641 | + * EAC Mod 48090000 - 48090fff (REV Abort) | ||
| 642 | + * EAC L4 48091000 - 48091fff (0x00200010, 0x00000200, 0x00000000) | ||
| 643 | + * FAC Mod 48092000 - 48092fff (REV Abort) | ||
| 644 | + * FAC L4 48093000 - 48093fff (0x00200010, 0x00000200, 0x00000000) | ||
| 645 | + * MAILBOX Mod 48094000 - 48094fff (REV 0x00000010) | ||
| 646 | + * MAILBOX L4 48095000 - 48095fff (0x00200010, 0x00000200, 0x00000000) | ||
| 647 | + * SPI1 Mod 48098000 - 48098fff (REV Abort) | ||
| 648 | + * SPI1 L4 48099000 - 48099fff (0x00200010, 0x00000200, 0x00000000) | ||
| 649 | + * SPI2 Mod 4809a000 - 4809afff (REV Abort) | ||
| 650 | + * SPI2 L4 4809b000 - 4809bfff (0x00200010, 0x00000200, 0x00000000) | ||
| 651 | + * MMC/SDIO Mod 4809c000 - 4809cfff (REV 0x0044) | ||
| 652 | + * MMC/SDIO L4 4809d000 - 4809dfff (0x00200010, 0x01000200, 0x01000000) | ||
| 653 | + * MS_PRO Mod 4809e000 - 4809efff (REV Abort) | ||
| 654 | + * MS_PRO L4 4809f000 - 4809ffff (0x00200010, 0x01000200, 0x01000000) | ||
| 655 | + * RNG Mod 480a0000 - 480a0fff (REV 0xFC066F93?) | ||
| 656 | + * RNG L4 480a1000 - 480a1fff (0x00200010, 0x01000200, 0x00000000) | ||
| 657 | + * DES3DES Mod 480a2000 - 480a2fff (REV 0x00000000?) | ||
| 658 | + * DES3DES L4 480a3000 - 480a3fff (0x00200010, 0x01000200, 0x00000000) | ||
| 659 | + * SHA1MD5 Mod 480a4000 - 480a4fff (REV 0x00000000?) | ||
| 660 | + * SHA1MD5 L4 480a5000 - 480a5fff (0x00200010, 0x01000200, 0x00000000) | ||
| 661 | + * AES Mod 480a6000 - 480a6fff (REV 0x00000000?) | ||
| 662 | + * AES L4 480a7000 - 480a7fff (0x00200010, 0x00000200, 0x00000000) | ||
| 663 | + * PKA Mod 480a8000 - 480a9fff (REV 0x00000000?) | ||
| 664 | + * PKA L4 480aa000 - 480aafff (0x00200010, 0x00000200, 0x00000000) | ||
| 665 | + * MG Mod 480b0000 - 480b0fff (REV Abort) | ||
| 666 | + * MG L4 480b1000 - 480b1fff (0x00200010, 0x01000200, 0x01000000) | ||
| 667 | + * HDQ/1-wire Mod 480b2000 - 480b2fff (REV 0x00000002) | ||
| 668 | + * HDQ/1-wire L4 480b3000 - 480b3fff (0x00200010, 0x00000200, 0x00000000) | ||
| 669 | + * MPU interrupt 480fe000 - 480fefff (REV 0x00000020) | ||
| 670 | + * IVA RAM 5c000000 - 5c01ffff (REV Abort) | ||
| 671 | + * IVA ROM 5c020000 - 5c027fff (REV Abort) | ||
| 672 | + * IMG_BUF_A 5c040000 - 5c040fff (REV Abort) | ||
| 673 | + * IMG_BUF_B 5c042000 - 5c042fff (REV Abort) | ||
| 674 | + * VLCDS 5c048000 - 5c0487ff (REV Abort) | ||
| 675 | + * IMX_COEF 5c049000 - 5c04afff (REV Abort) | ||
| 676 | + * IMX_CMD 5c051000 - 5c051fff (REV Abort) | ||
| 677 | + * VLCDQ 5c053000 - 5c0533ff (REV Abort) | ||
| 678 | + * VLCDH 5c054000 - 5c054fff (REV Abort) | ||
| 679 | + * SEQ_CMD 5c055000 - 5c055fff (REV Abort) | ||
| 680 | + * IMX_REG 5c056000 - 5c0560ff (REV Abort) | ||
| 681 | + * VLCD_REG 5c056100 - 5c0561ff (REV Abort) | ||
| 682 | + * SEQ_REG 5c056200 - 5c0562ff (REV Abort) | ||
| 683 | + * IMG_BUF_REG 5c056300 - 5c0563ff (REV Abort) | ||
| 684 | + * SEQIRQ_REG 5c056400 - 5c0564ff (REV Abort) | ||
| 685 | + * OCP_REG 5c060000 - 5c060fff (REV Abort) | ||
| 686 | + * SYSC_REG 5c070000 - 5c070fff (REV Abort) | ||
| 687 | + * MMU_REG 5d000000 - 5d000fff (REV Abort) | ||
| 688 | * sDMA R 68000400 - 680005ff | ||
| 689 | * sDMA W 68000600 - 680007ff | ||
| 690 | * Display Control 68000800 - 680009ff | ||
| 691 | @@ -3849,9 +3849,9 @@ | ||
| 692 | * GPMC (firewall) 68006000 - 680063ff | ||
| 693 | * GPMC (err login) 68006400 - 680067ff | ||
| 694 | * SMS (err login) 68006c00 - 68006fff | ||
| 695 | - * SMS registers 68008000 - 68008fff | ||
| 696 | - * SDRC registers 68009000 - 68009fff | ||
| 697 | - * GPMC registers 6800a000 6800afff | ||
| 698 | + * SMS registers 68008000 - 68008fff (REV 0x00000020) | ||
| 699 | + * SDRC registers 68009000 - 68009fff (REV 0x00000020) | ||
| 700 | + * GPMC registers 6800a000 6800afff (REV 0x00000020) | ||
| 701 | */ | ||
| 702 | |||
| 703 | qemu_register_reset(omap2_mpu_reset, s); | ||
| 704 | diff -urN 4242/hw/pc.c qemu-omap/hw/pc.c | ||
| 705 | --- 4242/hw/pc.c 2008-04-24 21:26:22.000000000 +0100 | ||
| 706 | +++ qemu-omap/hw/pc.c 2008-04-23 09:57:56.000000000 +0100 | ||
| 707 | @@ -445,6 +445,37 @@ | ||
| 708 | bdrv_set_boot_sector(drives_table[hda].bdrv, bootsect, sizeof(bootsect)); | ||
| 709 | } | ||
| 710 | |||
| 711 | +static int load_kernel(const char *filename, uint8_t *addr, | ||
| 712 | + uint8_t *real_addr) | ||
| 713 | +{ | ||
| 714 | + int fd, size; | ||
| 715 | + int setup_sects; | ||
| 716 | + | ||
| 717 | + fd = open(filename, O_RDONLY | O_BINARY); | ||
| 718 | + if (fd < 0) | ||
| 719 | + return -1; | ||
| 720 | + | ||
| 721 | + /* load 16 bit code */ | ||
| 722 | + if (read(fd, real_addr, 512) != 512) | ||
| 723 | + goto fail; | ||
| 724 | + setup_sects = real_addr[0x1F1]; | ||
| 725 | + if (!setup_sects) | ||
| 726 | + setup_sects = 4; | ||
| 727 | + if (read(fd, real_addr + 512, setup_sects * 512) != | ||
| 728 | + setup_sects * 512) | ||
| 729 | + goto fail; | ||
| 730 | + | ||
| 731 | + /* load 32 bit code */ | ||
| 732 | + size = read(fd, addr, 16 * 1024 * 1024); | ||
| 733 | + if (size < 0) | ||
| 734 | + goto fail; | ||
| 735 | + close(fd); | ||
| 736 | + return size; | ||
| 737 | + fail: | ||
| 738 | + close(fd); | ||
| 739 | + return -1; | ||
| 740 | +} | ||
| 741 | + | ||
| 742 | static long get_file_size(FILE *f) | ||
| 743 | { | ||
| 744 | long where, size; | ||
| 745 | diff -urN 4242/hw/tusb6010.c qemu-omap/hw/tusb6010.c | ||
| 746 | --- 4242/hw/tusb6010.c 2008-04-23 12:18:54.000000000 +0100 | ||
| 747 | +++ qemu-omap/hw/tusb6010.c 2008-04-23 09:57:56.000000000 +0100 | ||
| 748 | @@ -287,9 +287,6 @@ | ||
| 749 | /* TODO: How is this signalled? */ | ||
| 750 | } | ||
| 751 | |||
| 752 | -extern CPUReadMemoryFunc *musb_read[]; | ||
| 753 | -extern CPUWriteMemoryFunc *musb_write[]; | ||
| 754 | - | ||
| 755 | static uint32_t tusb_async_readb(void *opaque, target_phys_addr_t addr) | ||
| 756 | { | ||
| 757 | struct tusb_s *s = (struct tusb_s *) opaque; | ||
| 758 | diff -urN 4242/hw/usb.h qemu-omap/hw/usb.h | ||
| 759 | --- 4242/hw/usb.h 2008-04-23 12:18:54.000000000 +0100 | ||
| 760 | +++ qemu-omap/hw/usb.h 2008-04-23 09:57:56.000000000 +0100 | ||
| 761 | @@ -219,6 +219,9 @@ | ||
| 762 | /* usb-msd.c */ | ||
| 763 | USBDevice *usb_msd_init(const char *filename); | ||
| 764 | |||
| 765 | +/* usb-net.c */ | ||
| 766 | +USBDevice *usb_net_init(NICInfo *nd); | ||
| 767 | + | ||
| 768 | /* usb-wacom.c */ | ||
| 769 | USBDevice *usb_wacom_init(void); | ||
| 770 | |||
| 771 | @@ -254,3 +257,7 @@ | ||
| 772 | uint32_t musb_core_intr_get(struct musb_s *s); | ||
| 773 | void musb_core_intr_clear(struct musb_s *s, uint32_t mask); | ||
| 774 | void musb_set_size(struct musb_s *s, int epnum, int size, int is_tx); | ||
| 775 | +#ifdef NEED_CPU_H | ||
| 776 | +extern CPUReadMemoryFunc *musb_read[]; | ||
| 777 | +extern CPUWriteMemoryFunc *musb_write[]; | ||
| 778 | +#endif | ||
| 779 | diff -urN 4242/hw/usb-hub.c qemu-omap/hw/usb-hub.c | ||
| 780 | --- 4242/hw/usb-hub.c 2008-04-23 11:43:37.000000000 +0100 | ||
| 781 | +++ qemu-omap/hw/usb-hub.c 2008-04-23 09:57:56.000000000 +0100 | ||
| 782 | @@ -146,8 +146,8 @@ | ||
| 783 | 0x07, /* u8 ep_bLength; */ | ||
| 784 | 0x05, /* u8 ep_bDescriptorType; Endpoint */ | ||
| 785 | 0x81, /* u8 ep_bEndpointAddress; IN Endpoint 1 */ | ||
| 786 | - 0x03, /* u8 ep_bmAttributes; Interrupt */ | ||
| 787 | - 0x02, 0x00, /* u16 ep_wMaxPacketSize; 1 + (MAX_ROOT_PORTS / 8) */ | ||
| 788 | + 0x03, /* u8 ep_bmAttributes; Interrupt */ | ||
| 789 | + 0x02, 0x00, /* u16 ep_wMaxPacketSize; 1 + (MAX_ROOT_PORTS / 8) */ | ||
| 790 | 0xff /* u8 ep_bInterval; (255ms -- usb 2.0 spec) */ | ||
| 791 | }; | ||
| 792 | |||
| 793 | diff -urN 4242/hw/usb-net.c qemu-omap/hw/usb-net.c | ||
| 794 | --- 4242/hw/usb-net.c 1970-01-01 01:00:00.000000000 +0100 | ||
| 795 | +++ qemu-omap/hw/usb-net.c 2008-04-23 09:57:56.000000000 +0100 | ||
| 796 | @@ -0,0 +1,1334 @@ | ||
| 797 | +/* | ||
| 798 | + * QEMU USB Net devices | ||
| 799 | + * | ||
| 800 | + * Copyright (c) 2006 Thomas Sailer | ||
| 801 | + * based on usb-hid.c Copyright (c) 2005 Fabrice Bellard | ||
| 802 | + * | ||
| 803 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 804 | + * of this software and associated documentation files (the "Software"), to deal | ||
| 805 | + * in the Software without restriction, including without limitation the rights | ||
| 806 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 807 | + * copies of the Software, and to permit persons to whom the Software is | ||
| 808 | + * furnished to do so, subject to the following conditions: | ||
| 809 | + * | ||
| 810 | + * The above copyright notice and this permission notice shall be included in | ||
| 811 | + * all copies or substantial portions of the Software. | ||
| 812 | + * | ||
| 813 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 814 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 815 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 816 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 817 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 818 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| 819 | + * THE SOFTWARE. | ||
| 820 | + */ | ||
| 821 | + | ||
| 822 | +#include "qemu-common.h" | ||
| 823 | +#include "usb.h" | ||
| 824 | +#include "net.h" | ||
| 825 | +#include "../audio/sys-queue.h" | ||
| 826 | + | ||
| 827 | +typedef uint32_t __le32; | ||
| 828 | +#include "ndis.h" | ||
| 829 | + | ||
| 830 | +/*#define TRAFFIC_DEBUG*/ | ||
| 831 | +/* Thanks to NetChip Technologies for donating this product ID. | ||
| 832 | + * It's for devices with only CDC Ethernet configurations. | ||
| 833 | + */ | ||
| 834 | +#define CDC_VENDOR_NUM 0x0525 /* NetChip */ | ||
| 835 | +#define CDC_PRODUCT_NUM 0xa4a1 /* Linux-USB Ethernet Gadget */ | ||
| 836 | +/* For hardware that can talk RNDIS and either of the above protocols, | ||
| 837 | + * use this ID ... the windows INF files will know it. | ||
| 838 | + */ | ||
| 839 | +#define RNDIS_VENDOR_NUM 0x0525 /* NetChip */ | ||
| 840 | +#define RNDIS_PRODUCT_NUM 0xa4a2 /* Ethernet/RNDIS Gadget */ | ||
| 841 | + | ||
| 842 | +#define STRING_MANUFACTURER 1 | ||
| 843 | +#define STRING_PRODUCT 2 | ||
| 844 | +#define STRING_ETHADDR 3 | ||
| 845 | +#define STRING_DATA 4 | ||
| 846 | +#define STRING_CONTROL 5 | ||
| 847 | +#define STRING_RNDIS_CONTROL 6 | ||
| 848 | +#define STRING_CDC 7 | ||
| 849 | +#define STRING_SUBSET 8 | ||
| 850 | +#define STRING_RNDIS 9 | ||
| 851 | +#define STRING_SERIALNUMBER 10 | ||
| 852 | + | ||
| 853 | +#define DEV_CONFIG_VALUE 1 /* cdc or subset */ | ||
| 854 | +#define DEV_RNDIS_CONFIG_VALUE 2 /* rndis; optional */ | ||
| 855 | + | ||
| 856 | +#define USB_CDC_SUBCLASS_ACM 0x02 | ||
| 857 | +#define USB_CDC_SUBCLASS_ETHERNET 0x06 | ||
| 858 | + | ||
| 859 | +#define USB_CDC_PROTO_NONE 0 | ||
| 860 | +#define USB_CDC_ACM_PROTO_VENDOR 0xff | ||
| 861 | + | ||
| 862 | +#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ | ||
| 863 | +#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ | ||
| 864 | +#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ | ||
| 865 | +#define USB_CDC_UNION_TYPE 0x06 /* union_desc */ | ||
| 866 | +#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ | ||
| 867 | + | ||
| 868 | +#define USB_DT_CS_INTERFACE 0x24 | ||
| 869 | +#define USB_DT_CS_ENDPOINT 0x25 | ||
| 870 | + | ||
| 871 | +#define ClassInterfaceRequest \ | ||
| 872 | + ((USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE)<<8) | ||
| 873 | +#define ClassInterfaceOutRequest \ | ||
| 874 | + ((USB_DIR_OUT|USB_TYPE_CLASS|USB_RECIP_INTERFACE)<<8) | ||
| 875 | + | ||
| 876 | +#define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00 | ||
| 877 | +#define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01 | ||
| 878 | +#define USB_CDC_REQ_SET_LINE_CODING 0x20 | ||
| 879 | +#define USB_CDC_REQ_GET_LINE_CODING 0x21 | ||
| 880 | +#define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22 | ||
| 881 | +#define USB_CDC_REQ_SEND_BREAK 0x23 | ||
| 882 | +#define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40 | ||
| 883 | +#define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER 0x41 | ||
| 884 | +#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER 0x42 | ||
| 885 | +#define USB_CDC_SET_ETHERNET_PACKET_FILTER 0x43 | ||
| 886 | +#define USB_CDC_GET_ETHERNET_STATISTIC 0x44 | ||
| 887 | + | ||
| 888 | +#define USB_ENDPOINT_XFER_BULK 2 | ||
| 889 | +#define USB_ENDPOINT_XFER_INT 3 | ||
| 890 | + | ||
| 891 | +#define LOG2_STATUS_INTERVAL_MSEC 5 /* 1 << 5 == 32 msec */ | ||
| 892 | +#define STATUS_BYTECOUNT 16 /* 8 byte header + data */ | ||
| 893 | + | ||
| 894 | +#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ | ||
| 895 | + | ||
| 896 | +/* | ||
| 897 | + * mostly the same descriptor as the linux gadget rndis driver | ||
| 898 | + */ | ||
| 899 | +static const uint8_t qemu_net_dev_descriptor[] = { | ||
| 900 | + 0x12, /* u8 bLength; */ | ||
| 901 | + USB_DT_DEVICE, /* u8 bDescriptorType; Device */ | ||
| 902 | + 0x00, 0x02, /* u16 bcdUSB; v2.0 */ | ||
| 903 | + USB_CLASS_COMM, /* u8 bDeviceClass; */ | ||
| 904 | + 0x00, /* u8 bDeviceSubClass; */ | ||
| 905 | + 0x00, /* u8 bDeviceProtocol; [ low/full speeds only ] */ | ||
| 906 | + 0x40, /* u8 bMaxPacketSize0 */ | ||
| 907 | + RNDIS_VENDOR_NUM & 0xff, RNDIS_VENDOR_NUM >> 8, /* u16 idVendor; */ | ||
| 908 | + RNDIS_PRODUCT_NUM & 0xff, RNDIS_PRODUCT_NUM >> 8, /* u16 idProduct; */ | ||
| 909 | + 0x00, 0x00, /* u16 bcdDevice */ | ||
| 910 | + STRING_MANUFACTURER, /* u8 iManufacturer; */ | ||
| 911 | + STRING_PRODUCT, /* u8 iProduct; */ | ||
| 912 | + STRING_SERIALNUMBER, /* u8 iSerialNumber; */ | ||
| 913 | + 0x02 /* u8 bNumConfigurations; */ | ||
| 914 | +}; | ||
| 915 | + | ||
| 916 | +static const uint8_t qemu_net_rndis_config_descriptor[] = { | ||
| 917 | + /* Configuration Descriptor */ | ||
| 918 | + 0x09, /* u8 bLength */ | ||
| 919 | + USB_DT_CONFIG, /* u8 bDescriptorType */ | ||
| 920 | + 0x43, 0x00, /* le16 wTotalLength */ | ||
| 921 | + 0x02, /* u8 bNumInterfaces */ | ||
| 922 | + DEV_RNDIS_CONFIG_VALUE, /* u8 bConfigurationValue */ | ||
| 923 | + STRING_RNDIS, /* u8 iConfiguration */ | ||
| 924 | + 0xc0, /* u8 bmAttributes */ | ||
| 925 | + 0x32, /* u8 bMaxPower */ | ||
| 926 | + /* RNDIS Control Interface */ | ||
| 927 | + 0x09, /* u8 bLength */ | ||
| 928 | + USB_DT_INTERFACE, /* u8 bDescriptorType */ | ||
| 929 | + 0x00, /* u8 bInterfaceNumber */ | ||
| 930 | + 0x00, /* u8 bAlternateSetting */ | ||
| 931 | + 0x01, /* u8 bNumEndpoints */ | ||
| 932 | + USB_CLASS_COMM, /* u8 bInterfaceClass */ | ||
| 933 | + USB_CDC_SUBCLASS_ACM, /* u8 bInterfaceSubClass */ | ||
| 934 | + USB_CDC_ACM_PROTO_VENDOR, /* u8 bInterfaceProtocol */ | ||
| 935 | + STRING_RNDIS_CONTROL, /* u8 iInterface */ | ||
| 936 | + /* Header Descriptor */ | ||
| 937 | + 0x05, /* u8 bLength */ | ||
| 938 | + USB_DT_CS_INTERFACE, /* u8 bDescriptorType */ | ||
| 939 | + USB_CDC_HEADER_TYPE, /* u8 bDescriptorSubType */ | ||
| 940 | + 0x10, 0x01, /* le16 bcdCDC */ | ||
| 941 | + /* Call Management Descriptor */ | ||
| 942 | + 0x05, /* u8 bLength */ | ||
| 943 | + USB_DT_CS_INTERFACE, /* u8 bDescriptorType */ | ||
| 944 | + USB_CDC_CALL_MANAGEMENT_TYPE, /* u8 bDescriptorSubType */ | ||
| 945 | + 0x00, /* u8 bmCapabilities */ | ||
| 946 | + 0x01, /* u8 bDataInterface */ | ||
| 947 | + /* ACM Descriptor */ | ||
| 948 | + 0x04, /* u8 bLength */ | ||
| 949 | + USB_DT_CS_INTERFACE, /* u8 bDescriptorType */ | ||
| 950 | + USB_CDC_ACM_TYPE, /* u8 bDescriptorSubType */ | ||
| 951 | + 0x00, /* u8 bmCapabilities */ | ||
| 952 | + /* Union Descriptor */ | ||
| 953 | + 0x05, /* u8 bLength */ | ||
| 954 | + USB_DT_CS_INTERFACE, /* u8 bDescriptorType */ | ||
| 955 | + USB_CDC_UNION_TYPE, /* u8 bDescriptorSubType */ | ||
| 956 | + 0x00, /* u8 bMasterInterface0 */ | ||
| 957 | + 0x01, /* u8 bSlaveInterface0 */ | ||
| 958 | + /* Status Descriptor */ | ||
| 959 | + 0x07, /* u8 bLength */ | ||
| 960 | + USB_DT_ENDPOINT, /* u8 bDescriptorType */ | ||
| 961 | + USB_DIR_IN | 1, /* u8 bEndpointAddress */ | ||
| 962 | + USB_ENDPOINT_XFER_INT, /* u8 bmAttributes */ | ||
| 963 | + STATUS_BYTECOUNT & 0xff, STATUS_BYTECOUNT >> 8, /* le16 wMaxPacketSize */ | ||
| 964 | + 1 << LOG2_STATUS_INTERVAL_MSEC, /* u8 bInterval */ | ||
| 965 | + /* RNDIS Data Interface */ | ||
| 966 | + 0x09, /* u8 bLength */ | ||
| 967 | + USB_DT_INTERFACE, /* u8 bDescriptorType */ | ||
| 968 | + 0x01, /* u8 bInterfaceNumber */ | ||
| 969 | + 0x00, /* u8 bAlternateSetting */ | ||
| 970 | + 0x02, /* u8 bNumEndpoints */ | ||
| 971 | + USB_CLASS_CDC_DATA, /* u8 bInterfaceClass */ | ||
| 972 | + 0x00, /* u8 bInterfaceSubClass */ | ||
| 973 | + 0x00, /* u8 bInterfaceProtocol */ | ||
| 974 | + STRING_DATA, /* u8 iInterface */ | ||
| 975 | + /* Source Endpoint */ | ||
| 976 | + 0x07, /* u8 bLength */ | ||
| 977 | + USB_DT_ENDPOINT, /* u8 bDescriptorType */ | ||
| 978 | + USB_DIR_IN | 2, /* u8 bEndpointAddress */ | ||
| 979 | + USB_ENDPOINT_XFER_BULK, /* u8 bmAttributes */ | ||
| 980 | + 0x40, 0x00, /* le16 wMaxPacketSize */ | ||
| 981 | + 0x00, /* u8 bInterval */ | ||
| 982 | + /* Sink Endpoint */ | ||
| 983 | + 0x07, /* u8 bLength */ | ||
| 984 | + USB_DT_ENDPOINT, /* u8 bDescriptorType */ | ||
| 985 | + USB_DIR_OUT | 2, /* u8 bEndpointAddress */ | ||
| 986 | + USB_ENDPOINT_XFER_BULK, /* u8 bmAttributes */ | ||
| 987 | + 0x40, 0x00, /* le16 wMaxPacketSize */ | ||
| 988 | + 0x00 /* u8 bInterval */ | ||
| 989 | +}; | ||
| 990 | + | ||
| 991 | +static const uint8_t qemu_net_cdc_config_descriptor[] = { | ||
| 992 | + /* Configuration Descriptor */ | ||
| 993 | + 0x09, /* u8 bLength */ | ||
| 994 | + USB_DT_CONFIG, /* u8 bDescriptorType */ | ||
| 995 | + 0x50, 0x00, /* le16 wTotalLength */ | ||
| 996 | + 0x02, /* u8 bNumInterfaces */ | ||
| 997 | + DEV_CONFIG_VALUE, /* u8 bConfigurationValue */ | ||
| 998 | + STRING_CDC, /* u8 iConfiguration */ | ||
| 999 | + 0xc0, /* u8 bmAttributes */ | ||
| 1000 | + 0x32, /* u8 bMaxPower */ | ||
| 1001 | + /* CDC Control Interface */ | ||
| 1002 | + 0x09, /* u8 bLength */ | ||
| 1003 | + USB_DT_INTERFACE, /* u8 bDescriptorType */ | ||
| 1004 | + 0x00, /* u8 bInterfaceNumber */ | ||
| 1005 | + 0x00, /* u8 bAlternateSetting */ | ||
| 1006 | + 0x01, /* u8 bNumEndpoints */ | ||
| 1007 | + USB_CLASS_COMM, /* u8 bInterfaceClass */ | ||
| 1008 | + USB_CDC_SUBCLASS_ETHERNET, /* u8 bInterfaceSubClass */ | ||
| 1009 | + USB_CDC_PROTO_NONE, /* u8 bInterfaceProtocol */ | ||
| 1010 | + STRING_CONTROL, /* u8 iInterface */ | ||
| 1011 | + /* Header Descriptor */ | ||
| 1012 | + 0x05, /* u8 bLength */ | ||
| 1013 | + USB_DT_CS_INTERFACE, /* u8 bDescriptorType */ | ||
| 1014 | + USB_CDC_HEADER_TYPE, /* u8 bDescriptorSubType */ | ||
| 1015 | + 0x10, 0x01, /* le16 bcdCDC */ | ||
| 1016 | + /* Union Descriptor */ | ||
| 1017 | + 0x05, /* u8 bLength */ | ||
| 1018 | + USB_DT_CS_INTERFACE, /* u8 bDescriptorType */ | ||
| 1019 | + USB_CDC_UNION_TYPE, /* u8 bDescriptorSubType */ | ||
| 1020 | + 0x00, /* u8 bMasterInterface0 */ | ||
| 1021 | + 0x01, /* u8 bSlaveInterface0 */ | ||
| 1022 | + /* Ethernet Descriptor */ | ||
| 1023 | + 0x0d, /* u8 bLength */ | ||
| 1024 | + USB_DT_CS_INTERFACE, /* u8 bDescriptorType */ | ||
| 1025 | + USB_CDC_ETHERNET_TYPE, /* u8 bDescriptorSubType */ | ||
| 1026 | + STRING_ETHADDR, /* u8 iMACAddress */ | ||
| 1027 | + 0x00, 0x00, 0x00, 0x00, /* le32 bmEthernetStatistics */ | ||
| 1028 | + ETH_FRAME_LEN & 0xff, ETH_FRAME_LEN >> 8, /* le16 wMaxSegmentSize */ | ||
| 1029 | + 0x00, 0x00, /* le16 wNumberMCFilters */ | ||
| 1030 | + 0x00, /* u8 bNumberPowerFilters */ | ||
| 1031 | + /* Status Descriptor */ | ||
| 1032 | + 0x07, /* u8 bLength */ | ||
| 1033 | + USB_DT_ENDPOINT, /* u8 bDescriptorType */ | ||
| 1034 | + USB_DIR_IN | 1, /* u8 bEndpointAddress */ | ||
| 1035 | + USB_ENDPOINT_XFER_INT, /* u8 bmAttributes */ | ||
| 1036 | + STATUS_BYTECOUNT & 0xff, STATUS_BYTECOUNT >> 8, /* le16 wMaxPacketSize */ | ||
| 1037 | + 1 << LOG2_STATUS_INTERVAL_MSEC, /* u8 bInterval */ | ||
| 1038 | + /* CDC Data (nop) Interface */ | ||
| 1039 | + 0x09, /* u8 bLength */ | ||
| 1040 | + USB_DT_INTERFACE, /* u8 bDescriptorType */ | ||
| 1041 | + 0x01, /* u8 bInterfaceNumber */ | ||
| 1042 | + 0x00, /* u8 bAlternateSetting */ | ||
| 1043 | + 0x00, /* u8 bNumEndpoints */ | ||
| 1044 | + USB_CLASS_CDC_DATA, /* u8 bInterfaceClass */ | ||
| 1045 | + 0x00, /* u8 bInterfaceSubClass */ | ||
| 1046 | + 0x00, /* u8 bInterfaceProtocol */ | ||
| 1047 | + 0x00, /* u8 iInterface */ | ||
| 1048 | + /* CDC Data Interface */ | ||
| 1049 | + 0x09, /* u8 bLength */ | ||
| 1050 | + USB_DT_INTERFACE, /* u8 bDescriptorType */ | ||
| 1051 | + 0x01, /* u8 bInterfaceNumber */ | ||
| 1052 | + 0x01, /* u8 bAlternateSetting */ | ||
| 1053 | + 0x02, /* u8 bNumEndpoints */ | ||
| 1054 | + USB_CLASS_CDC_DATA, /* u8 bInterfaceClass */ | ||
| 1055 | + 0x00, /* u8 bInterfaceSubClass */ | ||
| 1056 | + 0x00, /* u8 bInterfaceProtocol */ | ||
| 1057 | + STRING_DATA, /* u8 iInterface */ | ||
| 1058 | + /* Source Endpoint */ | ||
| 1059 | + 0x07, /* u8 bLength */ | ||
| 1060 | + USB_DT_ENDPOINT, /* u8 bDescriptorType */ | ||
| 1061 | + USB_DIR_IN | 2, /* u8 bEndpointAddress */ | ||
| 1062 | + USB_ENDPOINT_XFER_BULK, /* u8 bmAttributes */ | ||
| 1063 | + 0x40, 0x00, /* le16 wMaxPacketSize */ | ||
| 1064 | + 0x00, /* u8 bInterval */ | ||
| 1065 | + /* Sink Endpoint */ | ||
| 1066 | + 0x07, /* u8 bLength */ | ||
| 1067 | + USB_DT_ENDPOINT, /* u8 bDescriptorType */ | ||
| 1068 | + USB_DIR_OUT | 2, /* u8 bEndpointAddress */ | ||
| 1069 | + USB_ENDPOINT_XFER_BULK, /* u8 bmAttributes */ | ||
| 1070 | + 0x40, 0x00, /* le16 wMaxPacketSize */ | ||
| 1071 | + 0x00 /* u8 bInterval */ | ||
| 1072 | +}; | ||
| 1073 | + | ||
| 1074 | +/* | ||
| 1075 | + * RNDIS Status | ||
| 1076 | + */ | ||
| 1077 | + | ||
| 1078 | +#define RNDIS_MAXIMUM_FRAME_SIZE 1518 | ||
| 1079 | +#define RNDIS_MAX_TOTAL_SIZE 1558 | ||
| 1080 | + | ||
| 1081 | +/* Remote NDIS Versions */ | ||
| 1082 | +#define RNDIS_MAJOR_VERSION 1 | ||
| 1083 | +#define RNDIS_MINOR_VERSION 0 | ||
| 1084 | + | ||
| 1085 | +/* Status Values */ | ||
| 1086 | +#define RNDIS_STATUS_SUCCESS 0x00000000U /* Success */ | ||
| 1087 | +#define RNDIS_STATUS_FAILURE 0xC0000001U /* Unspecified error */ | ||
| 1088 | +#define RNDIS_STATUS_INVALID_DATA 0xC0010015U /* Invalid data */ | ||
| 1089 | +#define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBU /* Unsupported request */ | ||
| 1090 | +#define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BU /* Device connected */ | ||
| 1091 | +#define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CU /* Device disconnected */ | ||
| 1092 | + | ||
| 1093 | +/* Message Set for Connectionless (802.3) Devices */ | ||
| 1094 | +#define REMOTE_NDIS_PACKET_MSG 0x00000001U | ||
| 1095 | +#define REMOTE_NDIS_INITIALIZE_MSG 0x00000002U /* Initialize device */ | ||
| 1096 | +#define REMOTE_NDIS_HALT_MSG 0x00000003U | ||
| 1097 | +#define REMOTE_NDIS_QUERY_MSG 0x00000004U | ||
| 1098 | +#define REMOTE_NDIS_SET_MSG 0x00000005U | ||
| 1099 | +#define REMOTE_NDIS_RESET_MSG 0x00000006U | ||
| 1100 | +#define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007U | ||
| 1101 | +#define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008U | ||
| 1102 | + | ||
| 1103 | +/* Message completion */ | ||
| 1104 | +#define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002U | ||
| 1105 | +#define REMOTE_NDIS_QUERY_CMPLT 0x80000004U | ||
| 1106 | +#define REMOTE_NDIS_SET_CMPLT 0x80000005U | ||
| 1107 | +#define REMOTE_NDIS_RESET_CMPLT 0x80000006U | ||
| 1108 | +#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008U | ||
| 1109 | + | ||
| 1110 | +/* Device Flags */ | ||
| 1111 | +#define RNDIS_DF_CONNECTIONLESS 0x00000001U | ||
| 1112 | +#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002U | ||
| 1113 | + | ||
| 1114 | +#define RNDIS_MEDIUM_802_3 0x00000000U | ||
| 1115 | + | ||
| 1116 | +/* from drivers/net/sk98lin/h/skgepnmi.h */ | ||
| 1117 | +#define OID_PNP_CAPABILITIES 0xFD010100 | ||
| 1118 | +#define OID_PNP_SET_POWER 0xFD010101 | ||
| 1119 | +#define OID_PNP_QUERY_POWER 0xFD010102 | ||
| 1120 | +#define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103 | ||
| 1121 | +#define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104 | ||
| 1122 | +#define OID_PNP_ENABLE_WAKE_UP 0xFD010106 | ||
| 1123 | + | ||
| 1124 | +typedef struct rndis_init_msg_type | ||
| 1125 | +{ | ||
| 1126 | + __le32 MessageType; | ||
| 1127 | + __le32 MessageLength; | ||
| 1128 | + __le32 RequestID; | ||
| 1129 | + __le32 MajorVersion; | ||
| 1130 | + __le32 MinorVersion; | ||
| 1131 | + __le32 MaxTransferSize; | ||
| 1132 | +} rndis_init_msg_type; | ||
| 1133 | + | ||
| 1134 | +typedef struct rndis_init_cmplt_type | ||
| 1135 | +{ | ||
| 1136 | + __le32 MessageType; | ||
| 1137 | + __le32 MessageLength; | ||
| 1138 | + __le32 RequestID; | ||
| 1139 | + __le32 Status; | ||
| 1140 | + __le32 MajorVersion; | ||
| 1141 | + __le32 MinorVersion; | ||
| 1142 | + __le32 DeviceFlags; | ||
| 1143 | + __le32 Medium; | ||
| 1144 | + __le32 MaxPacketsPerTransfer; | ||
| 1145 | + __le32 MaxTransferSize; | ||
| 1146 | + __le32 PacketAlignmentFactor; | ||
| 1147 | + __le32 AFListOffset; | ||
| 1148 | + __le32 AFListSize; | ||
| 1149 | +} rndis_init_cmplt_type; | ||
| 1150 | + | ||
| 1151 | +typedef struct rndis_halt_msg_type | ||
| 1152 | +{ | ||
| 1153 | + __le32 MessageType; | ||
| 1154 | + __le32 MessageLength; | ||
| 1155 | + __le32 RequestID; | ||
| 1156 | +} rndis_halt_msg_type; | ||
| 1157 | + | ||
| 1158 | +typedef struct rndis_query_msg_type | ||
| 1159 | +{ | ||
| 1160 | + __le32 MessageType; | ||
| 1161 | + __le32 MessageLength; | ||
| 1162 | + __le32 RequestID; | ||
| 1163 | + __le32 OID; | ||
| 1164 | + __le32 InformationBufferLength; | ||
| 1165 | + __le32 InformationBufferOffset; | ||
| 1166 | + __le32 DeviceVcHandle; | ||
| 1167 | +} rndis_query_msg_type; | ||
| 1168 | + | ||
| 1169 | +typedef struct rndis_query_cmplt_type | ||
| 1170 | +{ | ||
| 1171 | + __le32 MessageType; | ||
| 1172 | + __le32 MessageLength; | ||
| 1173 | + __le32 RequestID; | ||
| 1174 | + __le32 Status; | ||
| 1175 | + __le32 InformationBufferLength; | ||
| 1176 | + __le32 InformationBufferOffset; | ||
| 1177 | +} rndis_query_cmplt_type; | ||
| 1178 | + | ||
| 1179 | +typedef struct rndis_set_msg_type | ||
| 1180 | +{ | ||
| 1181 | + __le32 MessageType; | ||
| 1182 | + __le32 MessageLength; | ||
| 1183 | + __le32 RequestID; | ||
| 1184 | + __le32 OID; | ||
| 1185 | + __le32 InformationBufferLength; | ||
| 1186 | + __le32 InformationBufferOffset; | ||
| 1187 | + __le32 DeviceVcHandle; | ||
| 1188 | +} rndis_set_msg_type; | ||
| 1189 | + | ||
| 1190 | +typedef struct rndis_set_cmplt_type | ||
| 1191 | +{ | ||
| 1192 | + __le32 MessageType; | ||
| 1193 | + __le32 MessageLength; | ||
| 1194 | + __le32 RequestID; | ||
| 1195 | + __le32 Status; | ||
| 1196 | +} rndis_set_cmplt_type; | ||
| 1197 | + | ||
| 1198 | +typedef struct rndis_reset_msg_type | ||
| 1199 | +{ | ||
| 1200 | + __le32 MessageType; | ||
| 1201 | + __le32 MessageLength; | ||
| 1202 | + __le32 Reserved; | ||
| 1203 | +} rndis_reset_msg_type; | ||
| 1204 | + | ||
| 1205 | +typedef struct rndis_reset_cmplt_type | ||
| 1206 | +{ | ||
| 1207 | + __le32 MessageType; | ||
| 1208 | + __le32 MessageLength; | ||
| 1209 | + __le32 Status; | ||
| 1210 | + __le32 AddressingReset; | ||
| 1211 | +} rndis_reset_cmplt_type; | ||
| 1212 | + | ||
| 1213 | +typedef struct rndis_indicate_status_msg_type | ||
| 1214 | +{ | ||
| 1215 | + __le32 MessageType; | ||
| 1216 | + __le32 MessageLength; | ||
| 1217 | + __le32 Status; | ||
| 1218 | + __le32 StatusBufferLength; | ||
| 1219 | + __le32 StatusBufferOffset; | ||
| 1220 | +} rndis_indicate_status_msg_type; | ||
| 1221 | + | ||
| 1222 | +typedef struct rndis_keepalive_msg_type | ||
| 1223 | +{ | ||
| 1224 | + __le32 MessageType; | ||
| 1225 | + __le32 MessageLength; | ||
| 1226 | + __le32 RequestID; | ||
| 1227 | +} rndis_keepalive_msg_type; | ||
| 1228 | + | ||
| 1229 | +typedef struct rndis_keepalive_cmplt_type | ||
| 1230 | +{ | ||
| 1231 | + __le32 MessageType; | ||
| 1232 | + __le32 MessageLength; | ||
| 1233 | + __le32 RequestID; | ||
| 1234 | + __le32 Status; | ||
| 1235 | +} rndis_keepalive_cmplt_type; | ||
| 1236 | + | ||
| 1237 | +struct rndis_packet_msg_type | ||
| 1238 | +{ | ||
| 1239 | + __le32 MessageType; | ||
| 1240 | + __le32 MessageLength; | ||
| 1241 | + __le32 DataOffset; | ||
| 1242 | + __le32 DataLength; | ||
| 1243 | + __le32 OOBDataOffset; | ||
| 1244 | + __le32 OOBDataLength; | ||
| 1245 | + __le32 NumOOBDataElements; | ||
| 1246 | + __le32 PerPacketInfoOffset; | ||
| 1247 | + __le32 PerPacketInfoLength; | ||
| 1248 | + __le32 VcHandle; | ||
| 1249 | + __le32 Reserved; | ||
| 1250 | +}; | ||
| 1251 | + | ||
| 1252 | +struct rndis_config_parameter | ||
| 1253 | +{ | ||
| 1254 | + __le32 ParameterNameOffset; | ||
| 1255 | + __le32 ParameterNameLength; | ||
| 1256 | + __le32 ParameterType; | ||
| 1257 | + __le32 ParameterValueOffset; | ||
| 1258 | + __le32 ParameterValueLength; | ||
| 1259 | +}; | ||
| 1260 | + | ||
| 1261 | +/* implementation specific */ | ||
| 1262 | +enum rndis_state | ||
| 1263 | +{ | ||
| 1264 | + RNDIS_UNINITIALIZED, | ||
| 1265 | + RNDIS_INITIALIZED, | ||
| 1266 | + RNDIS_DATA_INITIALIZED, | ||
| 1267 | +}; | ||
| 1268 | + | ||
| 1269 | +static const uint32_t oid_supported_list[] = | ||
| 1270 | +{ | ||
| 1271 | + /* the general stuff */ | ||
| 1272 | + OID_GEN_SUPPORTED_LIST, | ||
| 1273 | + OID_GEN_HARDWARE_STATUS, | ||
| 1274 | + OID_GEN_MEDIA_SUPPORTED, | ||
| 1275 | + OID_GEN_MEDIA_IN_USE, | ||
| 1276 | + OID_GEN_MAXIMUM_FRAME_SIZE, | ||
| 1277 | + OID_GEN_LINK_SPEED, | ||
| 1278 | + OID_GEN_TRANSMIT_BLOCK_SIZE, | ||
| 1279 | + OID_GEN_RECEIVE_BLOCK_SIZE, | ||
| 1280 | + OID_GEN_VENDOR_ID, | ||
| 1281 | + OID_GEN_VENDOR_DESCRIPTION, | ||
| 1282 | + OID_GEN_VENDOR_DRIVER_VERSION, | ||
| 1283 | + OID_GEN_CURRENT_PACKET_FILTER, | ||
| 1284 | + OID_GEN_MAXIMUM_TOTAL_SIZE, | ||
| 1285 | + OID_GEN_MEDIA_CONNECT_STATUS, | ||
| 1286 | + OID_GEN_PHYSICAL_MEDIUM, | ||
| 1287 | + /* the statistical stuff */ | ||
| 1288 | + OID_GEN_XMIT_OK, | ||
| 1289 | + OID_GEN_RCV_OK, | ||
| 1290 | + OID_GEN_XMIT_ERROR, | ||
| 1291 | + OID_GEN_RCV_ERROR, | ||
| 1292 | + OID_GEN_RCV_NO_BUFFER, | ||
| 1293 | + /* mandatory 802.3 */ | ||
| 1294 | + /* the general stuff */ | ||
| 1295 | + OID_802_3_PERMANENT_ADDRESS, | ||
| 1296 | + OID_802_3_CURRENT_ADDRESS, | ||
| 1297 | + OID_802_3_MULTICAST_LIST, | ||
| 1298 | + OID_802_3_MAC_OPTIONS, | ||
| 1299 | + OID_802_3_MAXIMUM_LIST_SIZE, | ||
| 1300 | + | ||
| 1301 | + /* the statistical stuff */ | ||
| 1302 | + OID_802_3_RCV_ERROR_ALIGNMENT, | ||
| 1303 | + OID_802_3_XMIT_ONE_COLLISION, | ||
| 1304 | + OID_802_3_XMIT_MORE_COLLISIONS | ||
| 1305 | +}; | ||
| 1306 | + | ||
| 1307 | +struct rndis_response { | ||
| 1308 | + TAILQ_ENTRY(rndis_response) entries; | ||
| 1309 | + uint32_t length; | ||
| 1310 | + uint8_t buf[0]; | ||
| 1311 | +}; | ||
| 1312 | + | ||
| 1313 | + | ||
| 1314 | +typedef struct USBNetState { | ||
| 1315 | + USBDevice dev; | ||
| 1316 | + | ||
| 1317 | + unsigned int rndis; | ||
| 1318 | + enum rndis_state rndis_state; | ||
| 1319 | + uint32_t medium; | ||
| 1320 | + uint32_t speed; | ||
| 1321 | + uint32_t media_state; | ||
| 1322 | + uint16_t filter; | ||
| 1323 | + uint32_t vendorid; | ||
| 1324 | + uint8_t mac[6]; | ||
| 1325 | + | ||
| 1326 | + unsigned int out_ptr; | ||
| 1327 | + uint8_t out_buf[2048]; | ||
| 1328 | + | ||
| 1329 | + USBPacket *inpkt; | ||
| 1330 | + unsigned int in_ptr, in_len; | ||
| 1331 | + uint8_t in_buf[2048]; | ||
| 1332 | + | ||
| 1333 | + VLANClientState *vc; | ||
| 1334 | + TAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp; | ||
| 1335 | +} USBNetState; | ||
| 1336 | + | ||
| 1337 | + | ||
| 1338 | +static int ndis_query(USBNetState *s, uint32_t oid, uint8_t *inbuf, unsigned int inlen, uint8_t *outbuf) | ||
| 1339 | +{ | ||
| 1340 | + switch (oid) { | ||
| 1341 | + /* general oids (table 4-1) */ | ||
| 1342 | + /* mandatory */ | ||
| 1343 | + case OID_GEN_SUPPORTED_LIST: | ||
| 1344 | + { | ||
| 1345 | + unsigned int i, count = sizeof(oid_supported_list) / sizeof(uint32_t); | ||
| 1346 | + for (i = 0; i < count; i++) | ||
| 1347 | + ((__le32 *)outbuf)[i] = cpu_to_le32(oid_supported_list[i]); | ||
| 1348 | + return sizeof(oid_supported_list); | ||
| 1349 | + } | ||
| 1350 | + | ||
| 1351 | + /* mandatory */ | ||
| 1352 | + case OID_GEN_HARDWARE_STATUS: | ||
| 1353 | + *((__le32 *)outbuf) = cpu_to_le32(0); | ||
| 1354 | + return sizeof(__le32); | ||
| 1355 | + | ||
| 1356 | + /* mandatory */ | ||
| 1357 | + case OID_GEN_MEDIA_SUPPORTED: | ||
| 1358 | + *((__le32 *)outbuf) = cpu_to_le32(s->medium); | ||
| 1359 | + return sizeof(__le32); | ||
| 1360 | + | ||
| 1361 | + /* mandatory */ | ||
| 1362 | + case OID_GEN_MEDIA_IN_USE: | ||
| 1363 | + *((__le32 *)outbuf) = cpu_to_le32(s->medium); | ||
| 1364 | + return sizeof(__le32); | ||
| 1365 | + | ||
| 1366 | + /* mandatory */ | ||
| 1367 | + case OID_GEN_MAXIMUM_FRAME_SIZE: | ||
| 1368 | + *((__le32 *)outbuf) = cpu_to_le32(ETH_FRAME_LEN); | ||
| 1369 | + return sizeof(__le32); | ||
| 1370 | + | ||
| 1371 | + /* mandatory */ | ||
| 1372 | + case OID_GEN_LINK_SPEED: | ||
| 1373 | + *((__le32 *)outbuf) = cpu_to_le32(s->speed); | ||
| 1374 | + return sizeof(__le32); | ||
| 1375 | + | ||
| 1376 | + /* mandatory */ | ||
| 1377 | + case OID_GEN_TRANSMIT_BLOCK_SIZE: | ||
| 1378 | + *((__le32 *)outbuf) = cpu_to_le32(ETH_FRAME_LEN); | ||
| 1379 | + return sizeof(__le32); | ||
| 1380 | + | ||
| 1381 | + /* mandatory */ | ||
| 1382 | + case OID_GEN_RECEIVE_BLOCK_SIZE: | ||
| 1383 | + *((__le32 *)outbuf) = cpu_to_le32(ETH_FRAME_LEN); | ||
| 1384 | + return sizeof(__le32); | ||
| 1385 | + | ||
| 1386 | + /* mandatory */ | ||
| 1387 | + case OID_GEN_VENDOR_ID: | ||
| 1388 | + *((__le32 *)outbuf) = cpu_to_le32(0x1234); | ||
| 1389 | + return sizeof(__le32); | ||
| 1390 | + | ||
| 1391 | + /* mandatory */ | ||
| 1392 | + case OID_GEN_VENDOR_DESCRIPTION: | ||
| 1393 | + strcpy(outbuf, "QEMU USB RNDIS Net"); | ||
| 1394 | + return strlen(outbuf) + 1; | ||
| 1395 | + | ||
| 1396 | + case OID_GEN_VENDOR_DRIVER_VERSION: | ||
| 1397 | + *((__le32 *)outbuf) = cpu_to_le32(1); | ||
| 1398 | + return sizeof(__le32); | ||
| 1399 | + | ||
| 1400 | + /* mandatory */ | ||
| 1401 | + case OID_GEN_CURRENT_PACKET_FILTER: | ||
| 1402 | + *((__le32 *)outbuf) = cpu_to_le32(s->filter); | ||
| 1403 | + return sizeof(__le32); | ||
| 1404 | + | ||
| 1405 | + /* mandatory */ | ||
| 1406 | + case OID_GEN_MAXIMUM_TOTAL_SIZE: | ||
| 1407 | + *((__le32 *)outbuf) = cpu_to_le32(RNDIS_MAX_TOTAL_SIZE); | ||
| 1408 | + return sizeof(__le32); | ||
| 1409 | + | ||
| 1410 | + /* mandatory */ | ||
| 1411 | + case OID_GEN_MEDIA_CONNECT_STATUS: | ||
| 1412 | + *((__le32 *)outbuf) = cpu_to_le32(s->media_state); | ||
| 1413 | + return sizeof(__le32); | ||
| 1414 | + | ||
| 1415 | + case OID_GEN_PHYSICAL_MEDIUM: | ||
| 1416 | + *((__le32 *)outbuf) = cpu_to_le32(0); | ||
| 1417 | + return sizeof(__le32); | ||
| 1418 | + | ||
| 1419 | + case OID_GEN_MAC_OPTIONS: | ||
| 1420 | + *((__le32 *)outbuf) = cpu_to_le32(NDIS_MAC_OPTION_RECEIVE_SERIALIZED | NDIS_MAC_OPTION_FULL_DUPLEX); | ||
| 1421 | + return sizeof(__le32); | ||
| 1422 | + | ||
| 1423 | + /* statistics OIDs (table 4-2) */ | ||
| 1424 | + /* mandatory */ | ||
| 1425 | + case OID_GEN_XMIT_OK: | ||
| 1426 | + *((__le32 *)outbuf) = cpu_to_le32(0); | ||
| 1427 | + return sizeof(__le32); | ||
| 1428 | + | ||
| 1429 | + /* mandatory */ | ||
| 1430 | + case OID_GEN_RCV_OK: | ||
| 1431 | + *((__le32 *)outbuf) = cpu_to_le32(0); | ||
| 1432 | + return sizeof(__le32); | ||
| 1433 | + | ||
| 1434 | + /* mandatory */ | ||
| 1435 | + case OID_GEN_XMIT_ERROR: | ||
| 1436 | + *((__le32 *)outbuf) = cpu_to_le32(0); | ||
| 1437 | + return sizeof(__le32); | ||
| 1438 | + | ||
| 1439 | + /* mandatory */ | ||
| 1440 | + case OID_GEN_RCV_ERROR: | ||
| 1441 | + *((__le32 *)outbuf) = cpu_to_le32(0); | ||
| 1442 | + return sizeof(__le32); | ||
| 1443 | + | ||
| 1444 | + /* mandatory */ | ||
| 1445 | + case OID_GEN_RCV_NO_BUFFER: | ||
| 1446 | + *((__le32 *)outbuf) = cpu_to_le32(0); | ||
| 1447 | + return sizeof(__le32); | ||
| 1448 | + | ||
| 1449 | + /* ieee802.3 OIDs (table 4-3) */ | ||
| 1450 | + /* mandatory */ | ||
| 1451 | + case OID_802_3_PERMANENT_ADDRESS: | ||
| 1452 | + memcpy(outbuf, s->mac, 6); | ||
| 1453 | + return 6; | ||
| 1454 | + | ||
| 1455 | + /* mandatory */ | ||
| 1456 | + case OID_802_3_CURRENT_ADDRESS: | ||
| 1457 | + memcpy(outbuf, s->mac, 6); | ||
| 1458 | + return 6; | ||
| 1459 | + | ||
| 1460 | + /* mandatory */ | ||
| 1461 | + case OID_802_3_MULTICAST_LIST: | ||
| 1462 | + *((__le32 *)outbuf) = cpu_to_le32(0xE0000000); | ||
| 1463 | + return sizeof(__le32); | ||
| 1464 | + | ||
| 1465 | + /* mandatory */ | ||
| 1466 | + case OID_802_3_MAXIMUM_LIST_SIZE: | ||
| 1467 | + *((__le32 *)outbuf) = cpu_to_le32(1); | ||
| 1468 | + return sizeof(__le32); | ||
| 1469 | + | ||
| 1470 | + case OID_802_3_MAC_OPTIONS: | ||
| 1471 | + return 0; | ||
| 1472 | + | ||
| 1473 | + /* ieee802.3 statistics OIDs (table 4-4) */ | ||
| 1474 | + /* mandatory */ | ||
| 1475 | + case OID_802_3_RCV_ERROR_ALIGNMENT: | ||
| 1476 | + *((__le32 *)outbuf) = cpu_to_le32(0); | ||
| 1477 | + return sizeof(__le32); | ||
| 1478 | + | ||
| 1479 | + /* mandatory */ | ||
| 1480 | + case OID_802_3_XMIT_ONE_COLLISION: | ||
| 1481 | + *((__le32 *)outbuf) = cpu_to_le32(0); | ||
| 1482 | + return sizeof(__le32); | ||
| 1483 | + | ||
| 1484 | + /* mandatory */ | ||
| 1485 | + case OID_802_3_XMIT_MORE_COLLISIONS: | ||
| 1486 | + *((__le32 *)outbuf) = cpu_to_le32(0); | ||
| 1487 | + return sizeof(__le32); | ||
| 1488 | + | ||
| 1489 | + default: | ||
| 1490 | + fprintf(stderr, "usbnet: unknown OID 0x%08x\n", oid); | ||
| 1491 | + return 0; | ||
| 1492 | + } | ||
| 1493 | + return -1; | ||
| 1494 | +} | ||
| 1495 | + | ||
| 1496 | +static int ndis_set(USBNetState *s, uint32_t oid, uint8_t *inbuf, unsigned int inlen) | ||
| 1497 | +{ | ||
| 1498 | + switch (oid) { | ||
| 1499 | + case OID_GEN_CURRENT_PACKET_FILTER: | ||
| 1500 | + s->filter = le32_to_cpup((__le32 *)inbuf); | ||
| 1501 | + if (s->filter) { | ||
| 1502 | + s->rndis_state = RNDIS_DATA_INITIALIZED; | ||
| 1503 | + } else { | ||
| 1504 | + s->rndis_state = RNDIS_INITIALIZED; | ||
| 1505 | + } | ||
| 1506 | + return 0; | ||
| 1507 | + | ||
| 1508 | + case OID_802_3_MULTICAST_LIST: | ||
| 1509 | + return 0; | ||
| 1510 | + | ||
| 1511 | + } | ||
| 1512 | + return -1; | ||
| 1513 | +} | ||
| 1514 | + | ||
| 1515 | +static int rndis_get_response(USBNetState *s, uint8_t *buf) | ||
| 1516 | +{ | ||
| 1517 | + int ret = 0; | ||
| 1518 | + struct rndis_response *r = s->rndis_resp.tqh_first; | ||
| 1519 | + if (!r) | ||
| 1520 | + return ret; | ||
| 1521 | + TAILQ_REMOVE(&s->rndis_resp, r, entries); | ||
| 1522 | + ret = r->length; | ||
| 1523 | + memcpy(buf, r->buf, r->length); | ||
| 1524 | + qemu_free(r); | ||
| 1525 | + return ret; | ||
| 1526 | +} | ||
| 1527 | + | ||
| 1528 | +static void *rndis_queue_response(USBNetState *s, unsigned int length) | ||
| 1529 | +{ | ||
| 1530 | + struct rndis_response *r = qemu_mallocz(sizeof(struct rndis_response) + length); | ||
| 1531 | + if (!r) | ||
| 1532 | + return NULL; | ||
| 1533 | + TAILQ_INSERT_TAIL(&s->rndis_resp, r, entries); | ||
| 1534 | + r->length = length; | ||
| 1535 | + return &r->buf[0]; | ||
| 1536 | +} | ||
| 1537 | + | ||
| 1538 | +static void rndis_clear_responsequeue(USBNetState *s) | ||
| 1539 | +{ | ||
| 1540 | + struct rndis_response *r; | ||
| 1541 | + | ||
| 1542 | + while ((r = s->rndis_resp.tqh_first)) { | ||
| 1543 | + TAILQ_REMOVE(&s->rndis_resp, r, entries); | ||
| 1544 | + qemu_free(r); | ||
| 1545 | + } | ||
| 1546 | +} | ||
| 1547 | + | ||
| 1548 | +static int rndis_init_response(USBNetState *s, rndis_init_msg_type *buf) | ||
| 1549 | +{ | ||
| 1550 | + rndis_init_cmplt_type *resp = rndis_queue_response(s, sizeof(rndis_init_cmplt_type)); | ||
| 1551 | + if (!resp) | ||
| 1552 | + return USB_RET_STALL; | ||
| 1553 | + resp->MessageType = cpu_to_le32(REMOTE_NDIS_INITIALIZE_CMPLT); | ||
| 1554 | + resp->MessageLength = cpu_to_le32(sizeof(rndis_init_cmplt_type)); | ||
| 1555 | + resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ | ||
| 1556 | + resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS); | ||
| 1557 | + resp->MajorVersion = cpu_to_le32(RNDIS_MAJOR_VERSION); | ||
| 1558 | + resp->MinorVersion = cpu_to_le32(RNDIS_MINOR_VERSION); | ||
| 1559 | + resp->DeviceFlags = cpu_to_le32(RNDIS_DF_CONNECTIONLESS); | ||
| 1560 | + resp->Medium = cpu_to_le32(RNDIS_MEDIUM_802_3); | ||
| 1561 | + resp->MaxPacketsPerTransfer = cpu_to_le32(1); | ||
| 1562 | + resp->MaxTransferSize = cpu_to_le32(ETH_FRAME_LEN + sizeof(struct rndis_packet_msg_type) + 22); | ||
| 1563 | + resp->PacketAlignmentFactor = cpu_to_le32(0); | ||
| 1564 | + resp->AFListOffset = cpu_to_le32(0); | ||
| 1565 | + resp->AFListSize = cpu_to_le32(0); | ||
| 1566 | + return 0; | ||
| 1567 | +} | ||
| 1568 | + | ||
| 1569 | +static int rndis_query_response(USBNetState *s, rndis_query_msg_type *buf, unsigned int length) | ||
| 1570 | +{ | ||
| 1571 | + rndis_query_cmplt_type *resp; | ||
| 1572 | + uint8_t infobuf[sizeof(oid_supported_list)]; /* oid_supported_list is the largest data reply */ | ||
| 1573 | + uint32_t bufoffs, buflen; | ||
| 1574 | + int infobuflen; | ||
| 1575 | + unsigned int resplen; | ||
| 1576 | + bufoffs = le32_to_cpu(buf->InformationBufferOffset) + 8; | ||
| 1577 | + buflen = le32_to_cpu(buf->InformationBufferLength); | ||
| 1578 | + if (bufoffs + buflen > length) | ||
| 1579 | + return USB_RET_STALL; | ||
| 1580 | + infobuflen = ndis_query(s, le32_to_cpu(buf->OID), bufoffs + (uint8_t *)buf, buflen, infobuf); | ||
| 1581 | + resplen = sizeof(rndis_query_cmplt_type) + ((infobuflen < 0) ? 0 : infobuflen); | ||
| 1582 | + resp = rndis_queue_response(s, resplen); | ||
| 1583 | + if (!resp) | ||
| 1584 | + return USB_RET_STALL; | ||
| 1585 | + resp->MessageType = cpu_to_le32(REMOTE_NDIS_QUERY_CMPLT); | ||
| 1586 | + resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ | ||
| 1587 | + resp->MessageLength = cpu_to_le32(resplen); | ||
| 1588 | + if (infobuflen < 0) { | ||
| 1589 | + /* OID not supported */ | ||
| 1590 | + resp->Status = cpu_to_le32(RNDIS_STATUS_NOT_SUPPORTED); | ||
| 1591 | + resp->InformationBufferLength = cpu_to_le32(0); | ||
| 1592 | + resp->InformationBufferOffset = cpu_to_le32(0); | ||
| 1593 | + return 0; | ||
| 1594 | + } | ||
| 1595 | + resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS); | ||
| 1596 | + resp->InformationBufferOffset = cpu_to_le32(infobuflen ? sizeof(rndis_query_cmplt_type) - 8 : 0); | ||
| 1597 | + resp->InformationBufferLength = cpu_to_le32(infobuflen); | ||
| 1598 | + memcpy(resp + 1, infobuf, infobuflen); | ||
| 1599 | + return 0; | ||
| 1600 | +} | ||
| 1601 | + | ||
| 1602 | +static int rndis_set_response(USBNetState *s, rndis_set_msg_type *buf, unsigned int length) | ||
| 1603 | +{ | ||
| 1604 | + rndis_set_cmplt_type *resp = rndis_queue_response(s, sizeof(rndis_set_cmplt_type)); | ||
| 1605 | + uint32_t bufoffs, buflen; | ||
| 1606 | + if (!resp) | ||
| 1607 | + return USB_RET_STALL; | ||
| 1608 | + bufoffs = le32_to_cpu(buf->InformationBufferOffset) + 8; | ||
| 1609 | + buflen = le32_to_cpu(buf->InformationBufferLength); | ||
| 1610 | + if (bufoffs + buflen > length) | ||
| 1611 | + return USB_RET_STALL; | ||
| 1612 | + int ret = ndis_set(s, le32_to_cpu(buf->OID), bufoffs + (uint8_t *)buf, buflen); | ||
| 1613 | + resp->MessageType = cpu_to_le32(REMOTE_NDIS_SET_CMPLT); | ||
| 1614 | + resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ | ||
| 1615 | + resp->MessageLength = cpu_to_le32(sizeof(rndis_set_cmplt_type)); | ||
| 1616 | + if (ret < 0) { | ||
| 1617 | + /* OID not supported */ | ||
| 1618 | + resp->Status = cpu_to_le32(RNDIS_STATUS_NOT_SUPPORTED); | ||
| 1619 | + return 0; | ||
| 1620 | + } | ||
| 1621 | + resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS); | ||
| 1622 | + return 0; | ||
| 1623 | +} | ||
| 1624 | + | ||
| 1625 | +static int rndis_reset_response(USBNetState *s, rndis_reset_msg_type *buf) | ||
| 1626 | +{ | ||
| 1627 | + rndis_reset_cmplt_type *resp = rndis_queue_response(s, sizeof(rndis_reset_cmplt_type)); | ||
| 1628 | + if (!resp) | ||
| 1629 | + return USB_RET_STALL; | ||
| 1630 | + resp->MessageType = cpu_to_le32(REMOTE_NDIS_RESET_CMPLT); | ||
| 1631 | + resp->MessageLength = cpu_to_le32(sizeof(rndis_reset_cmplt_type)); | ||
| 1632 | + resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS); | ||
| 1633 | + /* resent information */ | ||
| 1634 | + resp->AddressingReset = cpu_to_le32(1); | ||
| 1635 | + return 0; | ||
| 1636 | +} | ||
| 1637 | + | ||
| 1638 | +static int rndis_keepalive_response(USBNetState *s, rndis_keepalive_msg_type *buf) | ||
| 1639 | +{ | ||
| 1640 | + rndis_keepalive_cmplt_type *resp = rndis_queue_response(s, sizeof(rndis_keepalive_cmplt_type)); | ||
| 1641 | + if (!resp) | ||
| 1642 | + return USB_RET_STALL; | ||
| 1643 | + resp->MessageType = cpu_to_le32(REMOTE_NDIS_KEEPALIVE_CMPLT); | ||
| 1644 | + resp->MessageLength = cpu_to_le32(sizeof(rndis_keepalive_cmplt_type)); | ||
| 1645 | + resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ | ||
| 1646 | + resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS); | ||
| 1647 | + return 0; | ||
| 1648 | +} | ||
| 1649 | + | ||
| 1650 | +static int rndis_parse(USBNetState *s, uint8_t *data, int length) | ||
| 1651 | +{ | ||
| 1652 | + uint32_t MsgType, MsgLength; | ||
| 1653 | + __le32 *tmp = (__le32 *)data; | ||
| 1654 | + MsgType = le32_to_cpup(tmp++); | ||
| 1655 | + MsgLength = le32_to_cpup(tmp++); | ||
| 1656 | + | ||
| 1657 | + switch (MsgType) { | ||
| 1658 | + case REMOTE_NDIS_INITIALIZE_MSG: | ||
| 1659 | + s->rndis_state = RNDIS_INITIALIZED; | ||
| 1660 | + return rndis_init_response(s, (rndis_init_msg_type *)data); | ||
| 1661 | + | ||
| 1662 | + case REMOTE_NDIS_HALT_MSG: | ||
| 1663 | + s->rndis_state = RNDIS_UNINITIALIZED; | ||
| 1664 | + return 0; | ||
| 1665 | + | ||
| 1666 | + case REMOTE_NDIS_QUERY_MSG: | ||
| 1667 | + return rndis_query_response(s, (rndis_query_msg_type *)data, length); | ||
| 1668 | + | ||
| 1669 | + case REMOTE_NDIS_SET_MSG: | ||
| 1670 | + return rndis_set_response(s, (rndis_set_msg_type *)data, length); | ||
| 1671 | + | ||
| 1672 | + case REMOTE_NDIS_RESET_MSG: | ||
| 1673 | + rndis_clear_responsequeue(s); | ||
| 1674 | + s->out_ptr = s->in_ptr = s->in_len = 0; | ||
| 1675 | + return rndis_reset_response(s, (rndis_reset_msg_type *)data); | ||
| 1676 | + | ||
| 1677 | + case REMOTE_NDIS_KEEPALIVE_MSG: | ||
| 1678 | + /* For USB: host does this every 5 seconds */ | ||
| 1679 | + return rndis_keepalive_response(s, (rndis_keepalive_msg_type *)data); | ||
| 1680 | + } | ||
| 1681 | + return USB_RET_STALL; | ||
| 1682 | +} | ||
| 1683 | + | ||
| 1684 | +static void usb_net_handle_reset(USBDevice *dev) | ||
| 1685 | +{ | ||
| 1686 | +} | ||
| 1687 | + | ||
| 1688 | +static int usb_net_handle_control(USBDevice *dev, int request, int value, | ||
| 1689 | + int index, int length, uint8_t *data) | ||
| 1690 | +{ | ||
| 1691 | + USBNetState *s = (USBNetState *)dev; | ||
| 1692 | + int ret = 0; | ||
| 1693 | + | ||
| 1694 | + switch(request) { | ||
| 1695 | + case DeviceRequest | USB_REQ_GET_STATUS: | ||
| 1696 | + data[0] = (1 << USB_DEVICE_SELF_POWERED) | | ||
| 1697 | + (dev->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP); | ||
| 1698 | + data[1] = 0x00; | ||
| 1699 | + ret = 2; | ||
| 1700 | + break; | ||
| 1701 | + | ||
| 1702 | + case DeviceOutRequest | USB_REQ_CLEAR_FEATURE: | ||
| 1703 | + if (value == USB_DEVICE_REMOTE_WAKEUP) { | ||
| 1704 | + dev->remote_wakeup = 0; | ||
| 1705 | + } else { | ||
| 1706 | + goto fail; | ||
| 1707 | + } | ||
| 1708 | + ret = 0; | ||
| 1709 | + break; | ||
| 1710 | + | ||
| 1711 | + case DeviceOutRequest | USB_REQ_SET_FEATURE: | ||
| 1712 | + if (value == USB_DEVICE_REMOTE_WAKEUP) { | ||
| 1713 | + dev->remote_wakeup = 1; | ||
| 1714 | + } else { | ||
| 1715 | + goto fail; | ||
| 1716 | + } | ||
| 1717 | + ret = 0; | ||
| 1718 | + break; | ||
| 1719 | + | ||
| 1720 | + case DeviceOutRequest | USB_REQ_SET_ADDRESS: | ||
| 1721 | + dev->addr = value; | ||
| 1722 | + ret = 0; | ||
| 1723 | + break; | ||
| 1724 | + | ||
| 1725 | + case ClassInterfaceOutRequest | USB_CDC_SEND_ENCAPSULATED_COMMAND: | ||
| 1726 | + if (!s->rndis || value || index != 0) | ||
| 1727 | + goto fail; | ||
| 1728 | +#if TRAFFIC_DEBUG | ||
| 1729 | + { | ||
| 1730 | + unsigned int i; | ||
| 1731 | + fprintf(stderr, "SEND_ENCAPSULATED_COMMAND:"); | ||
| 1732 | + for (i = 0; i < length; i++) { | ||
| 1733 | + if (!(i & 15)) | ||
| 1734 | + fprintf(stderr, "\n%04X:", i); | ||
| 1735 | + fprintf(stderr, " %02X", data[i]); | ||
| 1736 | + } | ||
| 1737 | + fprintf(stderr, "\n\n"); | ||
| 1738 | + } | ||
| 1739 | +#endif | ||
| 1740 | + ret = rndis_parse(s, data, length); | ||
| 1741 | + break; | ||
| 1742 | + | ||
| 1743 | + case ClassInterfaceRequest | USB_CDC_GET_ENCAPSULATED_RESPONSE: | ||
| 1744 | + if (!s->rndis || value || index != 0) | ||
| 1745 | + goto fail; | ||
| 1746 | + ret = rndis_get_response(s, data); | ||
| 1747 | + if (!ret) { | ||
| 1748 | + data[0] = 0; | ||
| 1749 | + ret = 1; | ||
| 1750 | + } | ||
| 1751 | +#if TRAFFIC_DEBUG | ||
| 1752 | + { | ||
| 1753 | + unsigned int i; | ||
| 1754 | + fprintf(stderr, "GET_ENCAPSULATED_RESPONSE:"); | ||
| 1755 | + for (i = 0; i < ret; i++) { | ||
| 1756 | + if (!(i & 15)) | ||
| 1757 | + fprintf(stderr, "\n%04X:", i); | ||
| 1758 | + fprintf(stderr, " %02X", data[i]); | ||
| 1759 | + } | ||
| 1760 | + fprintf(stderr, "\n\n"); | ||
| 1761 | + } | ||
| 1762 | +#endif | ||
| 1763 | + break; | ||
| 1764 | + | ||
| 1765 | + case DeviceRequest | USB_REQ_GET_DESCRIPTOR: | ||
| 1766 | + switch(value >> 8) { | ||
| 1767 | + case USB_DT_DEVICE: | ||
| 1768 | + ret = sizeof(qemu_net_dev_descriptor); | ||
| 1769 | + memcpy(data, qemu_net_dev_descriptor, ret); | ||
| 1770 | + break; | ||
| 1771 | + | ||
| 1772 | + case USB_DT_CONFIG: | ||
| 1773 | + switch (value & 0xff) { | ||
| 1774 | + case 0: | ||
| 1775 | + ret = sizeof(qemu_net_rndis_config_descriptor); | ||
| 1776 | + memcpy(data, qemu_net_rndis_config_descriptor, | ||
| 1777 | + ret); | ||
| 1778 | + break; | ||
| 1779 | + | ||
| 1780 | + case 1: | ||
| 1781 | + ret = sizeof(qemu_net_cdc_config_descriptor); | ||
| 1782 | + memcpy(data, qemu_net_cdc_config_descriptor, | ||
| 1783 | + ret); | ||
| 1784 | + break; | ||
| 1785 | + | ||
| 1786 | + default: | ||
| 1787 | + goto fail; | ||
| 1788 | + } | ||
| 1789 | + data[2] = ret & 0xff; | ||
| 1790 | + data[3] = ret >> 8; | ||
| 1791 | + break; | ||
| 1792 | + | ||
| 1793 | + case USB_DT_STRING: | ||
| 1794 | + switch (value & 0xff) { | ||
| 1795 | + case 0: | ||
| 1796 | + /* language ids */ | ||
| 1797 | + data[0] = 4; | ||
| 1798 | + data[1] = 3; | ||
| 1799 | + data[2] = 0x09; | ||
| 1800 | + data[3] = 0x04; | ||
| 1801 | + ret = 4; | ||
| 1802 | + break; | ||
| 1803 | + | ||
| 1804 | + case STRING_MANUFACTURER: | ||
| 1805 | + ret = set_usb_string(data, "QEMU"); | ||
| 1806 | + break; | ||
| 1807 | + | ||
| 1808 | + case STRING_PRODUCT: | ||
| 1809 | + ret = set_usb_string(data, "RNDIS/QEMU USB Network Device"); | ||
| 1810 | + break; | ||
| 1811 | + | ||
| 1812 | + case STRING_ETHADDR: | ||
| 1813 | + ret = set_usb_string(data, "400102030405"); | ||
| 1814 | + break; | ||
| 1815 | + | ||
| 1816 | + case STRING_DATA: | ||
| 1817 | + ret = set_usb_string(data, "QEMU USB Net Data Interface"); | ||
| 1818 | + break; | ||
| 1819 | + | ||
| 1820 | + case STRING_CONTROL: | ||
| 1821 | + ret = set_usb_string(data, "QEMU USB Net Control Interface"); | ||
| 1822 | + break; | ||
| 1823 | + | ||
| 1824 | + case STRING_RNDIS_CONTROL: | ||
| 1825 | + ret = set_usb_string(data, "QEMU USB Net RNDIS Control Interface"); | ||
| 1826 | + break; | ||
| 1827 | + | ||
| 1828 | + case STRING_CDC: | ||
| 1829 | + ret = set_usb_string(data, "QEMU USB Net CDC"); | ||
| 1830 | + break; | ||
| 1831 | + | ||
| 1832 | + case STRING_SUBSET: | ||
| 1833 | + ret = set_usb_string(data, "QEMU USB Net Subset"); | ||
| 1834 | + break; | ||
| 1835 | + | ||
| 1836 | + case STRING_RNDIS: | ||
| 1837 | + ret = set_usb_string(data, "QEMU USB Net RNDIS"); | ||
| 1838 | + break; | ||
| 1839 | + | ||
| 1840 | + case STRING_SERIALNUMBER: | ||
| 1841 | + ret = set_usb_string(data, "1"); | ||
| 1842 | + break; | ||
| 1843 | + | ||
| 1844 | + default: | ||
| 1845 | + goto fail; | ||
| 1846 | + } | ||
| 1847 | + break; | ||
| 1848 | + | ||
| 1849 | + default: | ||
| 1850 | + goto fail; | ||
| 1851 | + } | ||
| 1852 | + break; | ||
| 1853 | + | ||
| 1854 | + case DeviceRequest | USB_REQ_GET_CONFIGURATION: | ||
| 1855 | + data[0] = s->rndis ? DEV_RNDIS_CONFIG_VALUE : DEV_CONFIG_VALUE; | ||
| 1856 | + ret = 1; | ||
| 1857 | + break; | ||
| 1858 | + | ||
| 1859 | + case DeviceOutRequest | USB_REQ_SET_CONFIGURATION: | ||
| 1860 | + switch (value & 0xff) { | ||
| 1861 | + case DEV_CONFIG_VALUE: | ||
| 1862 | + s->rndis = 0; | ||
| 1863 | + break; | ||
| 1864 | + | ||
| 1865 | + case DEV_RNDIS_CONFIG_VALUE: | ||
| 1866 | + s->rndis = 1; | ||
| 1867 | + break; | ||
| 1868 | + | ||
| 1869 | + default: | ||
| 1870 | + goto fail; | ||
| 1871 | + } | ||
| 1872 | + ret = 0; | ||
| 1873 | + break; | ||
| 1874 | + | ||
| 1875 | + case DeviceRequest | USB_REQ_GET_INTERFACE: | ||
| 1876 | + case InterfaceRequest | USB_REQ_GET_INTERFACE: | ||
| 1877 | + data[0] = 0; | ||
| 1878 | + ret = 1; | ||
| 1879 | + break; | ||
| 1880 | + | ||
| 1881 | + case DeviceOutRequest | USB_REQ_SET_INTERFACE: | ||
| 1882 | + case InterfaceOutRequest | USB_REQ_SET_INTERFACE: | ||
| 1883 | + ret = 0; | ||
| 1884 | + break; | ||
| 1885 | + | ||
| 1886 | + default: | ||
| 1887 | + fail: | ||
| 1888 | + fprintf(stderr, "usbnet: failed control transaction: request 0x%x value 0x%x index 0x%x length 0x%x\n", | ||
| 1889 | + request, value, index, length); | ||
| 1890 | + ret = USB_RET_STALL; | ||
| 1891 | + break; | ||
| 1892 | + } | ||
| 1893 | + return ret; | ||
| 1894 | +} | ||
| 1895 | + | ||
| 1896 | +static int usb_net_handle_statusin(USBNetState *s, USBPacket *p) | ||
| 1897 | +{ | ||
| 1898 | + int ret = 8; | ||
| 1899 | + if (p->len < 8) | ||
| 1900 | + return USB_RET_STALL; | ||
| 1901 | + ((__le32 *)p->data)[0] = cpu_to_le32(1); | ||
| 1902 | + ((__le32 *)p->data)[1] = cpu_to_le32(0); | ||
| 1903 | + if (!s->rndis_resp.tqh_first) | ||
| 1904 | + ret = USB_RET_NAK; | ||
| 1905 | +#if DEBUG | ||
| 1906 | + fprintf(stderr, "usbnet: interrupt poll len %u return %d", p->len, ret); | ||
| 1907 | + { | ||
| 1908 | + int i; | ||
| 1909 | + fprintf(stderr, ":"); | ||
| 1910 | + for (i = 0; i < ret; i++) { | ||
| 1911 | + if (!(i & 15)) | ||
| 1912 | + fprintf(stderr, "\n%04X:", i); | ||
| 1913 | + fprintf(stderr, " %02X", p->data[i]); | ||
| 1914 | + } | ||
| 1915 | + fprintf(stderr, "\n\n"); | ||
| 1916 | + } | ||
| 1917 | +#endif | ||
| 1918 | + return ret; | ||
| 1919 | +} | ||
| 1920 | + | ||
| 1921 | +static int usb_net_handle_datain(USBNetState *s, USBPacket *p) | ||
| 1922 | +{ | ||
| 1923 | + int ret = USB_RET_NAK; | ||
| 1924 | + | ||
| 1925 | + if (s->in_ptr > s->in_len) { | ||
| 1926 | + s->in_ptr = s->in_len = 0; | ||
| 1927 | + ret = USB_RET_NAK; | ||
| 1928 | + return ret; | ||
| 1929 | + } | ||
| 1930 | + if (!s->in_len) { | ||
| 1931 | + ret = USB_RET_NAK; | ||
| 1932 | + return ret; | ||
| 1933 | + } | ||
| 1934 | + ret = s->in_len - s->in_ptr; | ||
| 1935 | + if (ret > p->len) | ||
| 1936 | + ret = p->len; | ||
| 1937 | + memcpy(p->data, &s->in_buf[s->in_ptr], ret); | ||
| 1938 | + s->in_ptr += ret; | ||
| 1939 | + if (s->in_ptr >= s->in_len && (s->rndis || (s->in_len & (64-1)) || !ret)) { | ||
| 1940 | + /* no short packet necessary */ | ||
| 1941 | + s->in_ptr = s->in_len = 0; | ||
| 1942 | + } | ||
| 1943 | +#if TRAFFIC_DEBUG | ||
| 1944 | + fprintf(stderr, "usbnet: data in len %u return %d", p->len, ret); | ||
| 1945 | + { | ||
| 1946 | + int i; | ||
| 1947 | + fprintf(stderr, ":"); | ||
| 1948 | + for (i = 0; i < ret; i++) { | ||
| 1949 | + if (!(i & 15)) | ||
| 1950 | + fprintf(stderr, "\n%04X:", i); | ||
| 1951 | + fprintf(stderr, " %02X", p->data[i]); | ||
| 1952 | + } | ||
| 1953 | + fprintf(stderr, "\n\n"); | ||
| 1954 | + } | ||
| 1955 | +#endif | ||
| 1956 | + return ret; | ||
| 1957 | +} | ||
| 1958 | + | ||
| 1959 | +static int usb_net_handle_dataout(USBNetState *s, USBPacket *p) | ||
| 1960 | +{ | ||
| 1961 | + int ret = p->len; | ||
| 1962 | + int sz = sizeof(s->out_buf) - s->out_ptr; | ||
| 1963 | + struct rndis_packet_msg_type *msg = (struct rndis_packet_msg_type *)s->out_buf; | ||
| 1964 | + uint32_t len; | ||
| 1965 | + | ||
| 1966 | +#if TRAFFIC_DEBUG | ||
| 1967 | + fprintf(stderr, "usbnet: data out len %u\n", p->len); | ||
| 1968 | + { | ||
| 1969 | + int i; | ||
| 1970 | + fprintf(stderr, ":"); | ||
| 1971 | + for (i = 0; i < p->len; i++) { | ||
| 1972 | + if (!(i & 15)) | ||
| 1973 | + fprintf(stderr, "\n%04X:", i); | ||
| 1974 | + fprintf(stderr, " %02X", p->data[i]); | ||
| 1975 | + } | ||
| 1976 | + fprintf(stderr, "\n\n"); | ||
| 1977 | + } | ||
| 1978 | +#endif | ||
| 1979 | + if (sz > ret) | ||
| 1980 | + sz = ret; | ||
| 1981 | + memcpy(&s->out_buf[s->out_ptr], p->data, sz); | ||
| 1982 | + s->out_ptr += sz; | ||
| 1983 | + if (!s->rndis) { | ||
| 1984 | + if (ret < 64) { | ||
| 1985 | + qemu_send_packet(s->vc, s->out_buf, s->out_ptr); | ||
| 1986 | + s->out_ptr = 0; | ||
| 1987 | + } | ||
| 1988 | + return ret; | ||
| 1989 | + } | ||
| 1990 | + len = le32_to_cpu(msg->MessageLength); | ||
| 1991 | + if (s->out_ptr < 8 || s->out_ptr < len) | ||
| 1992 | + return ret; | ||
| 1993 | + if (le32_to_cpu(msg->MessageType) == REMOTE_NDIS_PACKET_MSG) { | ||
| 1994 | + uint32_t offs = 8 + le32_to_cpu(msg->DataOffset); | ||
| 1995 | + uint32_t size = le32_to_cpu(msg->DataLength); | ||
| 1996 | + if (offs + size <= len) | ||
| 1997 | + qemu_send_packet(s->vc, s->out_buf + offs, size); | ||
| 1998 | + } | ||
| 1999 | + s->out_ptr -= len; | ||
| 2000 | + memmove(s->out_buf, &s->out_buf[len], s->out_ptr); | ||
| 2001 | + return ret; | ||
| 2002 | +} | ||
| 2003 | + | ||
| 2004 | +static int usb_net_handle_data(USBDevice *dev, USBPacket *p) | ||
| 2005 | +{ | ||
| 2006 | + USBNetState *s = (USBNetState *)dev; | ||
| 2007 | + int ret = 0; | ||
| 2008 | + | ||
| 2009 | + switch(p->pid) { | ||
| 2010 | + case USB_TOKEN_IN: | ||
| 2011 | + switch (p->devep) { | ||
| 2012 | + case 1: | ||
| 2013 | + ret = usb_net_handle_statusin(s, p); | ||
| 2014 | + break; | ||
| 2015 | + | ||
| 2016 | + case 2: | ||
| 2017 | + ret = usb_net_handle_datain(s, p); | ||
| 2018 | + break; | ||
| 2019 | + | ||
| 2020 | + default: | ||
| 2021 | + goto fail; | ||
| 2022 | + } | ||
| 2023 | + break; | ||
| 2024 | + | ||
| 2025 | + case USB_TOKEN_OUT: | ||
| 2026 | + switch (p->devep) { | ||
| 2027 | + case 2: | ||
| 2028 | + ret = usb_net_handle_dataout(s, p); | ||
| 2029 | + break; | ||
| 2030 | + | ||
| 2031 | + default: | ||
| 2032 | + goto fail; | ||
| 2033 | + } | ||
| 2034 | + break; | ||
| 2035 | + | ||
| 2036 | + default: | ||
| 2037 | + fail: | ||
| 2038 | + ret = USB_RET_STALL; | ||
| 2039 | + break; | ||
| 2040 | + } | ||
| 2041 | + if (ret == USB_RET_STALL) | ||
| 2042 | + fprintf(stderr, "usbnet: failed data transaction: pid 0x%x ep 0x%x len 0x%x\n", p->pid, p->devep, p->len); | ||
| 2043 | + return ret; | ||
| 2044 | +} | ||
| 2045 | + | ||
| 2046 | +static void usbnet_receive(void *opaque, const uint8_t *buf, int size) | ||
| 2047 | +{ | ||
| 2048 | + USBNetState *s = opaque; | ||
| 2049 | + | ||
| 2050 | + if (s->rndis) { | ||
| 2051 | + struct rndis_packet_msg_type *msg = (struct rndis_packet_msg_type *)s->in_buf; | ||
| 2052 | + if (!s->rndis_state == RNDIS_DATA_INITIALIZED) | ||
| 2053 | + return; | ||
| 2054 | + if (size + sizeof(struct rndis_packet_msg_type) > sizeof(s->in_buf)) | ||
| 2055 | + return; | ||
| 2056 | + memset(msg, 0, sizeof(struct rndis_packet_msg_type)); | ||
| 2057 | + msg->MessageType = cpu_to_le32(REMOTE_NDIS_PACKET_MSG); | ||
| 2058 | + msg->MessageLength = cpu_to_le32(size + sizeof(struct rndis_packet_msg_type)); | ||
| 2059 | + msg->DataOffset = cpu_to_le32(sizeof(struct rndis_packet_msg_type) - 8); | ||
| 2060 | + msg->DataLength = cpu_to_le32(size); | ||
| 2061 | + //msg->OOBDataOffset; | ||
| 2062 | + //msg->OOBDataLength; | ||
| 2063 | + //msg->NumOOBDataElements; | ||
| 2064 | + //msg->PerPacketInfoOffset; | ||
| 2065 | + //msg->PerPacketInfoLength; | ||
| 2066 | + //msg->VcHandle; | ||
| 2067 | + //msg->Reserved; | ||
| 2068 | + memcpy(msg + 1, buf, size); | ||
| 2069 | + s->in_len = size + sizeof(struct rndis_packet_msg_type); | ||
| 2070 | + } else { | ||
| 2071 | + if (size > sizeof(s->in_buf)) | ||
| 2072 | + return; | ||
| 2073 | + memcpy(s->in_buf, buf, size); | ||
| 2074 | + s->in_len = size; | ||
| 2075 | + } | ||
| 2076 | + s->in_ptr = 0; | ||
| 2077 | +} | ||
| 2078 | + | ||
| 2079 | +static int usbnet_can_receive(void *opaque) | ||
| 2080 | +{ | ||
| 2081 | + USBNetState *s = opaque; | ||
| 2082 | + | ||
| 2083 | + if (s->rndis && !s->rndis_state == RNDIS_DATA_INITIALIZED) | ||
| 2084 | + return 1; | ||
| 2085 | + return !s->in_len; | ||
| 2086 | +} | ||
| 2087 | + | ||
| 2088 | +static void usb_net_handle_destroy(USBDevice *dev) | ||
| 2089 | +{ | ||
| 2090 | + USBNetState *s = (USBNetState *)dev; | ||
| 2091 | + rndis_clear_responsequeue(s); | ||
| 2092 | + qemu_free(s); | ||
| 2093 | +} | ||
| 2094 | + | ||
| 2095 | +USBDevice *usb_net_init(NICInfo *nd) | ||
| 2096 | +{ | ||
| 2097 | + USBNetState *s; | ||
| 2098 | + | ||
| 2099 | + s = qemu_mallocz(sizeof(USBNetState)); | ||
| 2100 | + if (!s) | ||
| 2101 | + return NULL; | ||
| 2102 | + s->dev.speed = USB_SPEED_FULL; | ||
| 2103 | + s->dev.handle_packet = usb_generic_handle_packet; | ||
| 2104 | + | ||
| 2105 | + s->dev.handle_reset = usb_net_handle_reset; | ||
| 2106 | + s->dev.handle_control = usb_net_handle_control; | ||
| 2107 | + s->dev.handle_data = usb_net_handle_data; | ||
| 2108 | + s->dev.handle_destroy = usb_net_handle_destroy; | ||
| 2109 | + | ||
| 2110 | + s->rndis = 1; | ||
| 2111 | + s->rndis_state = RNDIS_UNINITIALIZED; | ||
| 2112 | + s->medium = NDIS_MEDIUM_802_3; | ||
| 2113 | + s->speed = 1000000; /* 100MBps, in 100Bps units */ | ||
| 2114 | + s->media_state = NDIS_MEDIA_STATE_CONNECTED; | ||
| 2115 | + s->filter = 0; | ||
| 2116 | + s->vendorid = 0x1234; | ||
| 2117 | + memcpy(s->mac, nd->macaddr, 6); | ||
| 2118 | + TAILQ_INIT(&s->rndis_resp); | ||
| 2119 | + | ||
| 2120 | + pstrcpy(s->dev.devname, sizeof(s->dev.devname), "QEMU USB Network Interface"); | ||
| 2121 | + s->vc = qemu_new_vlan_client(nd->vlan, usbnet_receive, usbnet_can_receive, s); | ||
| 2122 | + snprintf(s->vc->info_str, sizeof(s->vc->info_str), | ||
| 2123 | + "usbnet macaddr=%02x:%02x:%02x:%02x:%02x:%02x", | ||
| 2124 | + s->mac[0], s->mac[1], s->mac[2], | ||
| 2125 | + s->mac[3], s->mac[4], s->mac[5]); | ||
| 2126 | + fprintf(stderr, "usbnet: initialized mac %02x:%02x:%02x:%02x:%02x:%02x\n", | ||
| 2127 | + s->mac[0], s->mac[1], s->mac[2], | ||
| 2128 | + s->mac[3], s->mac[4], s->mac[5]); | ||
| 2129 | + return (USBDevice *)s; | ||
| 2130 | +} | ||
| 2131 | diff -urN 4242/Makefile qemu-omap/Makefile | ||
| 2132 | --- 4242/Makefile 2008-04-24 20:17:05.000000000 +0100 | ||
| 2133 | +++ qemu-omap/Makefile 2008-04-23 09:57:55.000000000 +0100 | ||
| 2134 | @@ -55,7 +55,8 @@ | ||
| 2135 | OBJS+=tmp105.o | ||
| 2136 | OBJS+=scsi-disk.o cdrom.o | ||
| 2137 | OBJS+=scsi-generic.o | ||
| 2138 | -OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-wacom.o usb-serial.o | ||
| 2139 | +OBJS+=usb.o usb-hub.o usb-linux.o usb-hid.o usb-msd.o usb-net.o | ||
| 2140 | +OBJS+=usb-wacom.o usb-serial.o | ||
| 2141 | OBJS+=sd.o ssi-sd.o | ||
| 2142 | |||
| 2143 | ifdef CONFIG_BRLAPI | ||
| 2144 | diff -urN 4242/softmmu_template.h qemu-omap/softmmu_template.h | ||
| 2145 | --- 4242/softmmu_template.h 2008-04-24 18:11:49.000000000 +0100 | ||
| 2146 | +++ qemu-omap/softmmu_template.h 2008-04-23 09:57:56.000000000 +0100 | ||
| 2147 | @@ -51,12 +51,15 @@ | ||
| 2148 | int mmu_idx, | ||
| 2149 | void *retaddr); | ||
| 2150 | static inline DATA_TYPE glue(io_read, SUFFIX)(target_phys_addr_t physaddr, | ||
| 2151 | - target_ulong tlb_addr) | ||
| 2152 | + target_ulong tlb_addr, | ||
| 2153 | + target_ulong tlb_io) | ||
| 2154 | { | ||
| 2155 | DATA_TYPE res; | ||
| 2156 | int index; | ||
| 2157 | |||
| 2158 | - index = (tlb_addr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); | ||
| 2159 | + index = (tlb_addr & ~TARGET_PAGE_MASK) >> IO_MEM_SHIFT; | ||
| 2160 | + if (index > 4) | ||
| 2161 | + index = (tlb_io >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); | ||
| 2162 | #if SHIFT <= 2 | ||
| 2163 | res = io_mem_read[index][SHIFT](io_mem_opaque[index], physaddr); | ||
| 2164 | #else | ||
| 2165 | @@ -95,7 +98,9 @@ | ||
| 2166 | /* IO access */ | ||
| 2167 | if ((addr & (DATA_SIZE - 1)) != 0) | ||
| 2168 | goto do_unaligned_access; | ||
| 2169 | - res = glue(io_read, SUFFIX)(physaddr, tlb_addr); | ||
| 2170 | + res = glue(io_read, SUFFIX)(physaddr, tlb_addr, | ||
| 2171 | + env->tlb_table[mmu_idx] | ||
| 2172 | + [index].addr_code); | ||
| 2173 | } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) { | ||
| 2174 | /* slow unaligned access (it spans two pages or IO) */ | ||
| 2175 | do_unaligned_access: | ||
| 2176 | @@ -147,7 +152,9 @@ | ||
| 2177 | /* IO access */ | ||
| 2178 | if ((addr & (DATA_SIZE - 1)) != 0) | ||
| 2179 | goto do_unaligned_access; | ||
| 2180 | - res = glue(io_read, SUFFIX)(physaddr, tlb_addr); | ||
| 2181 | + res = glue(io_read, SUFFIX)(physaddr, tlb_addr, | ||
| 2182 | + env->tlb_table[mmu_idx] | ||
| 2183 | + [index].addr_code); | ||
| 2184 | } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) { | ||
| 2185 | do_unaligned_access: | ||
| 2186 | /* slow unaligned access (it spans two pages) */ | ||
| 2187 | @@ -186,11 +193,14 @@ | ||
| 2188 | static inline void glue(io_write, SUFFIX)(target_phys_addr_t physaddr, | ||
| 2189 | DATA_TYPE val, | ||
| 2190 | target_ulong tlb_addr, | ||
| 2191 | - void *retaddr) | ||
| 2192 | + void *retaddr, | ||
| 2193 | + target_ulong tlb_io) | ||
| 2194 | { | ||
| 2195 | int index; | ||
| 2196 | |||
| 2197 | - index = (tlb_addr >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); | ||
| 2198 | + index = (tlb_addr & ~TARGET_PAGE_MASK) >> IO_MEM_SHIFT; | ||
| 2199 | + if (index > 4) | ||
| 2200 | + index = (tlb_io >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1); | ||
| 2201 | env->mem_write_vaddr = tlb_addr; | ||
| 2202 | env->mem_write_pc = (unsigned long)retaddr; | ||
| 2203 | #if SHIFT <= 2 | ||
| 2204 | @@ -228,7 +238,8 @@ | ||
| 2205 | if ((addr & (DATA_SIZE - 1)) != 0) | ||
| 2206 | goto do_unaligned_access; | ||
| 2207 | retaddr = GETPC(); | ||
| 2208 | - glue(io_write, SUFFIX)(physaddr, val, tlb_addr, retaddr); | ||
| 2209 | + glue(io_write, SUFFIX)(physaddr, val, tlb_addr, retaddr, | ||
| 2210 | + env->tlb_table[mmu_idx][index].addr_code); | ||
| 2211 | } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) { | ||
| 2212 | do_unaligned_access: | ||
| 2213 | retaddr = GETPC(); | ||
| 2214 | @@ -278,7 +289,8 @@ | ||
| 2215 | /* IO access */ | ||
| 2216 | if ((addr & (DATA_SIZE - 1)) != 0) | ||
| 2217 | goto do_unaligned_access; | ||
| 2218 | - glue(io_write, SUFFIX)(physaddr, val, tlb_addr, retaddr); | ||
| 2219 | + glue(io_write, SUFFIX)(physaddr, val, tlb_addr, retaddr, | ||
| 2220 | + env->tlb_table[mmu_idx][index].addr_code); | ||
| 2221 | } else if (((addr & ~TARGET_PAGE_MASK) + DATA_SIZE - 1) >= TARGET_PAGE_SIZE) { | ||
| 2222 | do_unaligned_access: | ||
| 2223 | /* XXX: not efficient, but simple */ | ||
| 2224 | diff -urN 4242/target-i386/cpu.h qemu-omap/target-i386/cpu.h | ||
| 2225 | --- 4242/target-i386/cpu.h 2008-04-23 12:18:51.000000000 +0100 | ||
| 2226 | +++ qemu-omap/target-i386/cpu.h 2008-04-23 09:57:56.000000000 +0100 | ||
| 2227 | @@ -499,7 +499,7 @@ | ||
| 2228 | SegmentCache idt; /* only base and limit are used */ | ||
| 2229 | |||
| 2230 | target_ulong cr[9]; /* NOTE: cr1, cr5-7 are unused */ | ||
| 2231 | - uint64_t a20_mask; | ||
| 2232 | + uint32_t a20_mask; | ||
| 2233 | |||
| 2234 | /* FPU state */ | ||
| 2235 | unsigned int fpstt; /* top of stack index */ | ||
| 2236 | diff -urN 4242/target-i386/helper2.c qemu-omap/target-i386/helper2.c | ||
| 2237 | --- 4242/target-i386/helper2.c 2008-04-23 12:18:51.000000000 +0100 | ||
| 2238 | +++ qemu-omap/target-i386/helper2.c 2008-04-23 09:57:56.000000000 +0100 | ||
| 2239 | @@ -377,7 +377,7 @@ | ||
| 2240 | env->hflags |= HF_GIF_MASK; | ||
| 2241 | |||
| 2242 | cpu_x86_update_cr0(env, 0x60000010); | ||
| 2243 | - env->a20_mask = ~0x0; | ||
| 2244 | + env->a20_mask = 0xffffffff; | ||
| 2245 | env->smbase = 0x30000; | ||
| 2246 | |||
| 2247 | env->idt.limit = 0xffff; | ||
| 2248 | @@ -695,7 +695,7 @@ | ||
| 2249 | /* when a20 is changed, all the MMU mappings are invalid, so | ||
| 2250 | we must flush everything */ | ||
| 2251 | tlb_flush(env, 1); | ||
| 2252 | - env->a20_mask = (~0x100000) | (a20_state << 20); | ||
| 2253 | + env->a20_mask = 0xffefffff | (a20_state << 20); | ||
| 2254 | } | ||
| 2255 | } | ||
| 2256 | |||
| 2257 | @@ -800,8 +800,7 @@ | ||
| 2258 | |||
| 2259 | #else | ||
| 2260 | |||
| 2261 | -/* Bits 52-62 of a PTE are reserved. Bit 63 is the NX bit. */ | ||
| 2262 | -#define PHYS_ADDR_MASK 0xffffffffff000L | ||
| 2263 | +#define PHYS_ADDR_MASK 0xfffff000 | ||
| 2264 | |||
| 2265 | /* return value: | ||
| 2266 | -1 = cannot handle fault | ||
| 2267 | @@ -813,10 +812,9 @@ | ||
| 2268 | int is_write1, int mmu_idx, int is_softmmu) | ||
| 2269 | { | ||
| 2270 | uint64_t ptep, pte; | ||
| 2271 | - target_ulong pde_addr, pte_addr; | ||
| 2272 | + uint32_t pdpe_addr, pde_addr, pte_addr; | ||
| 2273 | int error_code, is_dirty, prot, page_size, ret, is_write, is_user; | ||
| 2274 | - target_phys_addr_t paddr; | ||
| 2275 | - uint32_t page_offset; | ||
| 2276 | + unsigned long paddr, page_offset; | ||
| 2277 | target_ulong vaddr, virt_addr; | ||
| 2278 | |||
| 2279 | is_user = mmu_idx == MMU_USER_IDX; | ||
| 2280 | @@ -836,11 +834,12 @@ | ||
| 2281 | |||
| 2282 | if (env->cr[4] & CR4_PAE_MASK) { | ||
| 2283 | uint64_t pde, pdpe; | ||
| 2284 | - target_ulong pdpe_addr; | ||
| 2285 | |||
| 2286 | + /* XXX: we only use 32 bit physical addresses */ | ||
| 2287 | #ifdef TARGET_X86_64 | ||
| 2288 | if (env->hflags & HF_LMA_MASK) { | ||
| 2289 | - uint64_t pml4e_addr, pml4e; | ||
| 2290 | + uint32_t pml4e_addr; | ||
| 2291 | + uint64_t pml4e; | ||
| 2292 | int32_t sext; | ||
| 2293 | |||
| 2294 | /* test virtual address sign extension */ | ||
| 2295 | @@ -1102,19 +1101,17 @@ | ||
| 2296 | |||
| 2297 | target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr) | ||
| 2298 | { | ||
| 2299 | - target_ulong pde_addr, pte_addr; | ||
| 2300 | - uint64_t pte; | ||
| 2301 | - target_phys_addr_t paddr; | ||
| 2302 | - uint32_t page_offset; | ||
| 2303 | - int page_size; | ||
| 2304 | + uint32_t pde_addr, pte_addr; | ||
| 2305 | + uint32_t pde, pte, paddr, page_offset, page_size; | ||
| 2306 | |||
| 2307 | if (env->cr[4] & CR4_PAE_MASK) { | ||
| 2308 | - target_ulong pdpe_addr; | ||
| 2309 | - uint64_t pde, pdpe; | ||
| 2310 | + uint32_t pdpe_addr, pde_addr, pte_addr; | ||
| 2311 | + uint32_t pdpe; | ||
| 2312 | |||
| 2313 | + /* XXX: we only use 32 bit physical addresses */ | ||
| 2314 | #ifdef TARGET_X86_64 | ||
| 2315 | if (env->hflags & HF_LMA_MASK) { | ||
| 2316 | - uint64_t pml4e_addr, pml4e; | ||
| 2317 | + uint32_t pml4e_addr, pml4e; | ||
| 2318 | int32_t sext; | ||
| 2319 | |||
| 2320 | /* test virtual address sign extension */ | ||
| 2321 | @@ -1124,13 +1121,13 @@ | ||
| 2322 | |||
| 2323 | pml4e_addr = ((env->cr[3] & ~0xfff) + (((addr >> 39) & 0x1ff) << 3)) & | ||
| 2324 | env->a20_mask; | ||
| 2325 | - pml4e = ldq_phys(pml4e_addr); | ||
| 2326 | + pml4e = ldl_phys(pml4e_addr); | ||
| 2327 | if (!(pml4e & PG_PRESENT_MASK)) | ||
| 2328 | return -1; | ||
| 2329 | |||
| 2330 | pdpe_addr = ((pml4e & ~0xfff) + (((addr >> 30) & 0x1ff) << 3)) & | ||
| 2331 | env->a20_mask; | ||
| 2332 | - pdpe = ldq_phys(pdpe_addr); | ||
| 2333 | + pdpe = ldl_phys(pdpe_addr); | ||
| 2334 | if (!(pdpe & PG_PRESENT_MASK)) | ||
| 2335 | return -1; | ||
| 2336 | } else | ||
| 2337 | @@ -1138,14 +1135,14 @@ | ||
| 2338 | { | ||
| 2339 | pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 27) & 0x18)) & | ||
| 2340 | env->a20_mask; | ||
| 2341 | - pdpe = ldq_phys(pdpe_addr); | ||
| 2342 | + pdpe = ldl_phys(pdpe_addr); | ||
| 2343 | if (!(pdpe & PG_PRESENT_MASK)) | ||
| 2344 | return -1; | ||
| 2345 | } | ||
| 2346 | |||
| 2347 | pde_addr = ((pdpe & ~0xfff) + (((addr >> 21) & 0x1ff) << 3)) & | ||
| 2348 | env->a20_mask; | ||
| 2349 | - pde = ldq_phys(pde_addr); | ||
| 2350 | + pde = ldl_phys(pde_addr); | ||
| 2351 | if (!(pde & PG_PRESENT_MASK)) { | ||
| 2352 | return -1; | ||
| 2353 | } | ||
| 2354 | @@ -1158,11 +1155,9 @@ | ||
| 2355 | pte_addr = ((pde & ~0xfff) + (((addr >> 12) & 0x1ff) << 3)) & | ||
| 2356 | env->a20_mask; | ||
| 2357 | page_size = 4096; | ||
| 2358 | - pte = ldq_phys(pte_addr); | ||
| 2359 | + pte = ldl_phys(pte_addr); | ||
| 2360 | } | ||
| 2361 | } else { | ||
| 2362 | - uint32_t pde; | ||
| 2363 | - | ||
| 2364 | if (!(env->cr[0] & CR0_PG_MASK)) { | ||
| 2365 | pte = addr; | ||
| 2366 | page_size = 4096; | ||
| 2367 | diff -urN 4242/vl.c qemu-omap/vl.c | ||
| 2368 | --- 4242/vl.c 2008-04-24 21:26:21.000000000 +0100 | ||
| 2369 | +++ qemu-omap/vl.c 2008-04-23 09:57:57.000000000 +0100 | ||
| 2370 | @@ -5284,6 +5284,11 @@ | ||
| 2371 | dev = usb_keyboard_init(); | ||
| 2372 | } else if (strstart(devname, "disk:", &p)) { | ||
| 2373 | dev = usb_msd_init(p); | ||
| 2374 | + } else if (strstart(devname, "net:", &p)) { | ||
| 2375 | + unsigned int nr = strtoul(p, NULL, 0); | ||
| 2376 | + if (nr >= (unsigned int) nb_nics || strcmp(nd_table[nr].model, "usb")) | ||
| 2377 | + return -1; | ||
| 2378 | + dev = usb_net_init(&nd_table[nr]); | ||
| 2379 | } else if (!strcmp(devname, "wacom-tablet")) { | ||
| 2380 | dev = usb_wacom_init(); | ||
| 2381 | } else if (strstart(devname, "serial:", &p)) { | ||
diff --git a/meta/packages/qemu/qemu-0.9.1+svn/revert_arm_tcg.patch.gz b/meta/packages/qemu/qemu-0.9.1+svn/revert_arm_tcg.patch.gz deleted file mode 100644 index eb2a76c167..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/revert_arm_tcg.patch.gz +++ /dev/null | |||
| Binary files differ | |||
diff --git a/meta/packages/qemu/qemu-0.9.1+svn/series b/meta/packages/qemu/qemu-0.9.1+svn/series deleted file mode 100644 index fb110340c4..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/series +++ /dev/null | |||
| @@ -1,25 +0,0 @@ | |||
| 1 | 05_non-fatal_if_linux_hd_missing.patch | ||
| 2 | 06_exit_segfault.patch -p0 | ||
| 3 | 10_signal_jobs.patch -p0 | ||
| 4 | 11_signal_sigaction.patch -p0 | ||
| 5 | 22_net_tuntap_stall.patch -p0 | ||
| 6 | 31_syscalls.patch -p0 | ||
| 7 | 32_syscall_sysctl.patch -p0 | ||
| 8 | 33_syscall_ppc_clone.patch -p0 | ||
| 9 | 39_syscall_fadvise64.patch -p0 | ||
| 10 | 52_ne2000_return.patch | ||
| 11 | 61_safe_64bit_int.patch -p0 | ||
| 12 | 63_sparc_build.patch -p0 | ||
| 13 | 64_ppc_asm_constraints.patch | ||
| 14 | 65_kfreebsd.patch -p0 | ||
| 15 | 66_tls_ld.patch -p0 | ||
| 16 | 91-oh-sdl-cursor.patch -p0 | ||
| 17 | qemu-0.9.0-nptl.patch | ||
| 18 | qemu-0.9.0-nptl-update.patch | ||
| 19 | qemu-amd64-32b-mapping-0.9.0.patch | ||
| 20 | workaround_bad_futex_headers.patch -p1 | ||
| 21 | fix_segfault.patch | ||
| 22 | no-strip.patch | ||
| 23 | fix_brk.patch | ||
| 24 | fix_protection_bits.patch -p1 | ||
| 25 | qemu-n800-support.patch -p1 | ||
diff --git a/meta/packages/qemu/qemu-0.9.1+svn/workaround_bad_futex_headers.patch b/meta/packages/qemu/qemu-0.9.1+svn/workaround_bad_futex_headers.patch deleted file mode 100644 index cc122ebdba..0000000000 --- a/meta/packages/qemu/qemu-0.9.1+svn/workaround_bad_futex_headers.patch +++ /dev/null | |||
| @@ -1,25 +0,0 @@ | |||
| 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> | ||
