|
| From: | Avi Kivity |
| Subject: | Re: [Qemu-devel] Re: [6684] Fix "info registers" under kvm. |
| Date: | Mon, 09 Mar 2009 11:41:20 +0200 |
| User-agent: | Thunderbird 2.0.0.19 (X11/20090105) |
Anthony Liguori wrote:
In the case of save/load registers, I'd prefer wrapper functions like:
cpu_state_update(CPUState *env, int is_dirty)
That could be hooked by something like Xen. The implementation would be:
static void cpu_state_update(CPUState *env, int is_dirty)
{
if (kvm_enabled()) {
if (is_dirty)
kvm_arch_save_registers(env);
else
kvm_arch_load_registers(env);
}
}
That reduces readability IMO (boolean parameters do that, as well as a function where the direction of data movement isn't clear).
But we could keep dirty in the environment, and do everything automatically.
random qemu code:
cpu_state_sync(env);
// read registers
// write registers
cpu_state_dirty(env);
kvm arch code:
if (env->registers_dirty) {
copy registers to kernel
env->registers_dirty = 0;
}
The kernel code does similar things for registers which can be either in
memory or in the vmcs; it uses accessors so cpu_state_sync() and
cpu_state_dirty() aren't needed;
-- error compiling committee.c: too many arguments to function
| [Prev in Thread] | Current Thread | [Next in Thread] |