Skip to content
Zero Tang edited this page Oct 11, 2021 · 1 revision

Welcome to the NoirCvmApi wiki!

This API set is available starting in the Third-Anniversary Update of NoirVisor.

The following sections contain the definitions of the NoirVisor Customizable VM APIs that are exposed to users.
Currently, NoirCvmApi supports the Windows Operating System. For Windows, APIs are exported via NoirCvmApi.dll module.

Virtual Machine Management

The following management APIs can help managing virtual machine creations and deletions.

Function Name Details
NoirCreateVirtualMachine This function creates a virtual machine in the system.
NoirDeleteVirtualMachine This function deletes a virtual machine in the system.

VM Memory Management

User hypervisors can map GPA of the guest, acronym that stands for Guest Physical Address, to HVA, acronym that stands for Host Virtual Address.

Function Name Details
NoirSetAddressMapping This function can map, unmap a number of pages, or set the attributes of them, from GPA to HVA.

Virtual Processor Management

NoirVisor features a scheduler relying on the control-flow scheduler of the OS.

Function Name Details
NoirCreateVirtualProcessor This function creates a virtual processor in a virtual machine.
NoirDeleteVirtualProcessor This function deletes a virtual processor in a virtual machine.
NoirRunVirtualProcessor This function schedules a virtual processor's control-flow to the physical core. This function is synchronous (i.e. blocks the host's control-flow) and returns when the virtual processor encounters certain events.

Exit Context

When the control-flow of the virtual processor encounters certain events, NoirVisor's scheduler would schedule the host's control-flow to the physical core. This shift of control-flow is defined as a VM-Exit. The host is liable to provide a buffer to store the reason and detail of VM-Exit and to process them.

Structure Details
Exit Context This structure contains the intercept code (i.e. the reason of VM-Exit) and other details of the VM-Exit. Some common traits of different VM-Exits are also included.
Memory Access This structure contains information that records the physical memory access violation (e.g. either the physical memory is not mapped, or the access is prohibited) induced by the guest virtual processors.
I/O Instruction This structure contains information of the I/O instruction (in, out, ins, and outs instruction) that causes VM-Exit.
CPUID Instruction This structure contains information of the cpuid instruction that causes VM-Exit.
MSR Access This structure contains information of the rdmsr instruction and wrmsr instruction that causes VM-Exit.
Control-Register Access This structure contains information of instruction (mov-from/to-CRn instruction) that causes VM-Exit.
Debug-Register Access This structure contains information of instruction (mov-from/to-DRn instruction) that causes VM-Exit.
Exception This structure contains information of exception that causes VM-Exit.

Virtual Processor Registers

In addition to virtualization of processors, registers are usually subject to be viewed and edited. The following functions provides ability to view and to edit these registers.

Function Details
NoirViewVirtualProcessorRegisters This function reads a defined set of registers of a specified virtual processor in the virtual machine.
NoirEditVirtualProcessorRegisters This function writes a defined set of registers of a specified virtual processor in the virtual machine.

Support Functions

The Support Functions are not provided by the NoirVisor. Nonetheless, they are useful to run virtual machines.

Function Details
PageAlloc This function allocates virtual memory on page-alignment.
PageFree This function releases virtual memory allocated by PageAlloc function.
LockPage This function locks the virtual memory pages into physical memory so they won't be swapped out by the OS memory manager.
UnlockPage This function unlocks the virtual memory pages so the OS memory manager can swap the memory out when physical memory resources are low.

Related Links

This library is a sub-project of Project NoirVisor.