diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2010-03-29 19:24:00 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-03-29 19:24:00 +0000 |
commit | 29e922b61fb3d93836825ca9731bb2cadbb6ed72 (patch) | |
tree | b461e05df4e043c3015857ca95fbfdf704bab059 /cpus.c | |
parent | 5c4532ee7894277d8d54db108e891c4204d15f1d (diff) | |
download | qemu-29e922b61fb3d93836825ca9731bb2cadbb6ed72.zip qemu-29e922b61fb3d93836825ca9731bb2cadbb6ed72.tar.gz qemu-29e922b61fb3d93836825ca9731bb2cadbb6ed72.tar.bz2 |
Compile qemu-timer only once
Arrange various declarations so that also non-CPU code can access
them, adjust users.
Move CPU specific code to cpus.c.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'cpus.c')
-rw-r--r-- | cpus.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -771,3 +771,19 @@ void set_cpu_log(const char *optarg) } cpu_set_log(mask); } + +/* Return the virtual CPU time, based on the instruction counter. */ +int64_t cpu_get_icount(void) +{ + int64_t icount; + CPUState *env = cpu_single_env;; + + icount = qemu_icount; + if (env) { + if (!can_do_io(env)) { + fprintf(stderr, "Bad clock read\n"); + } + icount -= (env->icount_decr.u16.low + env->icount_extra); + } + return qemu_icount_bias + (icount << icount_time_shift); +} |