@@ -4243,7 +4243,7 @@ static void *clone_func(void *arg)
4243
4243
env = info -> env ;
4244
4244
cpu = ENV_GET_CPU (env );
4245
4245
thread_cpu = cpu ;
4246
- ts = (TaskState * )env -> opaque ;
4246
+ ts = (TaskState * )cpu -> opaque ;
4247
4247
info -> tid = gettid ();
4248
4248
cpu -> host_tid = info -> tid ;
4249
4249
task_settid (ts );
@@ -4271,8 +4271,10 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
4271
4271
abi_ulong parent_tidptr , target_ulong newtls ,
4272
4272
abi_ulong child_tidptr )
4273
4273
{
4274
+ CPUState * cpu = ENV_GET_CPU (env );
4274
4275
int ret ;
4275
4276
TaskState * ts ;
4277
+ CPUState * new_cpu ;
4276
4278
CPUArchState * new_env ;
4277
4279
unsigned int nptl_flags ;
4278
4280
sigset_t sigmask ;
@@ -4282,7 +4284,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
4282
4284
flags &= ~(CLONE_VFORK | CLONE_VM );
4283
4285
4284
4286
if (flags & CLONE_VM ) {
4285
- TaskState * parent_ts = (TaskState * )env -> opaque ;
4287
+ TaskState * parent_ts = (TaskState * )cpu -> opaque ;
4286
4288
new_thread_info info ;
4287
4289
pthread_attr_t attr ;
4288
4290
@@ -4292,7 +4294,8 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
4292
4294
new_env = cpu_copy (env );
4293
4295
/* Init regs that differ from the parent. */
4294
4296
cpu_clone_regs (new_env , newsp );
4295
- new_env -> opaque = ts ;
4297
+ new_cpu = ENV_GET_CPU (new_env );
4298
+ new_cpu -> opaque = ts ;
4296
4299
ts -> bprm = parent_ts -> bprm ;
4297
4300
ts -> info = parent_ts -> info ;
4298
4301
nptl_flags = flags ;
@@ -4364,7 +4367,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
4364
4367
put_user_u32 (gettid (), child_tidptr );
4365
4368
if (flags & CLONE_PARENT_SETTID )
4366
4369
put_user_u32 (gettid (), parent_tidptr );
4367
- ts = (TaskState * )env -> opaque ;
4370
+ ts = (TaskState * )cpu -> opaque ;
4368
4371
if (flags & CLONE_SETTLS )
4369
4372
cpu_set_tls (env , newtls );
4370
4373
if (flags & CLONE_CHILD_CLEARTID )
@@ -4974,7 +4977,8 @@ void init_qemu_uname_release(void)
4974
4977
static int open_self_maps (void * cpu_env , int fd )
4975
4978
{
4976
4979
#if defined(TARGET_ARM ) || defined(TARGET_M68K ) || defined(TARGET_UNICORE32 )
4977
- TaskState * ts = ((CPUArchState * )cpu_env )-> opaque ;
4980
+ CPUState * cpu = ENV_GET_CPU ((CPUArchState * )cpu_env );
4981
+ TaskState * ts = cpu -> opaque ;
4978
4982
#endif
4979
4983
FILE * fp ;
4980
4984
char * line = NULL ;
@@ -5026,7 +5030,8 @@ static int open_self_maps(void *cpu_env, int fd)
5026
5030
5027
5031
static int open_self_stat (void * cpu_env , int fd )
5028
5032
{
5029
- TaskState * ts = ((CPUArchState * )cpu_env )-> opaque ;
5033
+ CPUState * cpu = ENV_GET_CPU ((CPUArchState * )cpu_env );
5034
+ TaskState * ts = cpu -> opaque ;
5030
5035
abi_ulong start_stack = ts -> info -> start_stack ;
5031
5036
int i ;
5032
5037
@@ -5062,7 +5067,8 @@ static int open_self_stat(void *cpu_env, int fd)
5062
5067
5063
5068
static int open_self_auxv (void * cpu_env , int fd )
5064
5069
{
5065
- TaskState * ts = ((CPUArchState * )cpu_env )-> opaque ;
5070
+ CPUState * cpu = ENV_GET_CPU ((CPUArchState * )cpu_env );
5071
+ TaskState * ts = cpu -> opaque ;
5066
5072
abi_ulong auxv = ts -> info -> saved_auxv ;
5067
5073
abi_ulong len = ts -> info -> auxv_len ;
5068
5074
char * ptr ;
@@ -5244,14 +5250,14 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
5244
5250
/* Remove the CPU from the list. */
5245
5251
QTAILQ_REMOVE (& cpus , cpu , node );
5246
5252
cpu_list_unlock ();
5247
- ts = (( CPUArchState * ) cpu_env ) -> opaque ;
5253
+ ts = cpu -> opaque ;
5248
5254
if (ts -> child_tidptr ) {
5249
5255
put_user_u32 (0 , ts -> child_tidptr );
5250
5256
sys_futex (g2h (ts -> child_tidptr ), FUTEX_WAKE , INT_MAX ,
5251
5257
NULL , NULL , 0 );
5252
5258
}
5253
5259
thread_cpu = NULL ;
5254
- object_unref (OBJECT (ENV_GET_CPU ( cpu_env ) ));
5260
+ object_unref (OBJECT (cpu ));
5255
5261
g_free (ts );
5256
5262
pthread_exit (NULL );
5257
5263
}
@@ -6555,7 +6561,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
6555
6561
break ;
6556
6562
case TARGET_NR_mprotect :
6557
6563
{
6558
- TaskState * ts = (( CPUArchState * ) cpu_env ) -> opaque ;
6564
+ TaskState * ts = cpu -> opaque ;
6559
6565
/* Special hack to detect libc making the stack executable. */
6560
6566
if ((arg3 & PROT_GROWSDOWN )
6561
6567
&& arg1 >= ts -> info -> stack_limit
@@ -8647,7 +8653,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
8647
8653
break ;
8648
8654
#elif defined(TARGET_M68K )
8649
8655
{
8650
- TaskState * ts = (( CPUArchState * ) cpu_env ) -> opaque ;
8656
+ TaskState * ts = cpu -> opaque ;
8651
8657
ts -> tp_value = arg1 ;
8652
8658
ret = 0 ;
8653
8659
break ;
@@ -8663,7 +8669,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
8663
8669
break ;
8664
8670
#elif defined(TARGET_M68K )
8665
8671
{
8666
- TaskState * ts = (( CPUArchState * ) cpu_env ) -> opaque ;
8672
+ TaskState * ts = cpu -> opaque ;
8667
8673
ret = ts -> tp_value ;
8668
8674
break ;
8669
8675
}
0 commit comments