summaryrefslogtreecommitdiff
path: root/qemu-kvm-helper.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-07-19 15:15:55 +0300
committerAvi Kivity <avi@qumranet.com>2007-07-19 15:15:55 +0300
commitb15818a4843d4fe72d5823d56304af5d7faa66f3 (patch)
treef330537cd93ee0ab15367476f36345725a9f3aae /qemu-kvm-helper.c
parent1a2fb761f4d676c7fa479804f574e4d6d9c3f460 (diff)
Use a kvm-specific main loop
- main loop is kvm private - we no long run with global qemu variables in registers; this should ease register pressure
Diffstat (limited to 'qemu-kvm-helper.c')
-rw-r--r--qemu-kvm-helper.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/qemu-kvm-helper.c b/qemu-kvm-helper.c
new file mode 100644
index 000000000..9420eb176
--- /dev/null
+++ b/qemu-kvm-helper.c
@@ -0,0 +1,40 @@
+
+#include "config.h"
+#include "config-host.h"
+
+#include "exec.h"
+
+#include "qemu-kvm.h"
+
+void qemu_kvm_call_with_env(void (*func)(void *), void *data, CPUState *newenv)
+{
+ CPUState *oldenv;
+#define DECLARE_HOST_REGS
+#include "hostregs_helper.h"
+
+ oldenv = newenv;
+
+#define SAVE_HOST_REGS
+#include "hostregs_helper.h"
+
+ env = newenv;
+
+ env_to_regs();
+ func(data);
+ regs_to_env();
+
+ env = oldenv;
+
+#include "hostregs_helper.h"
+}
+
+static void call_helper_cpuid(void *junk)
+{
+ helper_cpuid();
+}
+
+void qemu_kvm_cpuid_on_env(CPUState *env)
+{
+ qemu_kvm_call_with_env(call_helper_cpuid, NULL, env);
+}
+