Revision 2f7bb878

b/bsd-user/mmap.c
30 30

  
31 31
//#define DEBUG_MMAP
32 32

  
33
#if defined(USE_NPTL)
33
#if defined(CONFIG_USE_NPTL)
34 34
pthread_mutex_t mmap_mutex;
35 35
static int __thread mmap_lock_count;
36 36

  
b/bsd-user/qemu.h
24 24
#include "target_signal.h"
25 25
#include "gdbstub.h"
26 26

  
27
#if defined(USE_NPTL)
27
#if defined(CONFIG_USE_NPTL)
28 28
#define THREAD __thread
29 29
#else
30 30
#define THREAD
......
188 188
void mmap_unlock(void);
189 189
void cpu_list_lock(void);
190 190
void cpu_list_unlock(void);
191
#if defined(USE_NPTL)
191
#if defined(CONFIG_USE_NPTL)
192 192
void mmap_fork_start(void);
193 193
void mmap_fork_end(int child);
194 194
#endif
......
382 382
#define unlock_user_struct(host_ptr, guest_addr, copy)          \
383 383
    unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0)
384 384

  
385
#if defined(USE_NPTL)
385
#if defined(CONFIG_USE_NPTL)
386 386
#include <pthread.h>
387 387
#endif
388 388

  
b/configure
2056 2056
fi
2057 2057
if test "$target_user_only" = "yes" \
2058 2058
        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2059
  echo "USE_NPTL=y" >> $config_mak
2059
  echo "CONFIG_USE_NPTL=y" >> $config_mak
2060 2060
fi
2061 2061
# 32 bit ELF loader in addition to native 64 bit loader?
2062 2062
if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
b/create_config
46 46
    value=${line#*=}
47 47
    echo "#define $name $value"
48 48
    ;;
49
 USE_NPTL=y) # configuration
50
    name=${line%=*}
51
    echo "#define $name 1"
52
    ;;
