Message ID | 20201120094900.1489-2-paul@xen.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | viridian: add support for ExProcessorMasks | expand |
On 20.11.2020 10:48, Paul Durrant wrote: > From: Paul Durrant <pdurrant@amazon.com> > > If hvm_guest_x86_mode() returns something other than 8 or 4 then > viridian_hypercall() will return immediately but, on the way out, will write > back status as if 'mode' was 4. This patch simply makes it leave the registers > alone. IOW 16-bit protected mode and real mode aren't allowed to make hypercalls (supported also be the earlier switch() in the function)? But then, to achieve what you want, wouldn't it be more direct to simply "return HVM_HCALL_completed;" straight from that earlier switch()'s default case? At which point the switch() you modify could become if/else? Anyway - you're the maintainer, I'm just wondering ... Jan
> -----Original Message----- > From: Jan Beulich <jbeulich@suse.com> > Sent: 20 November 2020 14:20 > To: Paul Durrant <paul@xen.org> > Cc: Durrant, Paul <pdurrant@amazon.co.uk>; Wei Liu <wl@xen.org>; Andrew Cooper > <andrew.cooper3@citrix.com>; Roger Pau Monné <roger.pau@citrix.com>; xen-devel@lists.xenproject.org > Subject: RE: [EXTERNAL] [PATCH v2 01/12] viridian: don't blindly write to 32-bit registers is 'mode' > is invalid > > CAUTION: This email originated from outside of the organization. Do not click links or open > attachments unless you can confirm the sender and know the content is safe. > > > > On 20.11.2020 10:48, Paul Durrant wrote: > > From: Paul Durrant <pdurrant@amazon.com> > > > > If hvm_guest_x86_mode() returns something other than 8 or 4 then > > viridian_hypercall() will return immediately but, on the way out, will write > > back status as if 'mode' was 4. This patch simply makes it leave the registers > > alone. > > IOW 16-bit protected mode and real mode aren't allowed to make > hypercalls (supported also be the earlier switch() in the > function)? I don't think running enlightened versions of OS/2 1.3 is really a use case :-) > But then, to achieve what you want, wouldn't it be > more direct to simply "return HVM_HCALL_completed;" straight > from that earlier switch()'s default case? At which point the > switch() you modify could become if/else? Anyway - you're the > maintainer, I'm just wondering ... > It could be done that way but I prefer the exit path via goto. Paul > Jan
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c index dc7183a54627..54035f75cb1a 100644 --- a/xen/arch/x86/hvm/viridian/viridian.c +++ b/xen/arch/x86/hvm/viridian/viridian.c @@ -692,13 +692,14 @@ int viridian_hypercall(struct cpu_user_regs *regs) break; } -out: + out: output.result = status; switch (mode) { case 8: regs->rax = output.raw; break; - default: + + case 4: regs->rdx = output.raw >> 32; regs->rax = (uint32_t)output.raw; break;