From 1fbde4b0c426c59695eb19e3785718dddf62632c Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Tue, 4 Dec 2007 11:05:19 +0000 Subject: qemu: really enable NPTL for arm git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3304 311d38ba-8fff-0310-9ca6-ca027cbcb966 --- .../qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl.patch | 235 ++++++++++++++------- meta/packages/qemu/qemu_20071121.bb | 1 + 2 files changed, 156 insertions(+), 80 deletions(-) (limited to 'meta/packages/qemu') diff --git a/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl.patch b/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl.patch index 3e46744af..10e3cc04a 100644 --- a/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl.patch +++ b/meta/packages/qemu/qemu-0.9.0+cvs20071121/qemu-0.9.0-nptl.patch @@ -27,11 +27,11 @@ See also http://lists.gnu.org/archive/html/qemu-devel/2006-09/msg00194.html target-arm/translate.c | 9 ++ 10 files changed, 405 insertions(+), 183 deletions(-) -Index: qemu/configure -=================================================================== ---- qemu.orig/configure 2007-12-03 19:34:02.000000000 +0000 -+++ qemu/configure 2007-12-03 23:46:51.000000000 +0000 -@@ -105,6 +105,7 @@ linux_user="no" +--- qemu.orig/configure ++++ qemu/configure +@@ -103,10 +103,11 @@ check_gcc="yes" + softmmu="yes" + linux_user="no" darwin_user="no" build_docs="no" uname_release="" @@ -39,7 +39,11 @@ Index: qemu/configure # OS specific targetos=`uname -s` -@@ -324,6 +325,8 @@ for opt do + case $targetos in + CYGWIN*) +@@ -322,10 +323,12 @@ for opt do + ;; + --disable-werror) werror="no" ;; *) echo "ERROR: unknown option $opt"; show_help="yes" ;; @@ -48,7 +52,11 @@ Index: qemu/configure esac done -@@ -419,6 +422,7 @@ echo " --enable-linux-user enable + if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then + AIOLIBS= +@@ -417,10 +420,11 @@ echo " --enable-system enable + echo " --disable-system disable all system emulation targets" + echo " --enable-linux-user enable all linux usermode emulation targets" echo " --disable-linux-user disable all linux usermode emulation targets" echo " --enable-darwin-user enable all darwin usermode emulation targets" echo " --disable-darwin-user disable all darwin usermode emulation targets" @@ -56,7 +64,11 @@ Index: qemu/configure echo " --fmod-lib path to FMOD library" echo " --fmod-inc path to FMOD includes" echo " --enable-uname-release=R Return R for uname -r in usermode emulation" -@@ -585,6 +589,23 @@ int main(void) { + echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9" + echo "" +@@ -583,10 +587,27 @@ fi + cat > $TMPC < Your SDL version is too old - please upgrade to have SDL support" -@@ -954,6 +976,9 @@ if test "$sdl1" = "yes" ; then - echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak - fi fi -+if test "$nptl" = "yes" ; then -+ echo "#define USE_NPTL 1" >> $config_h -+fi - if test "$cocoa" = "yes" ; then - echo "#define CONFIG_COCOA 1" >> $config_h - echo "CONFIG_COCOA=yes" >> $config_mak -Index: qemu/exec-all.h -=================================================================== ---- qemu.orig/exec-all.h 2007-12-03 19:32:15.000000000 +0000 -+++ qemu/exec-all.h 2007-12-03 19:34:09.000000000 +0000 -@@ -340,170 +340,7 @@ extern CPUWriteMemoryFunc *io_mem_write[ + if [ -s /tmp/qemu-$$-sdl-config.log ]; then +@@ -1063,10 +1085,13 @@ if test "$target_cpu" = "i386" ; then + fi + elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then + echo "TARGET_ARCH=arm" >> $config_mak + echo "#define TARGET_ARCH \"arm\"" >> $config_h + echo "#define TARGET_ARM 1" >> $config_h ++ if test "$nptl" = "yes" ; then ++ echo "#define USE_NPTL 1" >> $config_h ++ fi + bflt="yes" + elif test "$target_cpu" = "sparc" ; then + echo "TARGET_ARCH=sparc" >> $config_mak + echo "#define TARGET_ARCH \"sparc\"" >> $config_h + echo "#define TARGET_SPARC 1" >> $config_h +--- qemu.orig/exec-all.h ++++ qemu/exec-all.h +@@ -338,174 +338,11 @@ dummy_label ## n: ;\ + + extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4]; extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4]; extern void *io_mem_opaque[IO_MEM_NB_ENTRIES]; @@ -274,11 +296,13 @@ Index: qemu/exec-all.h extern spinlock_t tb_lock; -Index: qemu/linux-user/arm/syscall.h -=================================================================== ---- qemu.orig/linux-user/arm/syscall.h 2007-12-03 19:32:15.000000000 +0000 -+++ qemu/linux-user/arm/syscall.h 2007-12-03 19:34:09.000000000 +0000 -@@ -28,7 +28,9 @@ struct target_pt_regs { + extern int tb_invalidated_flag; + +--- qemu.orig/linux-user/arm/syscall.h ++++ qemu/linux-user/arm/syscall.h +@@ -26,11 +26,13 @@ struct target_pt_regs { + #define ARM_ORIG_r0 uregs[17] + #define ARM_SYSCALL_BASE 0x900000 #define ARM_THUMB_SYSCALL 0 @@ -289,11 +313,13 @@ Index: qemu/linux-user/arm/syscall.h #define ARM_NR_semihosting 0x123456 #define ARM_NR_thumb_semihosting 0xAB -Index: qemu/linux-user/main.c -=================================================================== ---- qemu.orig/linux-user/main.c 2007-12-03 19:33:53.000000000 +0000 -+++ qemu/linux-user/main.c 2007-12-03 23:47:10.000000000 +0000 -@@ -363,6 +363,50 @@ static void arm_cache_flush(abi_ulong st + + #if defined(TARGET_WORDS_BIGENDIAN) +--- qemu.orig/linux-user/main.c ++++ qemu/linux-user/main.c +@@ -361,10 +361,54 @@ static void arm_cache_flush(abi_ulong st + break; + addr = last1 + 1; } } @@ -344,7 +370,11 @@ Index: qemu/linux-user/main.c void cpu_loop(CPUARMState *env) { int trapnr; -@@ -473,10 +517,8 @@ void cpu_loop(CPUARMState *env) + unsigned int n, insn; + target_siginfo_t info; +@@ -471,32 +515,50 @@ void cpu_loop(CPUARMState *env) + get_user_u32(insn, env->regs[15] - 4); + n = insn & 0xffffff; } } @@ -357,7 +387,10 @@ Index: qemu/linux-user/main.c env->regs[0] = do_arm_semihosting (env); } else if (n == 0 || n >= ARM_SYSCALL_BASE || (env->thumb && n == ARM_THUMB_SYSCALL)) { -@@ -487,14 +529,34 @@ void cpu_loop(CPUARMState *env) + /* linux syscall */ + if (env->thumb || n == 0) { + n = env->regs[7]; + } else { n -= ARM_SYSCALL_BASE; env->eabi = 0; } @@ -388,8 +421,8 @@ Index: qemu/linux-user/main.c + } + else + { -+ env->regs[0] = do_syscall(env, -+ n, ++ env->regs[0] = do_syscall(env, ++ n, + env->regs[0], + env->regs[1], + env->regs[2], @@ -400,7 +433,11 @@ Index: qemu/linux-user/main.c } else { goto error; } -@@ -533,6 +595,10 @@ void cpu_loop(CPUARMState *env) + } + break; +@@ -531,10 +593,14 @@ void cpu_loop(CPUARMState *env) + info.si_code = TARGET_TRAP_BRKPT; + queue_signal(info.si_signo, &info); } } break; @@ -411,7 +448,11 @@ Index: qemu/linux-user/main.c default: error: fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n", -@@ -2380,6 +2446,10 @@ int main(int argc, char **argv) + trapnr); + cpu_dump_state(env, stderr, fprintf, 0); +@@ -2378,10 +2444,14 @@ int main(int argc, char **argv) + #if defined(TARGET_ARM) || defined(TARGET_M68K) + ts->stack_base = info->start_stack; ts->heap_base = info->brk; /* This will be filled in on the first SYS_HEAPINFO call. */ ts->heap_limit = 0; @@ -422,11 +463,13 @@ Index: qemu/linux-user/main.c #endif if (gdbstub_port) { -Index: qemu/linux-user/qemu.h -=================================================================== ---- qemu.orig/linux-user/qemu.h 2007-12-03 19:32:15.000000000 +0000 -+++ qemu/linux-user/qemu.h 2007-12-03 19:34:09.000000000 +0000 -@@ -102,6 +102,9 @@ typedef struct TaskState { + gdbserver_start (gdbstub_port); + gdb_handlesig(env, 0); +--- qemu.orig/linux-user/qemu.h ++++ qemu/linux-user/qemu.h +@@ -100,10 +100,13 @@ typedef struct TaskState { + /* Extra fields for semihosted binaries. */ + uint32_t stack_base; uint32_t heap_base; uint32_t heap_limit; #endif @@ -436,11 +479,13 @@ Index: qemu/linux-user/qemu.h int used; /* non zero if used */ struct image_info *info; uint8_t stack[0]; -Index: qemu/linux-user/syscall.c -=================================================================== ---- qemu.orig/linux-user/syscall.c 2007-12-03 19:33:48.000000000 +0000 -+++ qemu/linux-user/syscall.c 2007-12-03 23:47:10.000000000 +0000 -@@ -71,9 +71,18 @@ + } __attribute__((aligned(16))) TaskState; + +--- qemu.orig/linux-user/syscall.c ++++ qemu/linux-user/syscall.c +@@ -69,13 +69,22 @@ + #include + #include #include #include "qemu.h" @@ -459,7 +504,11 @@ Index: qemu/linux-user/syscall.c #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \ || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) /* 16 bit uid wrappers emulation */ -@@ -2692,9 +2701,19 @@ abi_long do_arch_prctl(CPUX86State *env, + #define USE_UID16 + #endif +@@ -2690,27 +2699,46 @@ abi_long do_arch_prctl(CPUX86State *env, + + /* this stack is the equivalent of the kernel stack associated with a thread/process */ #define NEW_STACK_SIZE 8192 @@ -479,7 +528,7 @@ Index: qemu/linux-user/syscall.c cpu_loop(env); /* never exits */ return 0; -@@ -2702,13 +2721,22 @@ static int clone_func(void *arg) + } /* do_fork() Must return host values and target errnos (unlike most do_*() functions). */ @@ -503,7 +552,11 @@ Index: qemu/linux-user/syscall.c if (flags & CLONE_VM) { ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE); memset(ts, 0, sizeof(TaskState)); -@@ -2774,16 +2802,67 @@ int do_fork(CPUState *env, unsigned int + new_stack = ts->stack; + ts->used = 1; +@@ -2772,20 +2800,71 @@ int do_fork(CPUState *env, unsigned int + new_env->regs[14] = newsp; + #else #error unsupported target CPU #endif new_env->opaque = ts; @@ -572,7 +625,11 @@ Index: qemu/linux-user/syscall.c } return ret; } -@@ -3108,7 +3187,7 @@ abi_long do_syscall(void *cpu_env, int n + + static abi_long do_fcntl(int fd, int cmd, abi_ulong arg) +@@ -3106,11 +3185,11 @@ abi_long do_syscall(void *cpu_env, int n + break; + case TARGET_NR_brk: ret = do_brk(arg1); break; case TARGET_NR_fork: @@ -581,7 +638,11 @@ Index: qemu/linux-user/syscall.c break; #ifdef TARGET_NR_waitpid case TARGET_NR_waitpid: -@@ -4465,7 +4544,8 @@ abi_long do_syscall(void *cpu_env, int n + { + int status; +@@ -4463,11 +4542,12 @@ abi_long do_syscall(void *cpu_env, int n + #endif + case TARGET_NR_fsync: ret = get_errno(fsync(arg1)); break; case TARGET_NR_clone: @@ -591,7 +652,11 @@ Index: qemu/linux-user/syscall.c break; #ifdef __NR_exit_group /* new thread calls */ -@@ -4910,7 +4990,8 @@ abi_long do_syscall(void *cpu_env, int n + case TARGET_NR_exit_group: + gdb_exit(cpu_env, arg1); +@@ -4908,11 +4988,12 @@ abi_long do_syscall(void *cpu_env, int n + case TARGET_NR_putpmsg: + goto unimplemented; #endif #ifdef TARGET_NR_vfork case TARGET_NR_vfork: @@ -601,14 +666,14 @@ Index: qemu/linux-user/syscall.c break; #endif #ifdef TARGET_NR_ugetrlimit -Index: qemu/qemu_spinlock.h -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ qemu/qemu_spinlock.h 2007-12-03 19:34:09.000000000 +0000 + case TARGET_NR_ugetrlimit: + { +--- /dev/null ++++ qemu/qemu_spinlock.h @@ -0,0 +1,181 @@ +/* + * Atomic operation helper include -+ * ++ * + * Copyright (c) 2005 Fabrice Bellard + * + * This library is free software; you can redistribute it and/or @@ -650,7 +715,7 @@ Index: qemu/qemu_spinlock.h +static inline int testandset (int *p) +{ + long int readval = 0; -+ ++ + __asm__ __volatile__ ("lock; cmpxchgl %2, %0" + : "+m" (*p), "+a" (readval) + : "r" (1) @@ -663,7 +728,7 @@ Index: qemu/qemu_spinlock.h +static inline int testandset (int *p) +{ + long int readval = 0; -+ ++ + __asm__ __volatile__ ("lock; cmpxchgl %2, %0" + : "+m" (*p), "+a" (readval) + : "r" (1) @@ -680,7 +745,7 @@ Index: qemu/qemu_spinlock.h + __asm__ __volatile__ ("0: cs %0,%1,0(%2)\n" + " jl 0b" + : "=&d" (ret) -+ : "r" (1), "a" (p), "0" (*p) ++ : "r" (1), "a" (p), "0" (*p) + : "cc", "memory" ); + return ret; +} @@ -726,7 +791,7 @@ Index: qemu/qemu_spinlock.h + __asm__ __volatile__("swp %0, %1, [%2]" + : "=r"(ret) + : "0"(1), "r"(spinlock)); -+ ++ + return ret; +} +#endif @@ -787,11 +852,11 @@ Index: qemu/qemu_spinlock.h +#endif + +#endif -Index: qemu/target-arm/cpu.h -=================================================================== ---- qemu.orig/target-arm/cpu.h 2007-12-03 19:32:15.000000000 +0000 -+++ qemu/target-arm/cpu.h 2007-12-03 23:45:48.000000000 +0000 -@@ -38,6 +38,7 @@ +--- qemu.orig/target-arm/cpu.h ++++ qemu/target-arm/cpu.h +@@ -36,10 +36,11 @@ + #define EXCP_DATA_ABORT 4 + #define EXCP_IRQ 5 #define EXCP_FIQ 6 #define EXCP_BKPT 7 #define EXCP_EXCEPTION_EXIT 8 /* Return from v7M exception. */ @@ -799,7 +864,11 @@ Index: qemu/target-arm/cpu.h #define ARMV7M_EXCP_RESET 1 #define ARMV7M_EXCP_NMI 2 -@@ -222,6 +223,15 @@ int cpu_arm_signal_handler(int host_sign + #define ARMV7M_EXCP_HARD 3 + #define ARMV7M_EXCP_MEM 4 +@@ -220,10 +221,19 @@ int cpu_arm_signal_handler(int host_sign + void *puc); + void cpu_lock(void); void cpu_unlock(void); @@ -815,11 +884,13 @@ Index: qemu/target-arm/cpu.h #define CPSR_M (0x1f) #define CPSR_T (1 << 5) #define CPSR_F (1 << 6) -Index: qemu/target-arm/op.c -=================================================================== ---- qemu.orig/target-arm/op.c 2007-12-03 19:32:15.000000000 +0000 -+++ qemu/target-arm/op.c 2007-12-03 19:34:09.000000000 +0000 -@@ -1009,6 +1009,12 @@ void OPPROTO op_exception_exit(void) + #define CPSR_I (1 << 7) + #define CPSR_A (1 << 8) +--- qemu.orig/target-arm/op.c ++++ qemu/target-arm/op.c +@@ -1007,10 +1007,16 @@ void OPPROTO op_exception_exit(void) + { + env->exception_index = EXCP_EXCEPTION_EXIT; cpu_loop_exit(); } @@ -832,11 +903,13 @@ Index: qemu/target-arm/op.c /* VFP support. We follow the convention used for VFP instrunctions: Single precition routines have a "s" suffix, double precision a "d" suffix. */ -Index: qemu/target-arm/translate.c -=================================================================== ---- qemu.orig/target-arm/translate.c 2007-12-03 19:32:15.000000000 +0000 -+++ qemu/target-arm/translate.c 2007-12-03 19:34:09.000000000 +0000 -@@ -7520,7 +7520,14 @@ static inline int gen_intermediate_code_ + + #define VFP_OP(name, p) void OPPROTO op_vfp_##name##p(void) +--- qemu.orig/target-arm/translate.c ++++ qemu/target-arm/translate.c +@@ -7518,11 +7518,18 @@ static inline int gen_intermediate_code_ + /* We always get here via a jump, so know we are not in a + conditional execution block. */ gen_op_exception_exit(); } #endif @@ -852,3 +925,5 @@ Index: qemu/target-arm/translate.c if (env->nb_breakpoints > 0) { for(j = 0; j < env->nb_breakpoints; j++) { if (env->breakpoints[j] == dc->pc) { + gen_set_condexec(dc); + gen_op_movl_T0_im((long)dc->pc); diff --git a/meta/packages/qemu/qemu_20071121.bb b/meta/packages/qemu/qemu_20071121.bb index 63100806b..34924fe18 100644 --- a/meta/packages/qemu/qemu_20071121.bb +++ b/meta/packages/qemu/qemu_20071121.bb @@ -2,6 +2,7 @@ LICENSE = "GPL" DEPENDS = "zlib" SRCDATE = "20071121" PV = "0.9.0+cvs${SRCDATE}" +PR = "r1" DEFAULT_PREFERENCE = "-1" -- cgit v1.2.3