From patchwork Tue Jul 16 17:44:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 18393 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f199.google.com (mail-we0-f199.google.com [74.125.82.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5CAF527748 for ; Tue, 16 Jul 2013 17:45:20 +0000 (UTC) Received: by mail-we0-f199.google.com with SMTP id t56sf1209354wes.2 for ; Tue, 16 Jul 2013 10:45:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=eawHTkjTxVlhujSEUiPsss75Woq4rktaud2gv9dE710=; b=h1L8ipXWZKLR8h/y0GZgC85N3GE3u7sHwogHBhcDOXIDW/GBIUiWZx9pbPD0iJGwx+ s55HM2q5/ZfAvRAM52L3orLNl1qztu4LjfIpuTE9MDYfMOdqsTV3OQngqBhDXumU+H3O xDXGdAANXEM5/LJhreUrzxPoEHaOUw1Q47N9iQlv46do6qeHuwYozHX6Z09Hbdpo86Sf Z5ulX1j20P/fNZsfCBq/A0sddIhPv+G4cu1KIbxiLCT/v46eqeTpQoi6+FjzluPb81wp Br9aGeL6xOGWNOi1Djk5D5CrPrjPJYiz5CFkI0116Rqha0Y45a1IHBHvOjseNUv4/NgO 3bpA== X-Received: by 10.180.205.133 with SMTP id lg5mr1433777wic.6.1373996719515; Tue, 16 Jul 2013 10:45:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.86.226 with SMTP id s2ls970922wiz.12.canary; Tue, 16 Jul 2013 10:45:19 -0700 (PDT) X-Received: by 10.180.39.236 with SMTP id s12mr13206258wik.14.1373996718747; Tue, 16 Jul 2013 10:45:18 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id uv9si1075445wjc.102.2013.07.16.10.45.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Jul 2013 10:45:18 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id pa12so730376veb.11 for ; Tue, 16 Jul 2013 10:45:17 -0700 (PDT) X-Received: by 10.221.21.74 with SMTP id qr10mr781717vcb.25.1373996717666; Tue, 16 Jul 2013 10:45:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.149.77 with SMTP id s13csp131953vcv; Tue, 16 Jul 2013 10:45:17 -0700 (PDT) X-Received: by 10.180.185.176 with SMTP id fd16mr2003281wic.20.1373996714852; Tue, 16 Jul 2013 10:45:14 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id pa4si1090072wjb.26.2013.07.16.10.45.14 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 16 Jul 2013 10:45:14 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Uz9J7-0007dL-Om; Tue, 16 Jul 2013 18:45:01 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Richard Henderson , Aurelien Jarno , Alexander Graf , Blue Swirl , Guan Xuetao , "Edgar E. Iglesias" , Jia Liu , Laurent Vivier Subject: [PATCH v3 08/13] linux-user: Enable NPTL for m68k Date: Tue, 16 Jul 2013 18:44:55 +0100 Message-Id: <1373996700-29286-9-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1373996700-29286-1-git-send-email-peter.maydell@linaro.org> References: <1373996700-29286-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQkLDlOMfNx+pd1iqzAdhj1ENYQYeeaX/BRD9THCjgO5sAsHaBzEtrWwmS9+bpHHNrlE5GDq X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- 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 117191e..67e6437 100755 --- a/configure +++ b/configure @@ -4203,7 +4203,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