|
| From: | Anthony Liguori |
| Subject: | Re: [Qemu-devel] Re: [6684] Fix "info registers" under kvm. |
| Date: | Sun, 08 Mar 2009 11:36:40 -0500 |
| User-agent: | Thunderbird 2.0.0.19 (X11/20090105) |
Avi Kivity wrote:
Avi Kivity wrote:Jan Kiszka wrote:I'm just still waiting for a reply from Anthony on how to embed best allthe "if (kvm_enabled()) foo();" patterns [2]. That would also allow us to merge gdbstub support for upstream kvm.Wouldn't 'if (!kvm_enabled()) return;' inside the callees suffice?Rather, static inline void kvm_foo(...) { if (!kvm_enabled()) { return; } #ifdef CONFIG_KVM kvm_do_foo(); #endif }
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);
}
}
Regards,
Anthony Liguori
| [Prev in Thread] | Current Thread | [Next in Thread] |