-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvmcall.h
More file actions
84 lines (64 loc) · 1.36 KB
/
vmcall.h
File metadata and controls
84 lines (64 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
vmcall.h
VMware backdoor call header
Copyright (c) 2006 Ken Kato
*/
#ifndef _VMCALL_H_
#define _VMCALL_H_
#include "vmint.h"
/*
data struct for register values
DO NOT change the order of members because it is hard-coded
in the assembly portion of the code
use uint8_t[4] for members instead of uint32_t in order to
avoid dealing with compiler's struct alignment
*/
#ifdef __x86_64__
typedef union {
unsigned long long value;
struct {
unsigned int low;
unsigned int high;
} r32;
} _reg;
#else
typedef union {
unsigned int value;
struct {
unsigned int low;
} r32;
} _reg;
#endif
typedef struct _reg_t {
_reg eax;
_reg ebx;
_reg ecx;
_reg edx;
_reg ebp;
_reg edi;
_reg esi;
} reg_t;
/* member accessing macros */
#define R_EAX(r) r.eax.value
#define R_EBX(r) r.ebx.value
#define R_ECX(r) r.ecx.value
#define R_EDX(r) r.edx.value
#define R_EBP(r) r.ebp.value
#define R_EDI(r) r.edi.value
#define R_ESI(r) r.esi.value
/*
accesses VMware backdoor I/O ports
*/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* access command port with 'in' instruction */
void vmcall_cmd(reg_t *reg);
/* access enhanced rpc data port with 'ins' instruction */
void vmcall_rpc_ins(reg_t *reg);
/* access enhanced rpc data port with 'outs' instruction */
void vmcall_rpc_outs(reg_t *reg);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _VMCALL_H_ */