iPXE
vmware.h File Reference

VMware backdoor mechanism. More...

#include <stdint.h>

Go to the source code of this file.

Macros

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

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static __attribute__ ((always_inline)) void vmware_cmd_get_version(uint32_t *version
 Get VMware version.
__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.

Variables

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

◆ VMW_PORT

#define VMW_PORT   0x5658

VMware backdoor I/O port.

Definition at line 15 of file vmware.h.

Referenced by __volatile__().

◆ VMW_MAGIC

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

VMware backdoor magic value.

Definition at line 18 of file vmware.h.

Referenced by __volatile__(), and vmware_present().

◆ VMW_BACKDOOR

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

VMware backdoor magic instruction.

Definition at line 21 of file vmware.h.

Referenced by __volatile__().

◆ VMW_CMD_GET_VERSION

#define VMW_CMD_GET_VERSION   0x0a

Get VMware version.

Definition at line 24 of file vmware.h.

Referenced by __volatile__().

◆ VMW_CMD_GUESTRPC

#define VMW_CMD_GUESTRPC   0x1e

Issue GuestRPC command.

Definition at line 27 of file vmware.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ __attribute__()

__attribute__ ( (always_inline) )
inlinestatic

Get VMware version.

Issue GuestRPC command.

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

◆ __volatile__()

◆ vmware_present()

int vmware_present ( void )
extern

Detect VMware presence.

Return values
rcReturn status code

Definition at line 45 of file vmware.c.

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

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

Definition at line 38 of file vmware.h.

Referenced by __volatile__(), and vmware_present().

◆ subcommand

uint16_t subcommand

Definition at line 61 of file vmware.h.

◆ parameter

uint16_t uint32_t parameter

Definition at line 61 of file vmware.h.

◆ edxhi

* edxhi = ( edx >> 16 )

Definition at line 62 of file vmware.h.

◆ ebx

Initial value:
{
uint32_t discard_a

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.