Cross platform APIs for intrinsic functions (VMX instructions).
More...
Go to the source code of this file.
|
| VOID | VmxVmptrst (UINT64 *VmcsPhysicalAddress) |
| | VMX VMPTRST instruction.
|
| UCHAR | VmxVmptrld (UINT64 *VmcsPhysicalAddress) |
| | VMX VMPTRLD instruction.
|
| UCHAR | VmxVmclear (UINT64 *VmcsPhysicalAddress) |
| | VMX VMCLEAR instruction.
|
| UCHAR | VmxVmxon (UINT64 *VmxonRegionPhysicalAddress) |
| | VMX VMXON instruction.
|
| VOID | VmxVmlaunch (VOID) |
| | VMX VMLAUNCH instruction.
|
| VOID | VmxVmresume (VOID) |
| | VMX VMRESUME instruction.
|
| VOID | VmxVmxoff (VOID) |
| | VMX VMXOFF instruction.
|
| UCHAR | VmxVmread64 (size_t Field, UINT64 FieldValue) |
| | VMX VMREAD instruction (64-bit).
|
| UCHAR | VmxVmread32 (size_t Field, UINT32 FieldValue) |
| | VMX VMREAD instruction (32-bit).
|
| UCHAR | VmxVmread16 (size_t Field, UINT16 FieldValue) |
| | VMX VMREAD instruction (16-bit).
|
| UCHAR | VmxVmread64P (size_t Field, UINT64 *FieldValue) |
| | VMX VMREAD instruction (64-bit, pointer variant).
|
| UCHAR | VmxVmread32P (size_t Field, UINT32 *FieldValue) |
| | VMX VMREAD instruction (32-bit, pointer variant).
|
| UCHAR | VmxVmread16P (size_t Field, UINT16 *FieldValue) |
| | VMX VMREAD instruction (16-bit, pointer variant).
|
| UCHAR | VmxVmwrite64 (size_t Field, UINT64 FieldValue) |
| | VMX VMWRITE instruction (64-bit).
|
| UCHAR | VmxVmwrite32 (size_t Field, UINT32 FieldValue) |
| | VMX VMWRITE instruction (32-bit).
|
| UCHAR | VmxVmwrite16 (size_t Field, UINT16 FieldValue) |
| | VMX VMWRITE instruction (16-bit).
|
Cross platform APIs for intrinsic functions (VMX instructions).
- Author
- Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
- Version
- 0.19
- Date
- 2026-04-27
- Copyright
- This project is released under the GNU Public License v3.
◆ VmxVmclear()
| UCHAR VmxVmclear |
( |
UINT64 * | VmcsPhysicalAddress | ) |
|
|
externinline |
VMX VMCLEAR instruction.
- Parameters
-
- Returns
- UCHAR
429{
430#if defined(_WIN32) || defined(_WIN64)
431 return __vmx_vmclear(VmcsPhysicalAddress);
432#elif defined(__linux__)
433 return __linux_vmx_vmclear(VmcsPhysicalAddress);
434#else
435# error "Unsupported platform"
436#endif
437}
◆ VmxVmlaunch()
| VOID VmxVmlaunch |
( |
VOID | | ) |
|
|
externinline |
VMX VMLAUNCH instruction.
- Returns
- VOID
391{
392#if defined(_WIN32) || defined(_WIN64)
393 __vmx_vmlaunch();
394#elif defined(__linux__)
395 __asm__ __volatile__("vmlaunch" ::: "cc", "memory");
396#else
397# error "Unsupported platform"
398#endif
399}
◆ VmxVmptrld()
| UCHAR VmxVmptrld |
( |
UINT64 * | VmcsPhysicalAddress | ) |
|
|
externinline |
VMX VMPTRLD instruction.
- Parameters
-
- Returns
- UCHAR
410{
411#if defined(_WIN32) || defined(_WIN64)
412 return __vmx_vmptrld(VmcsPhysicalAddress);
413#elif defined(__linux__)
414 return __linux_vmx_vmptrld(VmcsPhysicalAddress);
415#else
416# error "Unsupported platform"
417#endif
418}
◆ VmxVmptrst()
| VOID VmxVmptrst |
( |
UINT64 * | VmcsPhysicalAddress | ) |
|
|
externinline |
VMX VMPTRST instruction.
- Parameters
-
- Returns
- VOID
340{
341#if defined(_WIN32) || defined(_WIN64)
342 __vmx_vmptrst(VmcsPhysicalAddress);
343#elif defined(__linux__)
344 __linux_vmx_vmptrst(VmcsPhysicalAddress);
345#else
346# error "Unsupported platform"
347#endif
348}
◆ VmxVmread16()
VMX VMREAD instruction (16-bit).
- Parameters
-
- Returns
- UCHAR
186{
187 UINT64 TargetField = 0ull;
188 TargetField = FieldValue;
189
190#if defined(_WIN32) || defined(_WIN64)
191 return __vmx_vmread((size_t)Field, (size_t *)TargetField);
192#elif defined(__linux__)
193 return __linux_vmx_vmread((size_t)Field, (size_t *)TargetField);
194#else
195# error "Unsupported platform"
196#endif
197}
◆ VmxVmread16P()
| UCHAR VmxVmread16P |
( |
size_t | Field, |
|
|
UINT16 * | FieldValue ) |
|
externinline |
VMX VMREAD instruction (16-bit, pointer variant).
- Parameters
-
- Returns
- UCHAR
252{
253 UINT64 TargetField = 0ull;
254 TargetField = (UINT64)FieldValue;
255
256#if defined(_WIN32) || defined(_WIN64)
257 return __vmx_vmread((size_t)Field, (size_t *)TargetField);
258#elif defined(__linux__)
259 return __linux_vmx_vmread((size_t)Field, (size_t *)TargetField);
260#else
261# error "Unsupported platform"
262#endif
263}
◆ VmxVmread32()
VMX VMREAD instruction (32-bit).
- Parameters
-
- Returns
- UCHAR
163{
164 UINT64 TargetField = 0ull;
165 TargetField = FieldValue;
166
167#if defined(_WIN32) || defined(_WIN64)
168 return __vmx_vmread((size_t)Field, (size_t *)TargetField);
169#elif defined(__linux__)
170 return __linux_vmx_vmread((size_t)Field, (size_t *)TargetField);
171#else
172# error "Unsupported platform"
173#endif
174}
◆ VmxVmread32P()
| UCHAR VmxVmread32P |
( |
size_t | Field, |
|
|
UINT32 * | FieldValue ) |
|
externinline |
VMX VMREAD instruction (32-bit, pointer variant).
- Parameters
-
- Returns
- UCHAR
229{
230 UINT64 TargetField = 0ull;
231 TargetField = (UINT64)FieldValue;
232
233#if defined(_WIN32) || defined(_WIN64)
234 return __vmx_vmread((size_t)Field, (size_t *)TargetField);
235#elif defined(__linux__)
236 return __linux_vmx_vmread((size_t)Field, (size_t *)TargetField);
237#else
238# error "Unsupported platform"
239#endif
240}
◆ VmxVmread64()
| UCHAR VmxVmread64 |
( |
size_t | Field, |
|
|
UINT64 | FieldValue ) |
|
externinline |
VMX VMREAD instruction (64-bit).
- Parameters
-
- Returns
- UCHAR
143{
144#if defined(_WIN32) || defined(_WIN64)
145 return __vmx_vmread((size_t)Field, (size_t *)FieldValue);
146#elif defined(__linux__)
147 return __linux_vmx_vmread((size_t)Field, (size_t *)FieldValue);
148#else
149# error "Unsupported platform"
150#endif
151}
◆ VmxVmread64P()
| UCHAR VmxVmread64P |
( |
size_t | Field, |
|
|
UINT64 * | FieldValue ) |
|
externinline |
VMX VMREAD instruction (64-bit, pointer variant).
- Parameters
-
- Returns
- UCHAR
209{
210#if defined(_WIN32) || defined(_WIN64)
211 return __vmx_vmread((size_t)Field, (size_t *)FieldValue);
212#elif defined(__linux__)
213 return __linux_vmx_vmread((size_t)Field, (size_t *)FieldValue);
214#else
215# error "Unsupported platform"
216#endif
217}
◆ VmxVmresume()
| VOID VmxVmresume |
( |
VOID | | ) |
|
|
externinline |
VMX VMRESUME instruction.
- Returns
- VOID
357{
358#if defined(_WIN32) || defined(_WIN64)
359 __vmx_vmresume();
360#elif defined(__linux__)
361 __asm__ __volatile__("vmresume" ::: "cc", "memory");
362#else
363# error "Unsupported platform"
364#endif
365}
◆ VmxVmwrite16()
VMX VMWRITE instruction (16-bit).
- Parameters
-
- Returns
- UCHAR
318{
320 TargetValue = (UINT64)FieldValue;
321
322#if defined(_WIN32) || defined(_WIN64)
323 return __vmx_vmwrite((size_t)Field, (size_t)TargetValue);
324#elif defined(__linux__)
325 return __linux_vmx_vmwrite((size_t)Field, (size_t)TargetValue);
326#else
327# error "Unsupported platform"
328#endif
329}
◆ VmxVmwrite32()
VMX VMWRITE instruction (32-bit).
- Parameters
-
- Returns
- UCHAR
295{
297 TargetValue = (UINT64)FieldValue;
298
299#if defined(_WIN32) || defined(_WIN64)
300 return __vmx_vmwrite((size_t)Field, (size_t)TargetValue);
301#elif defined(__linux__)
302 return __linux_vmx_vmwrite((size_t)Field, (size_t)TargetValue);
303#else
304# error "Unsupported platform"
305#endif
306}
◆ VmxVmwrite64()
| UCHAR VmxVmwrite64 |
( |
size_t | Field, |
|
|
UINT64 | FieldValue ) |
|
externinline |
VMX VMWRITE instruction (64-bit).
- Parameters
-
- Returns
- UCHAR
275{
276#if defined(_WIN32) || defined(_WIN64)
277 return __vmx_vmwrite((size_t)Field, (size_t)FieldValue);
278#elif defined(__linux__)
279 return __linux_vmx_vmwrite((size_t)Field, (size_t)FieldValue);
280#else
281# error "Unsupported platform"
282#endif
283}
◆ VmxVmxoff()
VMX VMXOFF instruction.
- Returns
- VOID
374{
375#if defined(_WIN32) || defined(_WIN64)
376 __vmx_off();
377#elif defined(__linux__)
378 __asm__ __volatile__("vmxoff" ::: "cc", "memory");
379#else
380# error "Unsupported platform"
381#endif
382}
◆ VmxVmxon()
| UCHAR VmxVmxon |
( |
UINT64 * | VmxonRegionPhysicalAddress | ) |
|
|
externinline |
VMX VMXON instruction.
- Parameters
-
| VmxonRegionPhysicalAddress | |
- Returns
- UCHAR
448{
449#if defined(_WIN32) || defined(_WIN64)
450 return __vmx_on(VmxonRegionPhysicalAddress);
451#elif defined(__linux__)
452 return __linux_vmx_vmxon(VmxonRegionPhysicalAddress);
453#else
454# error "Unsupported platform"
455#endif
456}