Macros | Functions | Variables
vmware.h File Reference

VMware backdoor mechanism. More...

#include <stdint.h>

Go to the source code of this file.


#define VMW_PORT   0x5658
 VMware backdoor I/O port. More...
#define VMW_MAGIC   0x564d5868 /* "VMXh" */
 VMware backdoor magic value. More...
#define VMW_BACKDOOR   "inl %%dx, %%eax"
 VMware backdoor magic instruction. More...
#define VMW_CMD_GET_VERSION   0x0a
 Get VMware version. More...
#define VMW_CMD_GUESTRPC   0x1e
 Issue GuestRPC command. More...


static __attribute__ ((always_inline)) void vmware_cmd_get_version(uint32_t *version
 Get VMware version. More...
__asm__ __volatile__ (VMW_BACKDOOR :"=a"(*version), "=b"(*magic), "=c"(*product_type), "=d"(discard_d) :"0"(VMW_MAGIC), "1"(0), "2"(VMW_CMD_GET_VERSION), "3"(VMW_PORT))
int vmware_present (void)
 Detect VMware presence. More...


static uint32_tmagic
static uint32_t uint32_tproduct_type
static uint16_t subcommand
static uint16_t uint32_t parameter
static uint16_t uint32_t uint16_tedxhi = ( edx >> 16 )
static uint16_t uint32_t uint16_t uint32_tebx
uint32_t status
uint32_t edx

Detailed Description

VMware backdoor mechanism.

Definition in file vmware.h.

Macro Definition Documentation


#define VMW_PORT   0x5658

VMware backdoor I/O port.

Definition at line 15 of file vmware.h.


#define VMW_MAGIC   0x564d5868 /* "VMXh" */

VMware backdoor magic value.

Definition at line 18 of file vmware.h.


#define VMW_BACKDOOR   "inl %%dx, %%eax"

VMware backdoor magic instruction.

Definition at line 21 of file vmware.h.


#define VMW_CMD_GET_VERSION   0x0a

Get VMware version.

Definition at line 24 of file vmware.h.


#define VMW_CMD_GUESTRPC   0x1e

Issue GuestRPC command.

Definition at line 27 of file vmware.h.

Function Documentation



◆ __attribute__()

static __attribute__ ( (always_inline)  )

Get VMware version.

Issue GuestRPC command.

Return values
versionVMware version(?)
magicVMware magic number, if present
product_typeVMware product type
channelChannel number
subcommandGuestRPC subcommand
parameterSubcommand-specific parameter
Return values
edxhiSubcommand-specific result
ebxSubcommand-specific result
statusCommand status

◆ __volatile__()

__asm__ __volatile__ ( )

◆ vmware_present()

int vmware_present ( void  )

Detect VMware presence.

Return values
rcReturn status code

Definition at line 45 of file vmware.c.

45  {
50  /* Perform backdoor call */
51  vmware_cmd_get_version ( &version, &magic, &product_type );
53  /* Check for VMware presence */
54  if ( magic != VMW_MAGIC ) {
55  DBGC ( VMW_MAGIC, "VMware not present\n" );
56  return -ENOENT;
57  }
59  DBGC ( VMW_MAGIC, "VMware product type %04x version %08x detected\n",
61  return 0;
62 }
#define DBGC(...)
Definition: compiler.h:505
uint32_t magic
Magic signature.
Definition: fdt.h:12
#define ENOENT
No such file or directory.
Definition: errno.h:514
u32 version
Driver version.
Definition: ath9k_hw.c:1983
#define VMW_MAGIC
VMware backdoor magic value.
Definition: vmware.h:18
unsigned int uint32_t
Definition: stdint.h:12
static uint32_t uint32_t * product_type
Definition: vmware.h:38

References DBGC, ENOENT, magic, product_type, version, and VMW_MAGIC.

Variable Documentation

◆ magic

uint32_t* magic

Definition at line 37 of file vmware.h.

◆ product_type

uint32_t uint32_t* product_type
Initial value:
uint32_t discard_d
unsigned int uint32_t
Definition: stdint.h:12

Definition at line 38 of file vmware.h.

Referenced by vmware_present().

◆ subcommand

uint16_t subcommand

Definition at line 61 of file vmware.h.

◆ parameter

Definition at line 61 of file vmware.h.

◆ edxhi

* edxhi = ( edx >> 16 )

Definition at line 61 of file vmware.h.

◆ ebx

Initial value:
uint32_t discard_a
unsigned int uint32_t
Definition: stdint.h:12

Definition at line 62 of file vmware.h.

◆ status

return status

Definition at line 64 of file vmware.h.

◆ edx

uint32_t edx

Definition at line 65 of file vmware.h.