From patchwork Tue Jul 23 15:48:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 261105 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E11162C00AC for ; Wed, 24 Jul 2013 01:50:34 +1000 (EST) Received: from localhost ([::1]:48831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1er8-0005cR-BY for incoming@patchwork.ozlabs.org; Tue, 23 Jul 2013 11:50:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1eqC-0005OZ-TI for qemu-devel@nongnu.org; Tue, 23 Jul 2013 11:49:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1epx-0001Zi-HL for qemu-devel@nongnu.org; Tue, 23 Jul 2013 11:49:32 -0400 Received: from afflict.kos.to ([92.243.29.197]:45184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1epx-0001Yu-B0 for qemu-devel@nongnu.org; Tue, 23 Jul 2013 11:49:17 -0400 Received: from kos.to (a91-156-63-85.elisa-laajakaista.fi [91.156.63.85]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id 7C6F826560 for ; Tue, 23 Jul 2013 17:49:14 +0200 (CEST) Received: from voipio (uid 1000) (envelope-from voipio@kos.to) id 5e07f7 by kos.to (DragonFly Mail Agent); Tue, 23 Jul 2013 18:49:12 +0300 From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 23 Jul 2013 18:48:58 +0300 Message-Id: <1ccd9374af22ec4ed5f864d4935a9cfad01f1204.1374593203.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: Peter Maydell Subject: [Qemu-devel] [PULL 08/21] linux-user: Enable NPTL for m68k X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Peter Maydell For m68k, per-thread data is a purely kernel construct with no CPU level support. Implement it via a field in the TaskState structure, used by cpu_set_tls() and the set_thread_area/get_thread_area syscalls. This allows us to enable compilation with NPTL. Signed-off-by: Peter Maydell Reviewed-by: Laurent Vivier Signed-off-by: Riku Voipio --- configure | 1 - linux-user/m68k/target_cpu.h | 6 +++++- linux-user/qemu.h | 1 + linux-user/syscall.c | 12 ++++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/configure b/configure index ab3dc3c..f065edc 100755 --- a/configure +++ b/configure @@ -4210,7 +4210,6 @@ case "$target_name" in m68k) bflt="yes" gdb_xml_files="cf-core.xml cf-fp.xml" - target_nptl="no" ;; microblaze|microblazeel) TARGET_ARCH=microblaze diff --git a/linux-user/m68k/target_cpu.h b/linux-user/m68k/target_cpu.h index 8a2a305..cad9c90 100644 --- a/linux-user/m68k/target_cpu.h +++ b/linux-user/m68k/target_cpu.h @@ -29,6 +29,10 @@ static inline void cpu_clone_regs(CPUM68KState *env, target_ulong newsp) env->dregs[0] = 0; } -/* TODO: need to implement cpu_set_tls() */ +static inline void cpu_set_tls(CPUM68KState *env, target_ulong newtls) +{ + TaskState *ts = env->opaque; + ts->tp_value = newtls; +} #endif diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 8c420da..1ff0fa8 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -121,6 +121,7 @@ typedef struct TaskState { #endif #ifdef TARGET_M68K int sim_syscalls; + abi_ulong tp_value; #endif #if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32) /* Extra fields for semihosted binaries. */ diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 00a0390..9619656 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8558,6 +8558,12 @@ 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) + { + TaskState *ts = ((CPUArchState *)cpu_env)->opaque; + ts->tp_value = arg1; + break; + } #else goto unimplemented_nowarn; #endif @@ -8566,6 +8572,12 @@ 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); +#elif defined(TARGET_M68K) + { + TaskState *ts = ((CPUArchState *)cpu_env)->opaque; + ret = ts->tp_value; + break; + } #else goto unimplemented_nowarn; #endif