Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
4917cf44
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看板
提交
4917cf44
编写于
5月 27, 2013
作者:
A
Andreas Färber
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cpu: Replace cpu_single_env with CPUState current_cpu
Move it to qom/cpu.h. Signed-off-by:
N
Andreas Färber
<
afaerber@suse.de
>
上级
80b7cd73
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
120 addition
and
115 deletion
+120
-115
cpu-exec.c
cpu-exec.c
+7
-6
cpus.c
cpus.c
+20
-21
exec.c
exec.c
+7
-5
hw/alpha/typhoon.c
hw/alpha/typhoon.c
+4
-12
hw/arm/pxa2xx.c
hw/arm/pxa2xx.c
+1
-2
hw/i386/kvmvapic.c
hw/i386/kvmvapic.c
+4
-2
hw/i386/pc.c
hw/i386/pc.c
+6
-5
hw/intc/arm_gic.c
hw/intc/arm_gic.c
+1
-2
hw/intc/armv7m_nvic.c
hw/intc/armv7m_nvic.c
+8
-3
hw/intc/openpic.c
hw/intc/openpic.c
+2
-5
hw/mips/mips_fulong2e.c
hw/mips/mips_fulong2e.c
+3
-3
hw/mips/mips_jazz.c
hw/mips/mips_jazz.c
+3
-3
hw/mips/mips_malta.c
hw/mips/mips_malta.c
+3
-3
hw/misc/vmport.c
hw/misc/vmport.c
+16
-10
hw/ppc/mpc8544_guts.c
hw/ppc/mpc8544_guts.c
+2
-1
hw/ppc/prep.c
hw/ppc/prep.c
+3
-3
hw/sparc/sun4m.c
hw/sparc/sun4m.c
+2
-3
hw/timer/arm_mptimer.c
hw/timer/arm_mptimer.c
+3
-5
include/exec/cpu-all.h
include/exec/cpu-all.h
+0
-3
include/qom/cpu.h
include/qom/cpu.h
+4
-0
memory.c
memory.c
+4
-6
translate-all.c
translate-all.c
+12
-8
user-exec.c
user-exec.c
+5
-4
未找到文件。
cpu-exec.c
浏览文件 @
4917cf44
...
@@ -213,12 +213,12 @@ int cpu_exec(CPUArchState *env)
...
@@ -213,12 +213,12 @@ int cpu_exec(CPUArchState *env)
cpu
->
halted
=
0
;
cpu
->
halted
=
0
;
}
}
c
pu_single_env
=
env
;
c
urrent_cpu
=
cpu
;
/* As long as c
pu_single_env
is null, up to the assignment just above,
/* As long as c
urrent_cpu
is null, up to the assignment just above,
* requests by other threads to exit the execution loop are expected to
* requests by other threads to exit the execution loop are expected to
* be issued using the exit_request global. We must make sure that our
* be issued using the exit_request global. We must make sure that our
* evaluation of the global value is performed past the c
pu_single_env
* evaluation of the global value is performed past the c
urrent_cpu
* value transition point, which requires a memory barrier as well as
* value transition point, which requires a memory barrier as well as
* an instruction scheduling constraint on modern architectures. */
* an instruction scheduling constraint on modern architectures. */
smp_mb
();
smp_mb
();
...
@@ -673,7 +673,8 @@ int cpu_exec(CPUArchState *env)
...
@@ -673,7 +673,8 @@ int cpu_exec(CPUArchState *env)
}
else
{
}
else
{
/* Reload env after longjmp - the compiler may have smashed all
/* Reload env after longjmp - the compiler may have smashed all
* local variables as longjmp is marked 'noreturn'. */
* local variables as longjmp is marked 'noreturn'. */
env
=
cpu_single_env
;
cpu
=
current_cpu
;
env
=
cpu
->
env_ptr
;
}
}
}
/* for(;;) */
}
/* for(;;) */
...
@@ -707,7 +708,7 @@ int cpu_exec(CPUArchState *env)
...
@@ -707,7 +708,7 @@ int cpu_exec(CPUArchState *env)
#error unsupported target CPU
#error unsupported target CPU
#endif
#endif
/* fail safe : never use c
pu_single_env
outside cpu_exec() */
/* fail safe : never use c
urrent_cpu
outside cpu_exec() */
c
pu_single_env
=
NULL
;
c
urrent_cpu
=
NULL
;
return
ret
;
return
ret
;
}
}
cpus.c
浏览文件 @
4917cf44
...
@@ -118,10 +118,11 @@ TimersState timers_state;
...
@@ -118,10 +118,11 @@ TimersState timers_state;
int64_t
cpu_get_icount
(
void
)
int64_t
cpu_get_icount
(
void
)
{
{
int64_t
icount
;
int64_t
icount
;
CPU
ArchState
*
env
=
cpu_single_env
;
CPU
State
*
cpu
=
current_cpu
;
icount
=
qemu_icount
;
icount
=
qemu_icount
;
if
(
env
)
{
if
(
cpu
)
{
CPUArchState
*
env
=
cpu
->
env_ptr
;
if
(
!
can_do_io
(
env
))
{
if
(
!
can_do_io
(
env
))
{
fprintf
(
stderr
,
"Bad clock read
\n
"
);
fprintf
(
stderr
,
"Bad clock read
\n
"
);
}
}
...
@@ -468,8 +469,8 @@ static void cpu_handle_guest_debug(CPUState *cpu)
...
@@ -468,8 +469,8 @@ static void cpu_handle_guest_debug(CPUState *cpu)
static
void
cpu_signal
(
int
sig
)
static
void
cpu_signal
(
int
sig
)
{
{
if
(
c
pu_single_env
)
{
if
(
c
urrent_cpu
)
{
cpu_exit
(
ENV_GET_CPU
(
cpu_single_env
)
);
cpu_exit
(
current_cpu
);
}
}
exit_request
=
1
;
exit_request
=
1
;
}
}
...
@@ -660,10 +661,10 @@ void run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data)
...
@@ -660,10 +661,10 @@ void run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data)
qemu_cpu_kick
(
cpu
);
qemu_cpu_kick
(
cpu
);
while
(
!
wi
.
done
)
{
while
(
!
wi
.
done
)
{
CPU
ArchState
*
self_env
=
cpu_single_env
;
CPU
State
*
self_cpu
=
current_cpu
;
qemu_cond_wait
(
&
qemu_work_cond
,
&
qemu_global_mutex
);
qemu_cond_wait
(
&
qemu_work_cond
,
&
qemu_global_mutex
);
c
pu_single_env
=
self_env
;
c
urrent_cpu
=
self_cpu
;
}
}
}
}
...
@@ -733,7 +734,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
...
@@ -733,7 +734,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
qemu_mutex_lock
(
&
qemu_global_mutex
);
qemu_mutex_lock
(
&
qemu_global_mutex
);
qemu_thread_get_self
(
cpu
->
thread
);
qemu_thread_get_self
(
cpu
->
thread
);
cpu
->
thread_id
=
qemu_get_thread_id
();
cpu
->
thread_id
=
qemu_get_thread_id
();
c
pu_single_env
=
cpu
->
env_ptr
;
c
urrent_cpu
=
cpu
;
r
=
kvm_init_vcpu
(
cpu
);
r
=
kvm_init_vcpu
(
cpu
);
if
(
r
<
0
)
{
if
(
r
<
0
)
{
...
@@ -781,9 +782,9 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
...
@@ -781,9 +782,9 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
cpu
->
created
=
true
;
cpu
->
created
=
true
;
qemu_cond_signal
(
&
qemu_cpu_cond
);
qemu_cond_signal
(
&
qemu_cpu_cond
);
c
pu_single_env
=
cpu
->
env_ptr
;
c
urrent_cpu
=
cpu
;
while
(
1
)
{
while
(
1
)
{
c
pu_single_env
=
NULL
;
c
urrent_cpu
=
NULL
;
qemu_mutex_unlock_iothread
();
qemu_mutex_unlock_iothread
();
do
{
do
{
int
sig
;
int
sig
;
...
@@ -794,7 +795,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
...
@@ -794,7 +795,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
exit
(
1
);
exit
(
1
);
}
}
qemu_mutex_lock_iothread
();
qemu_mutex_lock_iothread
();
c
pu_single_env
=
cpu
->
env_ptr
;
c
urrent_cpu
=
cpu
;
qemu_wait_io_event_common
(
cpu
);
qemu_wait_io_event_common
(
cpu
);
}
}
...
@@ -894,12 +895,11 @@ void qemu_cpu_kick(CPUState *cpu)
...
@@ -894,12 +895,11 @@ void qemu_cpu_kick(CPUState *cpu)
void
qemu_cpu_kick_self
(
void
)
void
qemu_cpu_kick_self
(
void
)
{
{
#ifndef _WIN32
#ifndef _WIN32
assert
(
cpu_single_env
);
assert
(
current_cpu
);
CPUState
*
cpu_single_cpu
=
ENV_GET_CPU
(
cpu_single_env
);
if
(
!
c
pu_single
_cpu
->
thread_kicked
)
{
if
(
!
c
urrent
_cpu
->
thread_kicked
)
{
qemu_cpu_kick_thread
(
c
pu_single
_cpu
);
qemu_cpu_kick_thread
(
c
urrent
_cpu
);
c
pu_single
_cpu
->
thread_kicked
=
true
;
c
urrent
_cpu
->
thread_kicked
=
true
;
}
}
#else
#else
abort
();
abort
();
...
@@ -913,7 +913,7 @@ bool qemu_cpu_is_self(CPUState *cpu)
...
@@ -913,7 +913,7 @@ bool qemu_cpu_is_self(CPUState *cpu)
static
bool
qemu_in_vcpu_thread
(
void
)
static
bool
qemu_in_vcpu_thread
(
void
)
{
{
return
c
pu_single_env
&&
qemu_cpu_is_self
(
ENV_GET_CPU
(
cpu_single_env
)
);
return
c
urrent_cpu
&&
qemu_cpu_is_self
(
current_cpu
);
}
}
void
qemu_mutex_lock_iothread
(
void
)
void
qemu_mutex_lock_iothread
(
void
)
...
@@ -1069,11 +1069,10 @@ void qemu_init_vcpu(CPUState *cpu)
...
@@ -1069,11 +1069,10 @@ void qemu_init_vcpu(CPUState *cpu)
void
cpu_stop_current
(
void
)
void
cpu_stop_current
(
void
)
{
{
if
(
cpu_single_env
)
{
if
(
current_cpu
)
{
CPUState
*
cpu_single_cpu
=
ENV_GET_CPU
(
cpu_single_env
);
current_cpu
->
stop
=
false
;
cpu_single_cpu
->
stop
=
false
;
current_cpu
->
stopped
=
true
;
cpu_single_cpu
->
stopped
=
true
;
cpu_exit
(
current_cpu
);
cpu_exit
(
cpu_single_cpu
);
qemu_cond_signal
(
&
qemu_pause_cond
);
qemu_cond_signal
(
&
qemu_pause_cond
);
}
}
}
}
...
...
exec.c
浏览文件 @
4917cf44
...
@@ -72,7 +72,7 @@ static MemoryRegion io_mem_unassigned;
...
@@ -72,7 +72,7 @@ static MemoryRegion io_mem_unassigned;
CPUArchState
*
first_cpu
;
CPUArchState
*
first_cpu
;
/* current CPU in the current thread. It is only valid inside
/* current CPU in the current thread. It is only valid inside
cpu_exec() */
cpu_exec() */
DEFINE_TLS
(
CPU
ArchState
*
,
cpu_single_env
);
DEFINE_TLS
(
CPU
State
*
,
current_cpu
);
/* 0 = Do not count executed instructions.
/* 0 = Do not count executed instructions.
1 = Precise instruction counting.
1 = Precise instruction counting.
2 = Adaptive rate instruction counting. */
2 = Adaptive rate instruction counting. */
...
@@ -1472,8 +1472,10 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
...
@@ -1472,8 +1472,10 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr,
cpu_physical_memory_set_dirty_flags
(
ram_addr
,
dirty_flags
);
cpu_physical_memory_set_dirty_flags
(
ram_addr
,
dirty_flags
);
/* we remove the notdirty callback only if the code has been
/* we remove the notdirty callback only if the code has been
flushed */
flushed */
if
(
dirty_flags
==
0xff
)
if
(
dirty_flags
==
0xff
)
{
tlb_set_dirty
(
cpu_single_env
,
cpu_single_env
->
mem_io_vaddr
);
CPUArchState
*
env
=
current_cpu
->
env_ptr
;
tlb_set_dirty
(
env
,
env
->
mem_io_vaddr
);
}
}
}
static
bool
notdirty_mem_accepts
(
void
*
opaque
,
hwaddr
addr
,
static
bool
notdirty_mem_accepts
(
void
*
opaque
,
hwaddr
addr
,
...
@@ -1491,7 +1493,7 @@ static const MemoryRegionOps notdirty_mem_ops = {
...
@@ -1491,7 +1493,7 @@ static const MemoryRegionOps notdirty_mem_ops = {
/* Generate a debug exception if a watchpoint has been hit. */
/* Generate a debug exception if a watchpoint has been hit. */
static
void
check_watchpoint
(
int
offset
,
int
len_mask
,
int
flags
)
static
void
check_watchpoint
(
int
offset
,
int
len_mask
,
int
flags
)
{
{
CPUArchState
*
env
=
c
pu_single_env
;
CPUArchState
*
env
=
c
urrent_cpu
->
env_ptr
;
target_ulong
pc
,
cs_base
;
target_ulong
pc
,
cs_base
;
target_ulong
vaddr
;
target_ulong
vaddr
;
CPUWatchpoint
*
wp
;
CPUWatchpoint
*
wp
;
...
@@ -1930,7 +1932,7 @@ bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf,
...
@@ -1930,7 +1932,7 @@ bool address_space_rw(AddressSpace *as, hwaddr addr, uint8_t *buf,
if
(
is_write
)
{
if
(
is_write
)
{
if
(
!
memory_access_is_direct
(
mr
,
is_write
))
{
if
(
!
memory_access_is_direct
(
mr
,
is_write
))
{
l
=
memory_access_size
(
mr
,
l
,
addr1
);
l
=
memory_access_size
(
mr
,
l
,
addr1
);
/* XXX: could force c
pu_single_env
to NULL to avoid
/* XXX: could force c
urrent_cpu
to NULL to avoid
potential bugs */
potential bugs */
if
(
l
==
4
)
{
if
(
l
==
4
)
{
/* 32 bit write access */
/* 32 bit write access */
...
...
hw/alpha/typhoon.c
浏览文件 @
4917cf44
...
@@ -72,9 +72,8 @@ static void cpu_irq_change(AlphaCPU *cpu, uint64_t req)
...
@@ -72,9 +72,8 @@ static void cpu_irq_change(AlphaCPU *cpu, uint64_t req)
static
uint64_t
cchip_read
(
void
*
opaque
,
hwaddr
addr
,
unsigned
size
)
static
uint64_t
cchip_read
(
void
*
opaque
,
hwaddr
addr
,
unsigned
size
)
{
{
CPU
AlphaState
*
env
=
cpu_single_env
;
CPU
State
*
cpu
=
current_cpu
;
TyphoonState
*
s
=
opaque
;
TyphoonState
*
s
=
opaque
;
CPUState
*
cpu
;
uint64_t
ret
=
0
;
uint64_t
ret
=
0
;
if
(
addr
&
4
)
{
if
(
addr
&
4
)
{
...
@@ -95,7 +94,6 @@ static uint64_t cchip_read(void *opaque, hwaddr addr, unsigned size)
...
@@ -95,7 +94,6 @@ static uint64_t cchip_read(void *opaque, hwaddr addr, unsigned size)
case
0x0080
:
case
0x0080
:
/* MISC: Miscellaneous Register. */
/* MISC: Miscellaneous Register. */
cpu
=
ENV_GET_CPU
(
env
);
ret
=
s
->
cchip
.
misc
|
(
cpu
->
cpu_index
&
3
);
ret
=
s
->
cchip
.
misc
|
(
cpu
->
cpu_index
&
3
);
break
;
break
;
...
@@ -197,7 +195,6 @@ static uint64_t cchip_read(void *opaque, hwaddr addr, unsigned size)
...
@@ -197,7 +195,6 @@ static uint64_t cchip_read(void *opaque, hwaddr addr, unsigned size)
break
;
break
;
default:
default:
cpu
=
CPU
(
alpha_env_get_cpu
(
cpu_single_env
));
cpu_unassigned_access
(
cpu
,
addr
,
false
,
false
,
0
,
size
);
cpu_unassigned_access
(
cpu
,
addr
,
false
,
false
,
0
,
size
);
return
-
1
;
return
-
1
;
}
}
...
@@ -215,7 +212,6 @@ static uint64_t dchip_read(void *opaque, hwaddr addr, unsigned size)
...
@@ -215,7 +212,6 @@ static uint64_t dchip_read(void *opaque, hwaddr addr, unsigned size)
static
uint64_t
pchip_read
(
void
*
opaque
,
hwaddr
addr
,
unsigned
size
)
static
uint64_t
pchip_read
(
void
*
opaque
,
hwaddr
addr
,
unsigned
size
)
{
{
TyphoonState
*
s
=
opaque
;
TyphoonState
*
s
=
opaque
;
CPUState
*
cs
;
uint64_t
ret
=
0
;
uint64_t
ret
=
0
;
if
(
addr
&
4
)
{
if
(
addr
&
4
)
{
...
@@ -302,8 +298,7 @@ static uint64_t pchip_read(void *opaque, hwaddr addr, unsigned size)
...
@@ -302,8 +298,7 @@ static uint64_t pchip_read(void *opaque, hwaddr addr, unsigned size)
break
;
break
;
default:
default:
cs
=
CPU
(
alpha_env_get_cpu
(
cpu_single_env
));
cpu_unassigned_access
(
current_cpu
,
addr
,
false
,
false
,
0
,
size
);
cpu_unassigned_access
(
cs
,
addr
,
false
,
false
,
0
,
size
);
return
-
1
;
return
-
1
;
}
}
...
@@ -315,7 +310,6 @@ static void cchip_write(void *opaque, hwaddr addr,
...
@@ -315,7 +310,6 @@ static void cchip_write(void *opaque, hwaddr addr,
uint64_t
v32
,
unsigned
size
)
uint64_t
v32
,
unsigned
size
)
{
{
TyphoonState
*
s
=
opaque
;
TyphoonState
*
s
=
opaque
;
CPUState
*
cpu_single_cpu
=
CPU
(
alpha_env_get_cpu
(
cpu_single_env
));
uint64_t
val
,
oldval
,
newval
;
uint64_t
val
,
oldval
,
newval
;
if
(
addr
&
4
)
{
if
(
addr
&
4
)
{
...
@@ -465,7 +459,7 @@ static void cchip_write(void *opaque, hwaddr addr,
...
@@ -465,7 +459,7 @@ static void cchip_write(void *opaque, hwaddr addr,
break
;
break
;
default:
default:
cpu_unassigned_access
(
c
pu_single
_cpu
,
addr
,
true
,
false
,
0
,
size
);
cpu_unassigned_access
(
c
urrent
_cpu
,
addr
,
true
,
false
,
0
,
size
);
return
;
return
;
}
}
}
}
...
@@ -480,7 +474,6 @@ static void pchip_write(void *opaque, hwaddr addr,
...
@@ -480,7 +474,6 @@ static void pchip_write(void *opaque, hwaddr addr,
uint64_t
v32
,
unsigned
size
)
uint64_t
v32
,
unsigned
size
)
{
{
TyphoonState
*
s
=
opaque
;
TyphoonState
*
s
=
opaque
;
CPUState
*
cs
;
uint64_t
val
,
oldval
;
uint64_t
val
,
oldval
;
if
(
addr
&
4
)
{
if
(
addr
&
4
)
{
...
@@ -582,8 +575,7 @@ static void pchip_write(void *opaque, hwaddr addr,
...
@@ -582,8 +575,7 @@ static void pchip_write(void *opaque, hwaddr addr,
break
;
break
;
default:
default:
cs
=
CPU
(
alpha_env_get_cpu
(
cpu_single_env
));
cpu_unassigned_access
(
current_cpu
,
addr
,
true
,
false
,
0
,
size
);
cpu_unassigned_access
(
cs
,
addr
,
true
,
false
,
0
,
size
);
return
;
return
;
}
}
}
}
...
...
hw/arm/pxa2xx.c
浏览文件 @
4917cf44
...
@@ -301,8 +301,7 @@ static int pxa2xx_pwrmode_write(CPUARMState *env, const ARMCPRegInfo *ri,
...
@@ -301,8 +301,7 @@ static int pxa2xx_pwrmode_write(CPUARMState *env, const ARMCPRegInfo *ri,
#endif
#endif
/* Suspend */
/* Suspend */
cpu_interrupt
(
CPU
(
arm_env_get_cpu
(
cpu_single_env
)),
cpu_interrupt
(
current_cpu
,
CPU_INTERRUPT_HALT
);
CPU_INTERRUPT_HALT
);
goto
message
;
goto
message
;
...
...
hw/i386/kvmvapic.c
浏览文件 @
4917cf44
...
@@ -624,11 +624,13 @@ static int vapic_prepare(VAPICROMState *s)
...
@@ -624,11 +624,13 @@ static int vapic_prepare(VAPICROMState *s)
static
void
vapic_write
(
void
*
opaque
,
hwaddr
addr
,
uint64_t
data
,
static
void
vapic_write
(
void
*
opaque
,
hwaddr
addr
,
uint64_t
data
,
unsigned
int
size
)
unsigned
int
size
)
{
{
CPUX86State
*
env
=
cpu_single_env
;
CPUState
*
cs
=
current_cpu
;
X86CPU
*
cpu
=
X86_CPU
(
cs
);
CPUX86State
*
env
=
&
cpu
->
env
;
hwaddr
rom_paddr
;
hwaddr
rom_paddr
;
VAPICROMState
*
s
=
opaque
;
VAPICROMState
*
s
=
opaque
;
cpu_synchronize_state
(
CPU
(
x86_env_get_cpu
(
env
))
);
cpu_synchronize_state
(
cs
);
/*
/*
* The VAPIC supports two PIO-based hypercalls, both via port 0x7E.
* The VAPIC supports two PIO-based hypercalls, both via port 0x7E.
...
...
hw/i386/pc.c
浏览文件 @
4917cf44
...
@@ -886,8 +886,9 @@ void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd)
...
@@ -886,8 +886,9 @@ void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd)
DeviceState
*
cpu_get_current_apic
(
void
)
DeviceState
*
cpu_get_current_apic
(
void
)
{
{
if
(
cpu_single_env
)
{
if
(
current_cpu
)
{
return
cpu_single_env
->
apic_state
;
X86CPU
*
cpu
=
X86_CPU
(
current_cpu
);
return
cpu
->
env
.
apic_state
;
}
else
{
}
else
{
return
NULL
;
return
NULL
;
}
}
...
@@ -1176,10 +1177,10 @@ DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus)
...
@@ -1176,10 +1177,10 @@ DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus)
static
void
cpu_request_exit
(
void
*
opaque
,
int
irq
,
int
level
)
static
void
cpu_request_exit
(
void
*
opaque
,
int
irq
,
int
level
)
{
{
CPU
X86State
*
env
=
cpu_single_env
;
CPU
State
*
cpu
=
current_cpu
;
if
(
env
&&
level
)
{
if
(
cpu
&&
level
)
{
cpu_exit
(
CPU
(
x86_env_get_cpu
(
env
))
);
cpu_exit
(
cpu
);
}
}
}
}
...
...
hw/intc/arm_gic.c
浏览文件 @
4917cf44
...
@@ -39,8 +39,7 @@ static const uint8_t gic_id[] = {
...
@@ -39,8 +39,7 @@ static const uint8_t gic_id[] = {
static
inline
int
gic_get_current_cpu
(
GICState
*
s
)
static
inline
int
gic_get_current_cpu
(
GICState
*
s
)
{
{
if
(
s
->
num_cpu
>
1
)
{
if
(
s
->
num_cpu
>
1
)
{
CPUState
*
cpu
=
ENV_GET_CPU
(
cpu_single_env
);
return
current_cpu
->
cpu_index
;
return
cpu
->
cpu_index
;
}
}
return
0
;
return
0
;
}
}
...
...
hw/intc/armv7m_nvic.c
浏览文件 @
4917cf44
...
@@ -140,6 +140,7 @@ void armv7m_nvic_complete_irq(void *opaque, int irq)
...
@@ -140,6 +140,7 @@ void armv7m_nvic_complete_irq(void *opaque, int irq)
static
uint32_t
nvic_readl
(
nvic_state
*
s
,
uint32_t
offset
)
static
uint32_t
nvic_readl
(
nvic_state
*
s
,
uint32_t
offset
)
{
{
ARMCPU
*
cpu
;
uint32_t
val
;
uint32_t
val
;
int
irq
;
int
irq
;
...
@@ -171,7 +172,8 @@ static uint32_t nvic_readl(nvic_state *s, uint32_t offset)
...
@@ -171,7 +172,8 @@ static uint32_t nvic_readl(nvic_state *s, uint32_t offset)
case
0x1c
:
/* SysTick Calibration Value. */
case
0x1c
:
/* SysTick Calibration Value. */
return
10000
;
return
10000
;
case
0xd00
:
/* CPUID Base. */
case
0xd00
:
/* CPUID Base. */
return
cpu_single_env
->
cp15
.
c0_cpuid
;
cpu
=
ARM_CPU
(
current_cpu
);
return
cpu
->
env
.
cp15
.
c0_cpuid
;
case
0xd04
:
/* Interrupt Control State. */
case
0xd04
:
/* Interrupt Control State. */
/* VECTACTIVE */
/* VECTACTIVE */
val
=
s
->
gic
.
running_irq
[
0
];
val
=
s
->
gic
.
running_irq
[
0
];
...
@@ -206,7 +208,8 @@ static uint32_t nvic_readl(nvic_state *s, uint32_t offset)
...
@@ -206,7 +208,8 @@ static uint32_t nvic_readl(nvic_state *s, uint32_t offset)
val
|=
(
1
<<
31
);
val
|=
(
1
<<
31
);
return
val
;
return
val
;
case
0xd08
:
/* Vector Table Offset. */
case
0xd08
:
/* Vector Table Offset. */
return
cpu_single_env
->
v7m
.
vecbase
;
cpu
=
ARM_CPU
(
current_cpu
);
return
cpu
->
env
.
v7m
.
vecbase
;
case
0xd0c
:
/* Application Interrupt/Reset Control. */
case
0xd0c
:
/* Application Interrupt/Reset Control. */
return
0xfa05000
;
return
0xfa05000
;
case
0xd10
:
/* System Control. */
case
0xd10
:
/* System Control. */
...
@@ -279,6 +282,7 @@ static uint32_t nvic_readl(nvic_state *s, uint32_t offset)
...
@@ -279,6 +282,7 @@ static uint32_t nvic_readl(nvic_state *s, uint32_t offset)
static
void
nvic_writel
(
nvic_state
*
s
,
uint32_t
offset
,
uint32_t
value
)
static
void
nvic_writel
(
nvic_state
*
s
,
uint32_t
offset
,
uint32_t
value
)
{
{
ARMCPU
*
cpu
;
uint32_t
oldval
;
uint32_t
oldval
;
switch
(
offset
)
{
switch
(
offset
)
{
case
0x10
:
/* SysTick Control and Status. */
case
0x10
:
/* SysTick Control and Status. */
...
@@ -331,7 +335,8 @@ static void nvic_writel(nvic_state *s, uint32_t offset, uint32_t value)
...
@@ -331,7 +335,8 @@ static void nvic_writel(nvic_state *s, uint32_t offset, uint32_t value)
}
}
break
;
break
;
case
0xd08
:
/* Vector Table Offset. */
case
0xd08
:
/* Vector Table Offset. */
cpu_single_env
->
v7m
.
vecbase
=
value
&
0xffffff80
;
cpu
=
ARM_CPU
(
current_cpu
);
cpu
->
env
.
v7m
.
vecbase
=
value
&
0xffffff80
;
break
;
break
;
case
0xd0c
:
/* Application Interrupt/Reset Control. */
case
0xd0c
:
/* Application Interrupt/Reset Control. */
if
((
value
>>
16
)
==
0x05fa
)
{
if
((
value
>>
16
)
==
0x05fa
)
{
...
...
hw/intc/openpic.c
浏览文件 @
4917cf44
...
@@ -180,14 +180,11 @@ static int output_to_inttgt(int output)
...
@@ -180,14 +180,11 @@ static int output_to_inttgt(int output)
static
int
get_current_cpu
(
void
)
static
int
get_current_cpu
(
void
)
{
{
CPUState
*
cpu_single_cpu
;
if
(
!
current_cpu
)
{
if
(
!
cpu_single_env
)
{
return
-
1
;
return
-
1
;
}
}
cpu_single_cpu
=
ENV_GET_CPU
(
cpu_single_env
);
return
current_cpu
->
cpu_index
;
return
cpu_single_cpu
->
cpu_index
;
}
}
static
uint32_t
openpic_cpu_read_internal
(
void
*
opaque
,
hwaddr
addr
,
static
uint32_t
openpic_cpu_read_internal
(
void
*
opaque
,
hwaddr
addr
,
...
...
hw/mips/mips_fulong2e.c
浏览文件 @
4917cf44
...
@@ -250,10 +250,10 @@ static void network_init (PCIBus *pci_bus)
...
@@ -250,10 +250,10 @@ static void network_init (PCIBus *pci_bus)
static
void
cpu_request_exit
(
void
*
opaque
,
int
irq
,
int
level
)
static
void
cpu_request_exit
(
void
*
opaque
,
int
irq
,
int
level
)
{
{
CPU
MIPSState
*
env
=
cpu_single_env
;
CPU
State
*
cpu
=
current_cpu
;
if
(
env
&&
level
)
{
if
(
cpu
&&
level
)
{
cpu_exit
(
CPU
(
mips_env_get_cpu
(
env
))
);
cpu_exit
(
cpu
);
}
}
}
}
...
...
hw/mips/mips_jazz.c
浏览文件 @
4917cf44
...
@@ -99,10 +99,10 @@ static const MemoryRegionOps dma_dummy_ops = {
...
@@ -99,10 +99,10 @@ static const MemoryRegionOps dma_dummy_ops = {
static
void
cpu_request_exit
(
void
*
opaque
,
int
irq
,
int
level
)
static
void
cpu_request_exit
(
void
*
opaque
,
int
irq
,
int
level
)
{
{
CPU
MIPSState
*
env
=
cpu_single_env
;
CPU
State
*
cpu
=
current_cpu
;
if
(
env
&&
level
)
{
if
(
cpu
&&
level
)
{
cpu_exit
(
CPU
(
mips_env_get_cpu
(
env
))
);
cpu_exit
(
cpu
);
}
}
}
}
...
...
hw/mips/mips_malta.c
浏览文件 @
4917cf44
...
@@ -770,10 +770,10 @@ static void main_cpu_reset(void *opaque)
...
@@ -770,10 +770,10 @@ static void main_cpu_reset(void *opaque)
static
void
cpu_request_exit
(
void
*
opaque
,
int
irq
,
int
level
)
static
void
cpu_request_exit
(
void
*
opaque
,
int
irq
,
int
level
)
{
{
CPU
MIPSState
*
env
=
cpu_single_env
;
CPU
State
*
cpu
=
current_cpu
;
if
(
env
&&
level
)
{
if
(
cpu
&&
level
)
{
cpu_exit
(
CPU
(
mips_env_get_cpu
(
env
))
);
cpu_exit
(
cpu
);
}
}
}
}
...
...
hw/misc/vmport.c
浏览文件 @
4917cf44
...
@@ -62,11 +62,13 @@ static uint64_t vmport_ioport_read(void *opaque, hwaddr addr,
...
@@ -62,11 +62,13 @@ static uint64_t vmport_ioport_read(void *opaque, hwaddr addr,
unsigned
size
)
unsigned
size
)
{
{
VMPortState
*
s
=
opaque
;
VMPortState
*
s
=
opaque
;
CPUX86State
*
env
=
cpu_single_env
;
CPUState
*
cs
=
current_cpu
;
X86CPU
*
cpu
=
X86_CPU
(
cs
);
CPUX86State
*
env
=
&
cpu
->
env
;
unsigned
char
command
;
unsigned
char
command
;
uint32_t
eax
;
uint32_t
eax
;
cpu_synchronize_state
(
CPU
(
x86_env_get_cpu
(
env
))
);
cpu_synchronize_state
(
cs
);
eax
=
env
->
regs
[
R_EAX
];
eax
=
env
->
regs
[
R_EAX
];
if
(
eax
!=
VMPORT_MAGIC
)
if
(
eax
!=
VMPORT_MAGIC
)
...
@@ -89,29 +91,32 @@ static uint64_t vmport_ioport_read(void *opaque, hwaddr addr,
...
@@ -89,29 +91,32 @@ static uint64_t vmport_ioport_read(void *opaque, hwaddr addr,
static
void
vmport_ioport_write
(
void
*
opaque
,
hwaddr
addr
,
static
void
vmport_ioport_write
(
void
*
opaque
,
hwaddr
addr
,
uint64_t
val
,
unsigned
size
)
uint64_t
val
,
unsigned
size
)
{
{
CPUX86State
*
env
=
cpu_single_env
;
X86CPU
*
cpu
=
X86_CPU
(
current_cpu
)
;
env
->
regs
[
R_EAX
]
=
vmport_ioport_read
(
opaque
,
addr
,
4
);
cpu
->
env
.
regs
[
R_EAX
]
=
vmport_ioport_read
(
opaque
,
addr
,
4
);
}
}
static
uint32_t
vmport_cmd_get_version
(
void
*
opaque
,
uint32_t
addr
)
static
uint32_t
vmport_cmd_get_version
(
void
*
opaque
,
uint32_t
addr
)
{
{
CPUX86State
*
env
=
cpu_single_env
;
X86CPU
*
cpu
=
X86_CPU
(
current_cpu
);
env
->
regs
[
R_EBX
]
=
VMPORT_MAGIC
;
cpu
->
env
.
regs
[
R_EBX
]
=
VMPORT_MAGIC
;
return
6
;
return
6
;
}
}
static
uint32_t
vmport_cmd_ram_size
(
void
*
opaque
,
uint32_t
addr
)
static
uint32_t
vmport_cmd_ram_size
(
void
*
opaque
,
uint32_t
addr
)
{
{
CPUX86State
*
env
=
cpu_single_env
;
X86CPU
*
cpu
=
X86_CPU
(
current_cpu
);
env
->
regs
[
R_EBX
]
=
0x1177
;
cpu
->
env
.
regs
[
R_EBX
]
=
0x1177
;
return
ram_size
;
return
ram_size
;
}
}
/* vmmouse helpers */
/* vmmouse helpers */
void
vmmouse_get_data
(
uint32_t
*
data
)
void
vmmouse_get_data
(
uint32_t
*
data
)
{
{
CPUX86State
*
env
=
cpu_single_env
;
X86CPU
*
cpu
=
X86_CPU
(
current_cpu
);
CPUX86State
*
env
=
&
cpu
->
env
;
data
[
0
]
=
env
->
regs
[
R_EAX
];
data
[
1
]
=
env
->
regs
[
R_EBX
];
data
[
0
]
=
env
->
regs
[
R_EAX
];
data
[
1
]
=
env
->
regs
[
R_EBX
];
data
[
2
]
=
env
->
regs
[
R_ECX
];
data
[
3
]
=
env
->
regs
[
R_EDX
];
data
[
2
]
=
env
->
regs
[
R_ECX
];
data
[
3
]
=
env
->
regs
[
R_EDX
];
...
@@ -120,7 +125,8 @@ void vmmouse_get_data(uint32_t *data)
...
@@ -120,7 +125,8 @@ void vmmouse_get_data(uint32_t *data)
void
vmmouse_set_data
(
const
uint32_t
*
data
)
void
vmmouse_set_data
(
const
uint32_t
*
data
)
{
{
CPUX86State
*
env
=
cpu_single_env
;
X86CPU
*
cpu
=
X86_CPU
(
current_cpu
);
CPUX86State
*
env
=
&
cpu
->
env
;
env
->
regs
[
R_EAX
]
=
data
[
0
];
env
->
regs
[
R_EBX
]
=
data
[
1
];
env
->
regs
[
R_EAX
]
=
data
[
0
];
env
->
regs
[
R_EBX
]
=
data
[
1
];
env
->
regs
[
R_ECX
]
=
data
[
2
];
env
->
regs
[
R_EDX
]
=
data
[
3
];
env
->
regs
[
R_ECX
]
=
data
[
2
];
env
->
regs
[
R_EDX
]
=
data
[
3
];
...
...
hw/ppc/mpc8544_guts.c
浏览文件 @
4917cf44
...
@@ -68,7 +68,8 @@ static uint64_t mpc8544_guts_read(void *opaque, hwaddr addr,
...
@@ -68,7 +68,8 @@ static uint64_t mpc8544_guts_read(void *opaque, hwaddr addr,
unsigned
size
)
unsigned
size
)
{
{
uint32_t
value
=
0
;
uint32_t
value
=
0
;
CPUPPCState
*
env
=
cpu_single_env
;
PowerPCCPU
*
cpu
=
POWERPC_CPU
(
current_cpu
);
CPUPPCState
*
env
=
&
cpu
->
env
;
addr
&=
MPC8544_GUTS_MMIO_SIZE
-
1
;
addr
&=
MPC8544_GUTS_MMIO_SIZE
-
1
;
switch
(
addr
)
{
switch
(
addr
)
{
...
...
hw/ppc/prep.c
浏览文件 @
4917cf44
...
@@ -417,10 +417,10 @@ static const MemoryRegionOps PPC_prep_io_ops = {
...
@@ -417,10 +417,10 @@ static const MemoryRegionOps PPC_prep_io_ops = {
static
void
cpu_request_exit
(
void
*
opaque
,
int
irq
,
int
level
)
static
void
cpu_request_exit
(
void
*
opaque
,
int
irq
,
int
level
)
{
{
CPU
PPCState
*
env
=
cpu_single_env
;
CPU
State
*
cpu
=
current_cpu
;
if
(
env
&&
level
)
{
if
(
cpu
&&
level
)
{
cpu_exit
(
CPU
(
ppc_env_get_cpu
(
env
))
);
cpu_exit
(
cpu
);
}
}
}
}
...
...
hw/sparc/sun4m.c
浏览文件 @
4917cf44
...
@@ -264,9 +264,8 @@ static void secondary_cpu_reset(void *opaque)
...
@@ -264,9 +264,8 @@ static void secondary_cpu_reset(void *opaque)
static
void
cpu_halt_signal
(
void
*
opaque
,
int
irq
,
int
level
)
static
void
cpu_halt_signal
(
void
*
opaque
,
int
irq
,
int
level
)
{
{
if
(
level
&&
cpu_single_env
)
{
if
(
level
&&
current_cpu
)
{
cpu_interrupt
(
CPU
(
sparc_env_get_cpu
(
cpu_single_env
)),
cpu_interrupt
(
current_cpu
,
CPU_INTERRUPT_HALT
);
CPU_INTERRUPT_HALT
);
}
}
}
}
...
...
hw/timer/arm_mptimer.c
浏览文件 @
4917cf44
...
@@ -49,13 +49,11 @@ typedef struct {
...
@@ -49,13 +49,11 @@ typedef struct {
static
inline
int
get_current_cpu
(
ARMMPTimerState
*
s
)
static
inline
int
get_current_cpu
(
ARMMPTimerState
*
s
)
{
{
CPUState
*
cpu_single_cpu
=
ENV_GET_CPU
(
cpu_single_env
);
if
(
current_cpu
->
cpu_index
>=
s
->
num_cpu
)
{
if
(
cpu_single_cpu
->
cpu_index
>=
s
->
num_cpu
)
{
hw_error
(
"arm_mptimer: num-cpu %d but this cpu is %d!
\n
"
,
hw_error
(
"arm_mptimer: num-cpu %d but this cpu is %d!
\n
"
,
s
->
num_cpu
,
c
pu_single
_cpu
->
cpu_index
);
s
->
num_cpu
,
c
urrent
_cpu
->
cpu_index
);
}
}
return
c
pu_single
_cpu
->
cpu_index
;
return
c
urrent
_cpu
->
cpu_index
;
}
}
static
inline
void
timerblock_update_irq
(
TimerBlock
*
tb
)
static
inline
void
timerblock_update_irq
(
TimerBlock
*
tb
)
...
...
include/exec/cpu-all.h
浏览文件 @
4917cf44
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#define CPU_ALL_H
#define CPU_ALL_H
#include "qemu-common.h"
#include "qemu-common.h"
#include "qemu/tls.h"
#include "exec/cpu-common.h"
#include "exec/cpu-common.h"
#include "qemu/thread.h"
#include "qemu/thread.h"
...
@@ -358,8 +357,6 @@ CPUArchState *cpu_copy(CPUArchState *env);
...
@@ -358,8 +357,6 @@ CPUArchState *cpu_copy(CPUArchState *env);
void
QEMU_NORETURN
cpu_abort
(
CPUArchState
*
env
,
const
char
*
fmt
,
...)
void
QEMU_NORETURN
cpu_abort
(
CPUArchState
*
env
,
const
char
*
fmt
,
...)
GCC_FMT_ATTR
(
2
,
3
);
GCC_FMT_ATTR
(
2
,
3
);
extern
CPUArchState
*
first_cpu
;
extern
CPUArchState
*
first_cpu
;
DECLARE_TLS
(
CPUArchState
*
,
cpu_single_env
);
#define cpu_single_env tls_var(cpu_single_env)
/* Flags for use in ENV->INTERRUPT_PENDING.
/* Flags for use in ENV->INTERRUPT_PENDING.
...
...
include/qom/cpu.h
浏览文件 @
4917cf44
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "hw/qdev-core.h"
#include "hw/qdev-core.h"
#include "exec/hwaddr.h"
#include "exec/hwaddr.h"
#include "qemu/thread.h"
#include "qemu/thread.h"
#include "qemu/tls.h"
#include "qemu/typedefs.h"
#include "qemu/typedefs.h"
typedef
int
(
*
WriteCoreDumpFunction
)(
void
*
buf
,
size_t
size
,
void
*
opaque
);
typedef
int
(
*
WriteCoreDumpFunction
)(
void
*
buf
,
size_t
size
,
void
*
opaque
);
...
@@ -156,6 +157,9 @@ struct CPUState {
...
@@ -156,6 +157,9 @@ struct CPUState {
uint32_t
halted
;
/* used by alpha, cris, ppc TCG */
uint32_t
halted
;
/* used by alpha, cris, ppc TCG */
};
};
DECLARE_TLS
(
CPUState
*
,
current_cpu
);
#define current_cpu tls_var(current_cpu)
/**
/**
* cpu_paging_enabled:
* cpu_paging_enabled:
* @cpu: The CPU whose state is to be inspected.
* @cpu: The CPU whose state is to be inspected.
...
...
memory.c
浏览文件 @
4917cf44
...
@@ -838,9 +838,8 @@ static uint64_t unassigned_mem_read(void *opaque, hwaddr addr,
...
@@ -838,9 +838,8 @@ static uint64_t unassigned_mem_read(void *opaque, hwaddr addr,
#ifdef DEBUG_UNASSIGNED
#ifdef DEBUG_UNASSIGNED
printf
(
"Unassigned mem read "
TARGET_FMT_plx
"
\n
"
,
addr
);
printf
(
"Unassigned mem read "
TARGET_FMT_plx
"
\n
"
,
addr
);
#endif
#endif
if
(
cpu_single_env
!=
NULL
)
{
if
(
current_cpu
!=
NULL
)
{
cpu_unassigned_access
(
ENV_GET_CPU
(
cpu_single_env
),
cpu_unassigned_access
(
current_cpu
,
addr
,
false
,
false
,
0
,
size
);
addr
,
false
,
false
,
0
,
size
);
}
}
return
0
;
return
0
;
}
}
...
@@ -851,9 +850,8 @@ static void unassigned_mem_write(void *opaque, hwaddr addr,
...
@@ -851,9 +850,8 @@ static void unassigned_mem_write(void *opaque, hwaddr addr,
#ifdef DEBUG_UNASSIGNED
#ifdef DEBUG_UNASSIGNED
printf
(
"Unassigned mem write "
TARGET_FMT_plx
" = 0x%"
PRIx64
"
\n
"
,
addr
,
val
);
printf
(
"Unassigned mem write "
TARGET_FMT_plx
" = 0x%"
PRIx64
"
\n
"
,
addr
,
val
);
#endif
#endif
if
(
cpu_single_env
!=
NULL
)
{
if
(
current_cpu
!=
NULL
)
{
cpu_unassigned_access
(
ENV_GET_CPU
(
cpu_single_env
),
cpu_unassigned_access
(
current_cpu
,
addr
,
true
,
false
,
0
,
size
);
addr
,
true
,
false
,
0
,
size
);
}
}
}
}
...
...
translate-all.c
浏览文件 @
4917cf44
...
@@ -999,8 +999,10 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
...
@@ -999,8 +999,10 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
int
is_cpu_write_access
)
int
is_cpu_write_access
)
{
{
TranslationBlock
*
tb
,
*
tb_next
,
*
saved_tb
;
TranslationBlock
*
tb
,
*
tb_next
,
*
saved_tb
;
CPUArchState
*
env
=
cpu_single_env
;
CPUState
*
cpu
=
current_cpu
;
CPUState
*
cpu
=
NULL
;
#if defined(TARGET_HAS_PRECISE_SMC) || !defined(CONFIG_USER_ONLY)
CPUArchState
*
env
=
NULL
;
#endif
tb_page_addr_t
tb_start
,
tb_end
;
tb_page_addr_t
tb_start
,
tb_end
;
PageDesc
*
p
;
PageDesc
*
p
;
int
n
;
int
n
;
...
@@ -1023,9 +1025,11 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
...
@@ -1023,9 +1025,11 @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
/* build code bitmap */
/* build code bitmap */
build_page_bitmap
(
p
);
build_page_bitmap
(
p
);
}
}
if
(
env
!=
NULL
)
{
#if defined(TARGET_HAS_PRECISE_SMC) || !defined(CONFIG_USER_ONLY)
cpu
=
ENV_GET_CPU
(
env
);
if
(
cpu
!=
NULL
)
{
env
=
cpu
->
env_ptr
;
}
}
#endif
/* we remove all the TBs in the range [start, end[ */
/* we remove all the TBs in the range [start, end[ */
/* XXX: see if in some cases it could be faster to invalidate all
/* XXX: see if in some cases it could be faster to invalidate all
...
@@ -1147,8 +1151,8 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr,
...
@@ -1147,8 +1151,8 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr,
int
n
;
int
n
;
#ifdef TARGET_HAS_PRECISE_SMC
#ifdef TARGET_HAS_PRECISE_SMC
TranslationBlock
*
current_tb
=
NULL
;
TranslationBlock
*
current_tb
=
NULL
;
CPU
ArchState
*
env
=
cpu_single_env
;
CPU
State
*
cpu
=
current_cpu
;
CPU
State
*
cpu
=
NULL
;
CPU
ArchState
*
env
=
NULL
;
int
current_tb_modified
=
0
;
int
current_tb_modified
=
0
;
target_ulong
current_pc
=
0
;
target_ulong
current_pc
=
0
;
target_ulong
current_cs_base
=
0
;
target_ulong
current_cs_base
=
0
;
...
@@ -1165,8 +1169,8 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr,
...
@@ -1165,8 +1169,8 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr,
if
(
tb
&&
pc
!=
0
)
{
if
(
tb
&&
pc
!=
0
)
{
current_tb
=
tb_find_pc
(
pc
);
current_tb
=
tb_find_pc
(
pc
);
}
}
if
(
env
!=
NULL
)
{
if
(
cpu
!=
NULL
)
{
cpu
=
ENV_GET_CPU
(
env
)
;
env
=
cpu
->
env_ptr
;
}
}
#endif
#endif
while
(
tb
!=
NULL
)
{
while
(
tb
!=
NULL
)
{
...
...
user-exec.c
浏览文件 @
4917cf44
...
@@ -81,6 +81,7 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
...
@@ -81,6 +81,7 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
int
is_write
,
sigset_t
*
old_set
,
int
is_write
,
sigset_t
*
old_set
,
void
*
puc
)
void
*
puc
)
{
{
CPUArchState
*
env
;
int
ret
;
int
ret
;
#if defined(DEBUG_SIGNAL)
#if defined(DEBUG_SIGNAL)
...
@@ -93,9 +94,9 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
...
@@ -93,9 +94,9 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
return
1
;
return
1
;
}
}
env
=
current_cpu
->
env_ptr
;
/* see if it is an MMU fault */
/* see if it is an MMU fault */
ret
=
cpu_handle_mmu_fault
(
cpu_single_env
,
address
,
is_write
,
ret
=
cpu_handle_mmu_fault
(
env
,
address
,
is_write
,
MMU_USER_IDX
);
MMU_USER_IDX
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
return
0
;
/* not an MMU fault */
return
0
;
/* not an MMU fault */
}
}
...
@@ -103,12 +104,12 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
...
@@ -103,12 +104,12 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
return
1
;
/* the MMU fault was handled without causing real CPU fault */
return
1
;
/* the MMU fault was handled without causing real CPU fault */
}
}
/* now we have a real cpu fault */
/* now we have a real cpu fault */
cpu_restore_state
(
cpu_single_
env
,
pc
);
cpu_restore_state
(
env
,
pc
);
/* we restore the process signal mask as the sigreturn should
/* we restore the process signal mask as the sigreturn should
do it (XXX: use sigsetjmp) */
do it (XXX: use sigsetjmp) */
sigprocmask
(
SIG_SETMASK
,
old_set
,
NULL
);
sigprocmask
(
SIG_SETMASK
,
old_set
,
NULL
);
exception_action
(
cpu_single_
env
);
exception_action
(
env
);
/* never comes here */
/* never comes here */
return
1
;
return
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录