aboutsummaryrefslogtreecommitdiff
blob: 915d664398f2f2f82ad350b4e88d778b81bf96d6 (plain)
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
#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)
{
    host_reg_t saved_env_reg;
    CPUState *oldenv;

    oldenv = newenv;

    saved_env_reg = (host_reg_t) env;
    env = newenv;

    func(data);

    env = oldenv;
    asm("");
    env = (void *) saved_env_reg;
}

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);
}