aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@bsdimp.com>2021-08-03 12:34:52 -0600
committerWarner Losh <imp@bsdimp.com>2021-09-10 14:13:06 -0600
commitd42df502e322100c1cae355efb8b8e380867c8fa (patch)
treee1594290647ce34413962666ac858db4748b7709
parentb62f790cfb2621ed1d4bd6ef6661fc68bab1e1ed (diff)
downloadqemu-d42df502e322100c1cae355efb8b8e380867c8fa.zip
qemu-d42df502e322100c1cae355efb8b8e380867c8fa.tar.gz
qemu-d42df502e322100c1cae355efb8b8e380867c8fa.tar.bz2
bsd-user: assume pthreads and support of __thread
All compilers for some time have supported this. Follow linux-user and eliminate the #define THREAD and unconditionally insert __thread where needed. Please insert: "(see 24cb36a61c6: "configure: Make NPTL non-optional")" Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
-rw-r--r--bsd-user/main.c2
-rw-r--r--bsd-user/qemu.h10
2 files changed, 2 insertions, 10 deletions
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 1388c7a..e06cc7b 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -309,7 +309,7 @@ static void usage(void)
exit(1);
}
-THREAD CPUState *thread_cpu;
+__thread CPUState *thread_cpu;
bool qemu_cpu_is_self(CPUState *cpu)
{
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index d1ab58a..cf248ad 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -40,12 +40,6 @@ extern enum BSDType bsd_type;
#include "target_syscall.h"
#include "exec/gdbstub.h"
-#if defined(CONFIG_USE_NPTL)
-#define THREAD __thread
-#else
-#define THREAD
-#endif
-
/*
* This struct is used to hold certain information about the image. Basically,
* it replicates in user space what would be certain task_struct fields in the
@@ -155,7 +149,7 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1,
abi_long arg2, abi_long arg3, abi_long arg4,
abi_long arg5, abi_long arg6);
void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
-extern THREAD CPUState *thread_cpu;
+extern __thread CPUState *thread_cpu;
void cpu_loop(CPUArchState *env);
char *target_strerror(int err);
int get_osversion(void);
@@ -422,8 +416,6 @@ static inline void *lock_user_string(abi_ulong guest_addr)
#define unlock_user_struct(host_ptr, guest_addr, copy) \
unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0)
-#if defined(CONFIG_USE_NPTL)
#include <pthread.h>
-#endif
#endif /* QEMU_H */