Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
a2247f8e
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a2247f8e
编写于
6月 09, 2013
作者:
A
Andreas Färber
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
linux-user: Change thread_env to CPUState
Signed-off-by:
N
Andreas Färber
<
afaerber@suse.de
>
上级
182735ef
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
27 addition
and
22 deletion
+27
-22
linux-user/elfload.c
linux-user/elfload.c
+9
-7
linux-user/linuxload.c
linux-user/linuxload.c
+2
-1
linux-user/main.c
linux-user/main.c
+5
-5
linux-user/qemu.h
linux-user/qemu.h
+1
-1
linux-user/signal.c
linux-user/signal.c
+7
-5
linux-user/syscall.c
linux-user/syscall.c
+3
-3
未找到文件。
linux-user/elfload.c
浏览文件 @
a2247f8e
...
...
@@ -125,7 +125,7 @@ typedef abi_int target_pid_t;
static
const
char
*
get_elf_platform
(
void
)
{
static
char
elf_platform
[]
=
"i386"
;
int
family
=
(
thread_env
->
cpuid_version
>>
8
)
&
0xff
;
int
family
=
object_property_get_int
(
OBJECT
(
thread_cpu
),
"family"
,
NULL
)
;
if
(
family
>
6
)
family
=
6
;
if
(
family
>=
3
)
...
...
@@ -137,7 +137,9 @@ static const char *get_elf_platform(void)
static
uint32_t
get_elf_hwcap
(
void
)
{
return
thread_env
->
features
[
FEAT_1_EDX
];
X86CPU
*
cpu
=
X86_CPU
(
thread_cpu
);
return
cpu
->
env
.
features
[
FEAT_1_EDX
];
}
#ifdef TARGET_X86_64
...
...
@@ -404,7 +406,7 @@ static int validate_guest_space(unsigned long guest_base,
static
uint32_t
get_elf_hwcap
(
void
)
{
CPUARMState
*
e
=
thread_env
;
ARMCPU
*
cpu
=
ARM_CPU
(
thread_cpu
)
;
uint32_t
hwcaps
=
0
;
hwcaps
|=
ARM_HWCAP_ARM_SWP
;
...
...
@@ -415,7 +417,7 @@ static uint32_t get_elf_hwcap(void)
/* probe for the extra features */
#define GET_FEATURE(feat, hwcap) \
do {
if (arm_feature(e
, feat)) { hwcaps |= hwcap; } } while (0)
do {
if (arm_feature(&cpu->env
, feat)) { hwcaps |= hwcap; } } while (0)
GET_FEATURE
(
ARM_FEATURE_VFP
,
ARM_HWCAP_ARM_VFP
);
GET_FEATURE
(
ARM_FEATURE_IWMMXT
,
ARM_HWCAP_ARM_IWMMXT
);
GET_FEATURE
(
ARM_FEATURE_THUMB2EE
,
ARM_HWCAP_ARM_THUMBEE
);
...
...
@@ -619,13 +621,13 @@ enum {
static
uint32_t
get_elf_hwcap
(
void
)
{
CPUPPCState
*
e
=
thread_env
;
PowerPCCPU
*
cpu
=
POWERPC_CPU
(
thread_cpu
)
;
uint32_t
features
=
0
;
/* We don't have to be terribly complete here; the high points are
Altivec/FP/SPE support. Anything else is just a bonus. */
#define GET_FEATURE(flag, feature) \
do {
if (e->insns_flags & flag) features |= feature; } while
(0)
do {
if (cpu->env.insns_flags & flag) { features |= feature; } } while
(0)
GET_FEATURE
(
PPC_64B
,
QEMU_PPC_FEATURE_64
);
GET_FEATURE
(
PPC_FLOAT
,
QEMU_PPC_FEATURE_HAS_FPU
);
GET_FEATURE
(
PPC_ALTIVEC
,
QEMU_PPC_FEATURE_HAS_ALTIVEC
);
...
...
@@ -2667,7 +2669,7 @@ static int fill_note_info(struct elf_note_info *info,
/* read and fill status of all threads */
cpu_list_lock
();
for
(
cpu
=
first_cpu
;
cpu
!=
NULL
;
cpu
=
cpu
->
next_cpu
)
{
if
(
cpu
==
ENV_GET_CPU
(
thread_env
)
)
{
if
(
cpu
==
thread_cpu
)
{
continue
;
}
fill_thread_info
(
info
,
(
CPUArchState
*
)
cpu
->
env_ptr
);
...
...
linux-user/linuxload.c
浏览文件 @
a2247f8e
...
...
@@ -89,7 +89,8 @@ static int prepare_binprm(struct linux_binprm *bprm)
abi_ulong
loader_build_argptr
(
int
envc
,
int
argc
,
abi_ulong
sp
,
abi_ulong
stringp
,
int
push_ptr
)
{
TaskState
*
ts
=
(
TaskState
*
)
thread_env
->
opaque
;
CPUArchState
*
env
=
thread_cpu
->
env_ptr
;
TaskState
*
ts
=
(
TaskState
*
)
env
->
opaque
;
int
n
=
sizeof
(
abi_ulong
);
abi_ulong
envp
;
abi_ulong
argv
;
...
...
linux-user/main.c
浏览文件 @
a2247f8e
...
...
@@ -120,7 +120,7 @@ void fork_end(int child)
if
(
child
)
{
/* Child processes created by fork() only have a single thread.
Discard information about the parent threads. */
first_cpu
=
ENV_GET_CPU
(
thread_env
)
;
first_cpu
=
thread_cpu
;
first_cpu
->
next_cpu
=
NULL
;
pending_cpus
=
0
;
pthread_mutex_init
(
&
exclusive_lock
,
NULL
);
...
...
@@ -128,7 +128,7 @@ void fork_end(int child)
pthread_cond_init
(
&
exclusive_cond
,
NULL
);
pthread_cond_init
(
&
exclusive_resume
,
NULL
);
pthread_mutex_init
(
&
tcg_ctx
.
tb_ctx
.
tb_lock
,
NULL
);
gdbserver_fork
(
thread_env
);
gdbserver_fork
(
(
CPUArchState
*
)
thread_cpu
->
env_ptr
);
}
else
{
pthread_mutex_unlock
(
&
exclusive_lock
);
pthread_mutex_unlock
(
&
tcg_ctx
.
tb_ctx
.
tb_lock
);
...
...
@@ -232,7 +232,7 @@ void fork_start(void)
void
fork_end
(
int
child
)
{
if
(
child
)
{
gdbserver_fork
(
thread_env
);
gdbserver_fork
(
(
CPUArchState
*
)
thread_cpu
->
env_ptr
);
}
}
...
...
@@ -3150,7 +3150,7 @@ void cpu_loop(CPUS390XState *env)
#endif
/* TARGET_S390X */
THREAD
CPU
ArchState
*
thread_env
;
THREAD
CPU
State
*
thread_cpu
;
void
task_settid
(
TaskState
*
ts
)
{
...
...
@@ -3640,7 +3640,7 @@ int main(int argc, char **argv, char **envp)
cpu_reset
(
ENV_GET_CPU
(
env
));
#endif
thread_
env
=
env
;
thread_
cpu
=
ENV_GET_CPU
(
env
)
;
if
(
getenv
(
"QEMU_STRACE"
))
{
do_strace
=
1
;
...
...
linux-user/qemu.h
浏览文件 @
a2247f8e
...
...
@@ -198,7 +198,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
abi_long
arg5
,
abi_long
arg6
,
abi_long
arg7
,
abi_long
arg8
);
void
gemu_log
(
const
char
*
fmt
,
...)
GCC_FMT_ATTR
(
1
,
2
);
extern
THREAD
CPU
ArchState
*
thread_env
;
extern
THREAD
CPU
State
*
thread_cpu
;
void
cpu_loop
(
CPUArchState
*
env
);
char
*
target_strerror
(
int
err
);
int
get_osversion
(
void
);
...
...
linux-user/signal.c
浏览文件 @
a2247f8e
...
...
@@ -388,17 +388,18 @@ static inline void free_sigqueue(CPUArchState *env, struct sigqueue *q)
/* abort execution with signal */
static
void
QEMU_NORETURN
force_sig
(
int
target_sig
)
{
TaskState
*
ts
=
(
TaskState
*
)
thread_env
->
opaque
;
CPUArchState
*
env
=
thread_cpu
->
env_ptr
;
TaskState
*
ts
=
(
TaskState
*
)
env
->
opaque
;
int
host_sig
,
core_dumped
=
0
;
struct
sigaction
act
;
host_sig
=
target_to_host_signal
(
target_sig
);
gdb_signalled
(
thread_
env
,
target_sig
);
gdb_signalled
(
env
,
target_sig
);
/* dump core if supported by target binary format */
if
(
core_dump_signal
(
target_sig
)
&&
(
ts
->
bprm
->
core_dump
!=
NULL
))
{
stop_all_tasks
();
core_dumped
=
((
*
ts
->
bprm
->
core_dump
)(
target_sig
,
thread_
env
)
==
0
);
((
*
ts
->
bprm
->
core_dump
)(
target_sig
,
env
)
==
0
);
}
if
(
core_dumped
)
{
/* we already dumped the core of target process, we don't want
...
...
@@ -503,6 +504,7 @@ int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
static
void
host_signal_handler
(
int
host_signum
,
siginfo_t
*
info
,
void
*
puc
)
{
CPUArchState
*
env
=
thread_cpu
->
env_ptr
;
int
sig
;
target_siginfo_t
tinfo
;
...
...
@@ -522,9 +524,9 @@ static void host_signal_handler(int host_signum, siginfo_t *info,
fprintf
(
stderr
,
"qemu: got signal %d
\n
"
,
sig
);
#endif
host_to_target_siginfo_noswap
(
&
tinfo
,
info
);
if
(
queue_signal
(
thread_
env
,
sig
,
&
tinfo
)
==
1
)
{
if
(
queue_signal
(
env
,
sig
,
&
tinfo
)
==
1
)
{
/* interrupt the virtual CPU as soon as possible */
cpu_exit
(
ENV_GET_CPU
(
thread_env
)
);
cpu_exit
(
thread_cpu
);
}
}
...
...
linux-user/syscall.c
浏览文件 @
a2247f8e
...
...
@@ -4171,8 +4171,8 @@ static void *clone_func(void *arg)
env
=
info
->
env
;
cpu
=
ENV_GET_CPU
(
env
);
thread_
env
=
env
;
ts
=
(
TaskState
*
)
thread_
env
->
opaque
;
thread_
cpu
=
cpu
;
ts
=
(
TaskState
*
)
env
->
opaque
;
info
->
tid
=
gettid
();
cpu
->
host_tid
=
info
->
tid
;
task_settid
(
ts
);
...
...
@@ -5079,7 +5079,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
sys_futex
(
g2h
(
ts
->
child_tidptr
),
FUTEX_WAKE
,
INT_MAX
,
NULL
,
NULL
,
0
);
}
thread_
env
=
NULL
;
thread_
cpu
=
NULL
;
object_unref
(
OBJECT
(
ENV_GET_CPU
(
cpu_env
)));
g_free
(
ts
);
pthread_exit
(
NULL
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录