@@ -2375,6 +2375,7 @@ case "$target_arch2" in
;;
m68k)
bflt="yes"
+ target_nptl="yes"
gdb_xml_files="cf-core.xml cf-fp.xml"
target_phys_bits=32
;;
@@ -328,3 +328,8 @@
#define TARGET_NR_dup3 326
#define TARGET_NR_pipe2 327
#define TARGET_NR_inotify_init1 328
+
+#define TARGET_NR_get_thread_area 333
+#define TARGET_NR_set_thread_area 334
+#define TARGET_NR_atomic_cmpxchg_32 335
+#define TARGET_NR_atomic_barrier 336
@@ -2256,6 +2256,27 @@ void cpu_loop (CPUState *env)
#ifdef TARGET_M68K
+uint32_t do_cmpxchg_32 (uint32_t addr, uint32_t oldval, uint32_t newval)
+{
+ uint32_t val;
+
+ /* XXX: This only works between threads, not between processes.
+ It's probably possible to implement this with native host
+ operations. However things like ldrex/strex are much harder so
+ there's not much point trying. */
+ start_exclusive();
+
+ /* FIXME: This should SEGV if the access fails. */
+ get_user_u32(val, addr);
+ if (val == oldval)
+ /* FIXME: Check for segfaults. */
+ put_user_u32(newval, addr);
+
+ end_exclusive();
+
+ return val;
+}
+
void cpu_loop(CPUM68KState *env)
{
int trapnr;
@@ -33,6 +33,12 @@
#ifdef TARGET_NR_arm_fadvise64_64
{ TARGET_NR_arm_fadvise64_64, "arm_fadvise64_64" , NULL, NULL, NULL },
#endif
+#ifdef TARGET_NR_atomic_barrier
+{ TARGET_NR_atomic_barrier, "atomic_barrier" , NULL, NULL, NULL },
+#endif
+#ifdef TARGET_NR_atomic_cmpxchg_32
+{ TARGET_NR_atomic_cmpxchg_32, "atomic_cmpxchg_32" , NULL, NULL, NULL },
+#endif
#ifdef TARGET_NR_bdflush
{ TARGET_NR_bdflush, "bdflush" , NULL, NULL, NULL },
#endif
@@ -5756,6 +5756,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg5, arg4));
#elif defined(TARGET_CRIS)
ret = get_errno(do_fork(cpu_env, arg2, arg1, arg3, arg4, arg5));
+#elif defined(TARGET_M68K)
+ ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg5, arg4));
#else
ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg4, arg5));
#endif
@@ -6943,6 +6945,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#elif defined(TARGET_I386) && defined(TARGET_ABI32)
ret = do_set_thread_area(cpu_env, arg1);
break;
+#elif defined(TARGET_M68K)
+ cpu_set_tls (cpu_env, arg1);
+ ret = 0;
+ break;
#else
goto unimplemented_nowarn;
#endif
@@ -6951,6 +6957,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_get_thread_area:
#if defined(TARGET_I386) && defined(TARGET_ABI32)
ret = do_get_thread_area(cpu_env, arg1);
+ break;
+#elif defined(TARGET_M68K)
+ ret = cpu_get_tls (cpu_env);
+ break;
#else
goto unimplemented_nowarn;
#endif
@@ -7197,6 +7207,16 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
ret = get_errno(fallocate(arg1, arg2, arg3, arg4));
break;
#endif
+#ifdef TARGET_NR_atomic_cmpxchg_32
+ case TARGET_NR_atomic_cmpxchg_32:
+ ret = do_cmpxchg_32 (arg6, arg2, arg1);
+ break;
+#endif
+#ifdef TARGET_NR_atomic_barrier
+ case TARGET_NR_atomic_barrier:
+ ret = 0;
+ break;
+#endif
default:
unimplemented:
gemu_log("qemu: Unsupported syscall: %d\n", num);
@@ -109,6 +109,9 @@ typedef struct CPUM68KState {
uint32_t qregs[MAX_QREGS];
+ /* For usermode emulation */
+ target_ulong tls_value;
+
CPU_COMMON
uint32_t features;
@@ -126,6 +129,8 @@ int cpu_m68k_signal_handler(int host_signum, void *pinfo,
void *puc);
void cpu_m68k_flush_flags(CPUM68KState *, int);
+uint32_t do_cmpxchg_32 (uint32_t, uint32_t, uint32_t);
+
enum {
CC_OP_DYNAMIC, /* Use env->cc_op */
CC_OP_FLAGS, /* CC_DEST = CVZN, CC_SRC = unused */
@@ -236,7 +241,21 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
env->aregs[7] = newsp;
env->dregs[0] = 0;
}
-#endif
+
+static inline target_ulong cpu_get_tls(CPUState *env)
+{
+ return env->tls_value;
+}
+
+static inline void cpu_set_tls(CPUState *env, target_ulong newtls)
+{
+ env->tls_value = newtls;
+}
+
+static inline void cpu_clear_exclusive(void)
+{
+}
+#endif /* CONFIG_USER_ONLY */
#include "cpu-all.h"
#include "exec-all.h"