qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: riku.voipio@linaro.org
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [PULL 08/21] linux-user: Enable NPTL for m68k
Date: Tue, 23 Jul 2013 18:48:58 +0300	[thread overview]
Message-ID: <1ccd9374af22ec4ed5f864d4935a9cfad01f1204.1374593203.git.riku.voipio@linaro.org> (raw)
In-Reply-To: <cover.1374593203.git.riku.voipio@linaro.org>

From: Peter Maydell <peter.maydell@linaro.org>

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 <peter.maydell@linaro.org>
Reviewed-by:  Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
 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
-- 
1.8.1.2

  parent reply	other threads:[~2013-07-23 15:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 15:48 [Qemu-devel] [PULL 00/21] Linux-user updates riku.voipio
2013-07-23 15:48 ` [Qemu-devel] [PULL 01/21] configure: Flip default of target_nptl riku.voipio
2013-07-23 15:48 ` [Qemu-devel] [PULL 02/21] configure: Don't say target_nptl="no" if there is no linux-user target riku.voipio
2013-07-23 15:48 ` [Qemu-devel] [PULL 03/21] configure: Enable threading on all ppc and mips linux-user targets riku.voipio
2013-07-23 15:48 ` [Qemu-devel] [PULL 04/21] configure: Enable threading for unicore32-linux-user riku.voipio
2013-07-23 15:48 ` [Qemu-devel] [PULL 05/21] linux-user: Move includes of target-specific headers to end of qemu.h riku.voipio
2013-07-23 15:48 ` [Qemu-devel] [PULL 06/21] linux-user: Enable NPTL for OpenRISC riku.voipio
2013-07-23 15:48 ` [Qemu-devel] [PULL 07/21] linux-user: Enable NPTL for SPARC targets riku.voipio
2013-07-23 15:48 ` riku.voipio [this message]
2013-07-23 15:48 ` [Qemu-devel] [PULL 09/21] linux-user: Add missing 'break' in i386 get_thread_area syscall riku.voipio
2013-07-23 15:49 ` [Qemu-devel] [PULL 10/21] linux-user: Clean up handling of clone() argument order riku.voipio
2013-07-23 15:49 ` [Qemu-devel] [PULL 11/21] linux-user: Add i386 TLS setter riku.voipio
2013-07-23 15:49 ` [Qemu-devel] [PULL 12/21] linux-user: Enable NPTL for x86-64 riku.voipio
2013-07-23 15:49 ` [Qemu-devel] [PULL 13/21] configure: Make NPTL non-optional riku.voipio
2013-07-23 15:49 ` [Qemu-devel] [PULL 14/21] linux-user: Avoid conditional cpu_reset() riku.voipio
2013-07-23 15:49 ` [Qemu-devel] [PULL 15/21] linux-user: Fix target_stat and target_stat64 for OpenRISC riku.voipio
2013-07-23 15:49 ` [Qemu-devel] [PULL 16/21] linux-user: Fix pipe syscall return for SPARC riku.voipio
2013-07-23 15:49 ` [Qemu-devel] [PULL 17/21] linux-user: fix segmentation fault passing with h2g(x) != x riku.voipio
2013-07-23 15:49 ` [Qemu-devel] [PULL 18/21] linux-user: Fix epoll on ARM hosts riku.voipio
2013-07-23 15:49 ` [Qemu-devel] [PULL 19/21] linux-user: Reset copied CPUs in cpu_copy() always riku.voipio
2013-07-23 15:49 ` [Qemu-devel] [PULL 20/21] linux-user: Unlock mmap_lock when resuming guest from page_unprotect riku.voipio
2013-07-23 15:49 ` [Qemu-devel] [PULL 21/21] linux-user: Handle compressed ISA encodings when processing MIPS exceptions riku.voipio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ccd9374af22ec4ed5f864d4935a9cfad01f1204.1374593203.git.riku.voipio@linaro.org \
    --to=riku.voipio@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).