Revision a2247f8e

b/linux-user/elfload.c
125 125
static const char *get_elf_platform(void)
126 126
{
127 127
    static char elf_platform[] = "i386";
128
    int family = (thread_env->cpuid_version >> 8) & 0xff;
128
    int family = object_property_get_int(OBJECT(thread_cpu), "family", NULL);
129 129
    if (family > 6)
130 130
        family = 6;
131 131
    if (family >= 3)
......
137 137

  
138 138
static uint32_t get_elf_hwcap(void)
139 139
{
140
    return thread_env->features[FEAT_1_EDX];
140
    X86CPU *cpu = X86_CPU(thread_cpu);
141

  
142
    return cpu->env.features[FEAT_1_EDX];
141 143
}
142 144

  
143 145
#ifdef TARGET_X86_64
......
404 406

  
405 407
static uint32_t get_elf_hwcap(void)
406 408
{
407
    CPUARMState *e = thread_env;
409
    ARMCPU *cpu = ARM_CPU(thread_cpu);
408 410
    uint32_t hwcaps = 0;
409 411

  
410 412
    hwcaps |= ARM_HWCAP_ARM_SWP;
......
415 417

  
416 418
    /* probe for the extra features */
417 419
#define GET_FEATURE(feat, hwcap) \
418
    do {if (arm_feature(e, feat)) { hwcaps |= hwcap; } } while (0)
420
    do { if (arm_feature(&cpu->env, feat)) { hwcaps |= hwcap; } } while (0)
419 421
    GET_FEATURE(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP);
420 422
    GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT);
421 423
    GET_FEATURE(ARM_FEATURE_THUMB2EE, ARM_HWCAP_ARM_THUMBEE);
......
619 621

  
620 622
static uint32_t get_elf_hwcap(void)
621 623
{
622
    CPUPPCState *e = thread_env;
624
    PowerPCCPU *cpu = POWERPC_CPU(thread_cpu);
623 625
    uint32_t features = 0;
624 626

  
625 627
    /* We don't have to be terribly complete here; the high points are
626 628
       Altivec/FP/SPE support.  Anything else is just a bonus.  */
627 629
#define GET_FEATURE(flag, feature)                                      \
628
    do {if (e->insns_flags & flag) features |= feature; } while(0)
630
    do { if (cpu->env.insns_flags & flag) { features |= feature; } } while (0)
629 631
    GET_FEATURE(PPC_64B, QEMU_PPC_FEATURE_64);
630 632
    GET_FEATURE(PPC_FLOAT, QEMU_PPC_FEATURE_HAS_FPU);
631 633
    GET_FEATURE(PPC_ALTIVEC, QEMU_PPC_FEATURE_HAS_ALTIVEC);
......
2667 2669
    /* read and fill status of all threads */
2668 2670
    cpu_list_lock();
2669 2671
    for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) {
2670
        if (cpu == ENV_GET_CPU(thread_env)) {
2672
        if (cpu == thread_cpu) {
2671 2673
            continue;
2672 2674
        }
2673 2675
        fill_thread_info(info, (CPUArchState *)cpu->env_ptr);
b/linux-user/linuxload.c
89 89
abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
90 90
                              abi_ulong stringp, int push_ptr)
91 91
{
92
    TaskState *ts = (TaskState *)thread_env->opaque;
92
    CPUArchState *env = thread_cpu->env_ptr;
93
    TaskState *ts = (TaskState *)env->opaque;
93 94
    int n = sizeof(abi_ulong);
94 95
    abi_ulong envp;
95 96
    abi_ulong argv;
b/linux-user/main.c
120 120
    if (child) {
121 121
        /* Child processes created by fork() only have a single thread.
122 122
           Discard information about the parent threads.  */
123
        first_cpu = ENV_GET_CPU(thread_env);
123
        first_cpu = thread_cpu;
124 124
        first_cpu->next_cpu = NULL;
125 125
        pending_cpus = 0;
126 126
        pthread_mutex_init(&exclusive_lock, NULL);
......
128 128
        pthread_cond_init(&exclusive_cond, NULL);
129 129
        pthread_cond_init(&exclusive_resume, NULL);
130 130
        pthread_mutex_init(&tcg_ctx.tb_ctx.tb_lock, NULL);
131
        gdbserver_fork(thread_env);
131
        gdbserver_fork((CPUArchState *)thread_cpu->env_ptr);
132 132
    } else {
133 133
        pthread_mutex_unlock(&exclusive_lock);
134 134
        pthread_mutex_unlock(&tcg_ctx.tb_ctx.tb_lock);
......
232 232
void fork_end(int child)
233 233
{
234 234
    if (child) {
235
        gdbserver_fork(thread_env);
235
        gdbserver_fork((CPUArchState *)thread_cpu->env_ptr);
236 236
    }
237 237
}
238 238

  
......
3150 3150

  
3151 3151
#endif /* TARGET_S390X */
3152 3152

  
3153
THREAD CPUArchState *thread_env;
3153
THREAD CPUState *thread_cpu;
3154 3154

  
3155 3155
void task_settid(TaskState *ts)
3156 3156
{
......
3640 3640
    cpu_reset(ENV_GET_CPU(env));
3641 3641
#endif
3642 3642

  
3643
    thread_env = env;
3643
    thread_cpu = ENV_GET_CPU(env);
3644 3644

  
3645 3645
    if (getenv("QEMU_STRACE")) {
3646 3646
        do_strace = 1;
b/linux-user/qemu.h
198 198
                    abi_long arg5, abi_long arg6, abi_long arg7,
199 199
                    abi_long arg8);
200 200
void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
201
extern THREAD CPUArchState *thread_env;
201
extern THREAD CPUState *thread_cpu;
202 202
void cpu_loop(CPUArchState *env);
203 203
char *target_strerror(int err);
204 204
int get_osversion(void);
b/linux-user/signal.c
388 388
/* abort execution with signal */
389 389
static void QEMU_NORETURN force_sig(int target_sig)
390 390
{
391
    TaskState *ts = (TaskState *)thread_env->opaque;
391
    CPUArchState *env = thread_cpu->env_ptr;
392
    TaskState *ts = (TaskState *)env->opaque;
392 393
    int host_sig, core_dumped = 0;
393 394
    struct sigaction act;
394 395
    host_sig = target_to_host_signal(target_sig);
395
    gdb_signalled(thread_env, target_sig);
396
    gdb_signalled(env, target_sig);
396 397

  
397 398
    /* dump core if supported by target binary format */
398 399
    if (core_dump_signal(target_sig) && (ts->bprm->core_dump != NULL)) {
399 400
        stop_all_tasks();
400 401
        core_dumped =
401
            ((*ts->bprm->core_dump)(target_sig, thread_env) == 0);
402
            ((*ts->bprm->core_dump)(target_sig, env) == 0);
402 403
    }
403 404
    if (core_dumped) {
404 405
        /* we already dumped the core of target process, we don't want
......
503 504
static void host_signal_handler(int host_signum, siginfo_t *info,
504 505
                                void *puc)
505 506
{
507
    CPUArchState *env = thread_cpu->env_ptr;
506 508
    int sig;
507 509
    target_siginfo_t tinfo;
508 510

  
......
522 524
    fprintf(stderr, "qemu: got signal %d\n", sig);
523 525
#endif
524 526
    host_to_target_siginfo_noswap(&tinfo, info);
525
    if (queue_signal(thread_env, sig, &tinfo) == 1) {
527
    if (queue_signal(env, sig, &tinfo) == 1) {
526 528
        /* interrupt the virtual CPU as soon as possible */
527
        cpu_exit(ENV_GET_CPU(thread_env));
529
        cpu_exit(thread_cpu);
528 530
    }
529 531
}
530 532

  
b/linux-user/syscall.c
4171 4171

  
4172 4172
    env = info->env;
4173 4173
    cpu = ENV_GET_CPU(env);
4174
    thread_env = env;
4175
    ts = (TaskState *)thread_env->opaque;
4174
    thread_cpu = cpu;
4175
    ts = (TaskState *)env->opaque;
4176 4176
    info->tid = gettid();
4177 4177
    cpu->host_tid = info->tid;
4178 4178
    task_settid(ts);
......
5079 5079
                sys_futex(g2h(ts->child_tidptr), FUTEX_WAKE, INT_MAX,
5080 5080
                          NULL, NULL, 0);
5081 5081
            }
5082
            thread_env = NULL;
5082
            thread_cpu = NULL;
5083 5083
            object_unref(OBJECT(ENV_GET_CPU(cpu_env)));
5084 5084
            g_free(ts);
5085 5085
            pthread_exit(NULL);

Also available in: Unified diff