On Tue, 2023-02-14 at 10:10 +0000, Paul Durrant wrote: > There's a nasty little semantic subtlety here which has been missed... > If the guest is not in longmode then the timer value is actually split > across param[0] and param[1] (so that it is still 64-bits).
I'll work this in. I should be able to exercise this with the XTF tests. diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c index b537d03be7..4781b1fa97 100644 --- a/target/i386/kvm/xen-emu.c +++ b/target/i386/kvm/xen-emu.c @@ -1467,8 +1467,15 @@ static bool do_kvm_xen_handle_exit(X86CPU *cpu, struct kvm_xen_exit *exit) switch (code) { case __HYPERVISOR_set_timer_op: - return kvm_xen_hcall_set_timer_op(exit, cpu, - exit->u.hcall.params[0]); + if (exit->u.hcall.longmode) { + return kvm_xen_hcall_set_timer_op(exit, cpu, + exit->u.hcall.params[0]); + } else { + /* In 32-bit mode, the 64-bit timer value is in two args. */ + uint64_t val = ((uint64_t)exit->u.hcall.params[1]) << 32 | + (uint32_t)exit->u.hcall.params[0]; + return kvm_xen_hcall_set_timer_op(exit, cpu, val); + } case __HYPERVISOR_grant_table_op: return kvm_xen_hcall_gnttab_op(exit, cpu, exit->u.hcall.params[0], exit->u.hcall.params[1],
smime.p7s
Description: S/MIME cryptographic signature