~serge-hallyn/ubuntu/lucid/qemu-kvm/fix-boot-once

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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);
}