diff mbox series

[02/14] hw/i386/vmport: Set EAX to -1 on failed and unsupported commands

Message ID 20200309235411.76587-3-liran.alon@oracle.com (mailing list archive)
State New, archived
Headers show
Series : hw/i386/vmport: Bug fixes and improvements | expand

Commit Message

Liran Alon March 9, 2020, 11:53 p.m. UTC
This is used as a signal for VMware Tools to know if a command it
attempted to invoke, failed or is unsupported. As a result, VMware Tools
will either report failure to user or fallback to another backdoor command
in attempt to perform some operation.

A few examples:
* open-vm-tools TimeSyncReadHost() function fallbacks to
CMD_GETTIMEFULL command when CMD_GETTIMEFULL_WITH_LAG
fails/unsupported.
* open-vm-tools Hostinfo_NestingSupported() function verifies
EAX != -1 to check for success.
* open-vm-tools Hostinfo_VCPUInfoBackdoor() functions checks
if reserved-bit is set to indicate command is unimplemented.

Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
---
 hw/i386/vmport.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c
index 9319720e8204..a78e20040a79 100644
--- a/hw/i386/vmport.c
+++ b/hw/i386/vmport.c
@@ -72,6 +72,7 @@  static uint64_t vmport_ioport_read(void *opaque, hwaddr addr,
 
     eax = env->regs[R_EAX];
     if (eax != VMPORT_MAGIC) {
+        eax = UINT32_MAX;
         goto out;
     }
 
@@ -79,6 +80,7 @@  static uint64_t vmport_ioport_read(void *opaque, hwaddr addr,
     trace_vmport_command(command);
     if (command >= VMPORT_ENTRIES || !s->func[command]) {
         qemu_log_mask(LOG_UNIMP, "vmport: unknown command %x\n", command);
+        eax = UINT32_MAX;
         goto out;
     }