53 49
esac
54 50

  
55 51
done # read
b/exec.c
1515 1515

  
1516 1516
static void cpu_unlink_tb(CPUState *env)
1517 1517
{
1518
#if defined(USE_NPTL)
1518
#if defined(CONFIG_USE_NPTL)
1519 1519
    /* FIXME: TB unchaining isn't SMP safe.  For now just ignore the
1520 1520
       problem and hope the cpu will stop of its own accord.  For userspace
1521 1521
       emulation this often isn't actually as bad as it sounds.  Often
b/gdbstub.c
1592 1592

  
1593 1593
static inline int gdb_id(CPUState *env)
1594 1594
{
1595
#if defined(CONFIG_USER_ONLY) && defined(USE_NPTL)
1595
#if defined(CONFIG_USER_ONLY) && defined(CONFIG_USE_NPTL)
1596 1596
    return env->host_tid;
1597 1597
#else
1598 1598
    return env->cpu_index + 1;
b/linux-user/main.c
108 108

  
109 109
#endif
110 110

  
111
#if defined(USE_NPTL)
111
#if defined(CONFIG_USE_NPTL)
112 112
/***********************************************************/
113 113
/* Helper routines for implementing atomic operations.  */
114 114

  
......
222 222
{
223 223
    pthread_mutex_unlock(&cpu_list_mutex);
224 224
}
225
#else /* if !USE_NPTL */
225
#else /* if !CONFIG_USE_NPTL */
226 226
/* These are no-ops because we are not threadsafe.  */
227 227
static inline void cpu_exec_start(CPUState *env)
228 228
{
......
2357 2357
void task_settid(TaskState *ts)
2358 2358
{
2359 2359
    if (ts->ts_tid == 0) {
2360
#ifdef USE_NPTL
2360
#ifdef CONFIG_USE_NPTL
2361 2361
        ts->ts_tid = (pid_t)syscall(SYS_gettid);
2362 2362
#else
2363 2363
        /* when no threads are used, tid becomes pid */
b/linux-user/mmap.c
33 33

  
34 34
//#define DEBUG_MMAP
35 35

  
36
#if defined(USE_NPTL)
36
#if defined(CONFIG_USE_NPTL)
37 37
pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER;
38 38
static int __thread mmap_lock_count;
39 39

  
b/linux-user/qemu.h
20 20
#include "gdbstub.h"
21 21
#include "sys-queue.h"
22 22

  
23
#if defined(USE_NPTL)
23
#if defined(CONFIG_USE_NPTL)
24 24
#define THREAD __thread
25 25
#else
26 26
#define THREAD
......
104 104
    uint32_t v86flags;
105 105
    uint32_t v86mask;
106 106
#endif
107
#ifdef USE_NPTL
107
#ifdef CONFIG_USE_NPTL
108 108
    abi_ulong child_tidptr;
109 109
#endif
110 110
#ifdef TARGET_M68K
......
244 244
abi_ulong mmap_find_vma(abi_ulong, abi_ulong);
245 245
void cpu_list_lock(void);
246 246
void cpu_list_unlock(void);
247
#if defined(USE_NPTL)
247
#if defined(CONFIG_USE_NPTL)
248 248
void mmap_fork_start(void);
249 249
void mmap_fork_end(int child);
250 250
#endif
......
441 441
#define unlock_user_struct(host_ptr, guest_addr, copy)		\
442 442
    unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0)
443 443

  
444
#if defined(USE_NPTL)
444
#if defined(CONFIG_USE_NPTL)
445 445
#include <pthread.h>
446 446
#endif
447 447

  
b/linux-user/syscall.c
82 82
#include "qemu.h"
83 83
#include "qemu-common.h"
84 84

  
85
#if defined(USE_NPTL)
85
#if defined(CONFIG_USE_NPTL)
86 86
#define CLONE_NPTL_FLAGS2 (CLONE_SETTLS | \
87 87
    CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID)
88 88
#else
......
219 219
#if defined(TARGET_NR_set_tid_address) && defined(__NR_set_tid_address)
220 220
_syscall1(int,set_tid_address,int *,tidptr)
221 221
#endif
222
#if defined(USE_NPTL)
222
#if defined(CONFIG_USE_NPTL)
223 223
#if defined(TARGET_NR_futex) && defined(__NR_futex)
224 224
_syscall6(int,sys_futex,int *,uaddr,int,op,int,val,
225 225
          const struct timespec *,timeout,int *,uaddr2,int,val3)
......
3458 3458

  
3459 3459
#endif /* defined(TARGET_I386) */
3460 3460

  
3461
#if defined(USE_NPTL)
3461
#if defined(CONFIG_USE_NPTL)
3462 3462

  
3463 3463
#define NEW_STACK_SIZE PTHREAD_STACK_MIN
3464 3464

  
......
3527 3527
    TaskState *ts;
3528 3528
    uint8_t *new_stack;
3529 3529
    CPUState *new_env;
3530
#if defined(USE_NPTL)
3530
#if defined(CONFIG_USE_NPTL)
3531 3531
    unsigned int nptl_flags;
3532 3532
    sigset_t sigmask;
3533 3533
#endif
......
3538 3538

  
3539 3539
    if (flags & CLONE_VM) {
3540 3540
        TaskState *parent_ts = (TaskState *)env->opaque;
3541
#if defined(USE_NPTL)
3541
#if defined(CONFIG_USE_NPTL)
3542 3542
        new_thread_info info;
3543 3543
        pthread_attr_t attr;
3544 3544
#endif
......
3552 3552
        new_env->opaque = ts;
3553 3553
        ts->bprm = parent_ts->bprm;
3554 3554
        ts->info = parent_ts->info;
3555
#if defined(USE_NPTL)
3555
#if defined(CONFIG_USE_NPTL)
3556 3556
        nptl_flags = flags;
3557 3557
        flags &= ~CLONE_NPTL_FLAGS2;
3558 3558

  
......
3621 3621
            /* Child Process.  */
3622 3622
            cpu_clone_regs(env, newsp);
3623 3623
            fork_end(1);
3624
#if defined(USE_NPTL)
3624
#if defined(CONFIG_USE_NPTL)
3625 3625
            /* There is a race condition here.  The parent process could
3626 3626
               theoretically read the TID in the child process before the child
3627 3627
               tid is set.  This would require using either ptrace
......
4016 4016
}
4017 4017
#endif
4018 4018

  
4019
#if defined(USE_NPTL)
4019
#if defined(CONFIG_USE_NPTL)
4020 4020
/* ??? Using host futex calls even when target atomic operations
4021 4021
   are not really atomic probably breaks things.  However implementing
4022 4022
   futexes locally would make futexes shared between multiple processes
......
4126 4126

  
4127 4127
    switch(num) {
4128 4128
    case TARGET_NR_exit:
4129
#ifdef USE_NPTL
4129
#ifdef CONFIG_USE_NPTL
4130 4130
      /* In old applications this may be used to implement _exit(2).
4131 4131
         However in threaded applictions it is used for thread termination,
4132 4132
         and _exit_group is used for application termination.
......
6828 6828
        }
6829 6829
	break;
6830 6830
#endif
6831
#if defined(USE_NPTL)
6831
#if defined(CONFIG_USE_NPTL)
6832 6832
    case TARGET_NR_futex:
6833 6833
        ret = do_futex(arg1, arg2, arg3, arg4, arg5, arg6);
6834 6834
        break;
b/qemu-lock.h
23 23
   likely to release it soon.  In environments where you have more threads
24 24
   than physical CPUs (the extreme case being a single CPU host) a spinlock
25 25
   simply wastes CPU until the OS decides to preempt it.  */
26
#if defined(USE_NPTL)
26
#if defined(CONFIG_USE_NPTL)
27 27

  
28 28
#include <pthread.h>
29 29
#define spin_lock pthread_mutex_lock

Also available in: Unified diff