25{
30
31
32
33
34
35
36
37
38 union
39 {
40 unsigned char * AsBytePtr;
41 unsigned short * AsWordPtr;
42 unsigned long * AsDwordPtr;
43
44 void * AsPtr;
46
47 } PortValue;
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 if (IoQualification.StringInstruction)
66 {
67
68
69
70
71 PortValue.AsPtr = (PVOID)(IoQualification.DirectionOfAccess ==
AccessIn ? GuestRegs->
rdi : GuestRegs->rsi);
72 }
73 else
74 {
75
76
77
78 PortValue.AsPtr = &GuestRegs->
rax;
79 }
80
81
82
83
84 Port = (
UINT16)IoQualification.PortNumber;
85
86
87
88
89
90
91 Count = IoQualification.RepPrefixed ? (GuestRegs->
rcx & 0xffffffff) : 1;
92
93 Size = (
UINT32)(IoQualification.SizeOfAccess + 1);
94
95 switch (IoQualification.DirectionOfAccess)
96 {
98 if (IoQualification.StringInstruction)
99 {
100 switch (Size)
101 {
102 case 1:
104 break;
105 case 2:
107 break;
108 case 4:
110 break;
111 }
112 }
113 else
114 {
115
116
117
118
119
120 switch (Size)
121 {
122 case 1:
123 *PortValue.AsBytePtr =
IoInByte(Port);
124 break;
125 case 2:
126 *PortValue.AsWordPtr =
IoInWord(Port);
127 break;
128 case 4:
130 break;
131 }
132 }
133 break;
134
136 if (IoQualification.StringInstruction)
137 {
138 switch (Size)
139 {
140 case 1:
142 break;
143 case 2:
145 break;
146 case 4:
148 break;
149 }
150 }
151 else
152 {
153
154
155
156
157
158 switch (Size)
159 {
160 case 1:
162 break;
163 case 2:
165 break;
166 case 4:
168 break;
169 }
170 }
171 break;
172 }
173
174 if (IoQualification.StringInstruction)
175 {
176
177
178
179
180
181
182
184
185 if (Flags.DirectionFlag)
186 {
187 GpReg -= Count * Size;
188 }
189 else
190 {
191 GpReg += Count * Size;
192 }
193
194
195
196
197
198 if (IoQualification.RepPrefixed)
199 {
201 }
202 }
203}
unsigned short UINT16
Definition BasicTypes.h:47
unsigned __int64 UINT64
Definition BasicTypes.h:21
unsigned char UINT8
Definition BasicTypes.h:46
unsigned int UINT32
Definition BasicTypes.h:48
UINT32 IoInDword(UINT16 port)
Definition IoHandler.h:67
void IoOutWord(UINT16 port, UINT16 value)
Definition IoHandler.h:117
void IoInDwordString(UINT16 port, UINT32 *data, UINT32 size)
Definition IoHandler.h:97
@ AccessOut
Definition IoHandler.h:24
@ AccessIn
Definition IoHandler.h:25
void IoOutByteString(UINT16 port, UINT8 *data, UINT32 count)
Definition IoHandler.h:137
UINT16 IoInWord(UINT16 port)
Definition IoHandler.h:57
void IoOutWordString(UINT16 port, UINT16 *data, UINT32 count)
Definition IoHandler.h:147
UINT8 IoInByte(UINT16 port)
Definition IoHandler.h:47
void IoOutByte(UINT16 port, UINT8 value)
Definition IoHandler.h:107
void IoOutDword(UINT16 port, UINT32 value)
Definition IoHandler.h:127
void IoInByteString(UINT16 port, UINT8 *data, UINT32 size)
Definition IoHandler.h:77
void IoInWordString(UINT16 port, UINT16 *data, UINT32 size)
Definition IoHandler.h:87
void IoOutDwordString(UINT16 port, UINT32 *data, UINT32 count)
Definition IoHandler.h:157
GUEST_REGS * Regs
Definition State.h:305
Definition BasicTypes.h:70
UINT64 rdi
Definition BasicTypes.h:82
UINT64 rax
Definition BasicTypes.h:75
UINT64 rcx
Definition BasicTypes.h:76
UINT64 rsi
Definition BasicTypes.h:81