summaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-08-26 05:39:29 +0200
committerAndreas Färber <afaerber@suse.de>2014-03-13 19:20:46 +0100
commitefee734004c42ba185098086e5185d8a85ed02af (patch)
treec833ce3ecabba6aa1595db4e5312ccd023b639b6 /cpus.c
parent99df7dce8ae81e4a42dac98094ccca3a32dcf8f8 (diff)
cpu: Move icount_extra field from CPU_COMMON to CPUState
Reset it. Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/cpus.c b/cpus.c
index 05016dc9c7..e9c17ae942 100644
--- a/cpus.c
+++ b/cpus.c
@@ -143,7 +143,7 @@ static int64_t cpu_get_icount_locked(void)
if (!cpu_can_do_io(cpu)) {
fprintf(stderr, "Bad clock read\n");
}
- icount -= (env->icount_decr.u16.low + env->icount_extra);
+ icount -= (env->icount_decr.u16.low + cpu->icount_extra);
}
return qemu_icount_bias + (icount << icount_time_shift);
}
@@ -1236,6 +1236,7 @@ int vm_stop_force_state(RunState state)
static int tcg_cpu_exec(CPUArchState *env)
{
+ CPUState *cpu = ENV_GET_CPU(env);
int ret;
#ifdef CONFIG_PROFILER
int64_t ti;
@@ -1248,9 +1249,9 @@ static int tcg_cpu_exec(CPUArchState *env)
int64_t count;
int64_t deadline;
int decr;
- qemu_icount -= (env->icount_decr.u16.low + env->icount_extra);
+ qemu_icount -= (env->icount_decr.u16.low + cpu->icount_extra);
env->icount_decr.u16.low = 0;
- env->icount_extra = 0;
+ cpu->icount_extra = 0;
deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
/* Maintain prior (possibly buggy) behaviour where if no deadline
@@ -1267,7 +1268,7 @@ static int tcg_cpu_exec(CPUArchState *env)
decr = (count > 0xffff) ? 0xffff : count;
count -= decr;
env->icount_decr.u16.low = decr;
- env->icount_extra = count;
+ cpu->icount_extra = count;
}
ret = cpu_exec(env);
#ifdef CONFIG_PROFILER
@@ -1276,10 +1277,9 @@ static int tcg_cpu_exec(CPUArchState *env)
if (use_icount) {
/* Fold pending instructions back into the
instruction counter, and clear the interrupt flag. */
- qemu_icount -= (env->icount_decr.u16.low
- + env->icount_extra);
+ qemu_icount -= (env->icount_decr.u16.low + cpu->icount_extra);
env->icount_decr.u32 = 0;
- env->icount_extra = 0;
+ cpu->icount_extra = 0;
}
return ret;
}