![]() |
L4Re Operating System Framework
Interface and Usage Documentation
|
Virtual machine API for VMX. More...
Data Structures | |
struct | l4_vmx_offset_table_t |
Software VMCS field offset table. More... | |
struct | l4_vm_vmx_vcpu_vmcs_t |
VMX software VMCS. More... | |
struct | l4_vm_vmx_vcpu_infos_t |
VMX information members. More... | |
struct | l4_vm_vmx_vcpu_state_t |
VMX vCPU state. More... | |
Typedefs | |
typedef struct l4_vmx_offset_table_t | l4_vmx_offset_table_t |
Software VMCS field offset table. | |
typedef struct l4_vm_vmx_vcpu_vmcs_t | l4_vm_vmx_vcpu_vmcs_t |
VMX software VMCS. | |
typedef struct l4_vm_vmx_vcpu_infos_t | l4_vm_vmx_vcpu_infos_t |
VMX information members. | |
typedef struct l4_vm_vmx_vcpu_state_t | l4_vm_vmx_vcpu_state_t |
VMX vCPU state. | |
Functions | |
l4_uint64_t | l4_vm_vmx_get_caps (l4_vm_vmx_vcpu_state_t const *vcpu_state, enum L4_vm_vmx_caps_regs caps_reg) L4_NOTHROW |
Get a capability register for VMX. | |
l4_uint32_t | l4_vm_vmx_get_caps_default1 (l4_vm_vmx_vcpu_state_t const *vcpu_state, enum L4_vm_vmx_dfl1_regs dfl1_reg) L4_NOTHROW |
Get a default to one capability register for VMX. | |
unsigned | l4_vm_vmx_field_len (unsigned field) L4_NOTHROW |
Return length in bytes of a VMCS field. | |
unsigned | l4_vm_vmx_field_order (unsigned field) L4_NOTHROW |
Return length in power of two (bytes) of a VMCS field. | |
void | l4_vm_vmx_clear (l4_vm_vmx_vcpu_vmcs_t *vmcs, l4_vm_vmx_vcpu_vmcs_t *dest_vmcs) L4_NOTHROW |
Save the content from the software VMCS to a different software VMCS. | |
void | l4_vm_vmx_ptr_load (l4_vm_vmx_vcpu_vmcs_t *vmcs, l4_vm_vmx_vcpu_vmcs_t *src_vmcs) L4_NOTHROW |
Load the content from a different software VMCS to the software VMCS. | |
l4_uint32_t | l4_vm_vmx_get_cr2_index (l4_vm_vmx_vcpu_vmcs_t const *vmcs) L4_NOTHROW |
Get the software VMCS field index of the virtual CR2 register. | |
l4_umword_t | l4_vm_vmx_read_nat (l4_vm_vmx_vcpu_vmcs_t *vmcs, unsigned field) L4_NOTHROW |
Read a natural-width software VMCS field. | |
l4_uint16_t | l4_vm_vmx_read_16 (l4_vm_vmx_vcpu_vmcs_t *vmcs, unsigned field) L4_NOTHROW |
Read a 16-bit software VMCS field. | |
l4_uint32_t | l4_vm_vmx_read_32 (l4_vm_vmx_vcpu_vmcs_t *vmcs, unsigned field) L4_NOTHROW |
Read a 32-bit software VMCS field. | |
l4_uint64_t | l4_vm_vmx_read_64 (l4_vm_vmx_vcpu_vmcs_t *vmcs, unsigned field) L4_NOTHROW |
Read a 64-bit software VMCS field. | |
l4_uint64_t | l4_vm_vmx_read (l4_vm_vmx_vcpu_vmcs_t *vmcs, unsigned field) L4_NOTHROW |
Read any software VMCS field. | |
void | l4_vm_vmx_write_nat (l4_vm_vmx_vcpu_vmcs_t *vmcs, unsigned field, l4_umword_t val) L4_NOTHROW |
Write to a natural-width software VMCS field. | |
void | l4_vm_vmx_write_16 (l4_vm_vmx_vcpu_vmcs_t *vmcs, unsigned field, l4_uint16_t val) L4_NOTHROW |
Write to a 16-bit software VMCS field. | |
void | l4_vm_vmx_write_32 (l4_vm_vmx_vcpu_vmcs_t *vmcs, unsigned field, l4_uint32_t val) L4_NOTHROW |
Write to a 32-bit software VMCS field. | |
void | l4_vm_vmx_write_64 (l4_vm_vmx_vcpu_vmcs_t *vmcs, unsigned field, l4_uint64_t val) L4_NOTHROW |
Write to a 64-bit software VMCS field. | |
void | l4_vm_vmx_write (l4_vm_vmx_vcpu_vmcs_t *vmcs, unsigned field, l4_uint64_t val) L4_NOTHROW |
Write to an arbitrary software VMCS field. | |
void | l4_vm_vmx_set_hw_vmcs (l4_vm_vmx_vcpu_vmcs_t *vmcs, l4_cap_idx_t vmcs_cap) L4_NOTHROW |
Associate the software VMCS with a vCPU context, i.e. | |
l4_cap_idx_t | l4_vm_vmx_get_hw_vmcs (l4_vm_vmx_vcpu_vmcs_t *vmcs) L4_NOTHROW |
Get the vCPU context (i.e. | |
Virtual machine API for VMX.
typedef struct l4_vm_vmx_vcpu_state_t l4_vm_vmx_vcpu_state_t |
VMX vCPU state.
This is a specialization of the generic vCPU state for VMX. This data structure represents the following memory layout:
typedef struct l4_vm_vmx_vcpu_vmcs_t l4_vm_vmx_vcpu_vmcs_t |
VMX software VMCS.
This data structure represents the following memory layout:
typedef struct l4_vmx_offset_table_t l4_vmx_offset_table_t |
Software VMCS field offset table.
This data structure represents the following memory layout:
The offsets/limits in each size category are in the following order:
The index shifts are in the following order:
All offsets/limits/sizes are represented in a 64-byte granule.
The offsets (after being multiplied by 64) are indexes in the values array in l4_vm_vmx_vcpu_vmcs_t and bit indexes in the dirty_bitmap array in l4_vm_vmx_vcpu_vmcs_t.
The limits (after being multiplied by 64) represent the range of the available indexes.
enum L4_vm_vmx_caps_regs |
Exported VMX capability registers.
Definition at line 28 of file __vm-vmx.h.
enum L4_vm_vmx_dfl1_regs |
Exported VMX capability registers (default to 1 bits).
Definition at line 51 of file __vm-vmx.h.
enum L4_vm_vmx_sw_fields |
Additional (software-defined) VMCS fields.
The VMCS offsets defined here are actually not in the hardware VMCS. However our VMMs run in user mode and need to have access to certain registers available in kernel mode only. So we put them into our software VMCS.
Enumerator | |
---|---|
L4_VM_VMX_VMCS_CR2 | Software VMCS offset for CR2.
|
L4_VM_VMX_VMCS_NAT_ARG0 | Custom argument passed from kernel to user space. |
L4_VM_VMX_VMCS_NAT_ARG1 | Custom argument passed from kernel to user space. |
L4_VM_VMX_VMCS_NAT_ARG2 | Custom argument passed from kernel to user space. |
L4_VM_VMX_VMCS_NAT_ARG3 | Custom argument passed from kernel to user space. |
L4_VM_VMX_VMCS_XCR0 | VMCS offset of extended control register XCR0. |
L4_VM_VMX_VMCS_MSR_SYSCALL_MASK | VMCS offset of system call flag mask MSR. |
L4_VM_VMX_VMCS_MSR_LSTAR | VMCS offset of IA32e mode system call target address MSR. |
L4_VM_VMX_VMCS_MSR_CSTAR | VMCS offset of IA32 mode system call target address MSR. |
L4_VM_VMX_VMCS_MSR_TSC_AUX | VMCS offset of auxiliary TSC signature MSR. |
L4_VM_VMX_VMCS_MSR_STAR | VMCS offset of system call target address MSR. |
L4_VM_VMX_VMCS_MSR_KERNEL_GS_BASE | VMCS offset of GS base address swap target MSR. |
Definition at line 69 of file __vm-vmx.h.
enum L4_vm_vmx_vmcs_sizes |
Sizes of software VMCS members.
Enumerator | |
---|---|
L4_VM_VMX_VMCS_SIZE_VALUES | Size of the software VMCS values member. |
L4_VM_VMX_VMCS_SIZE_DIRTY_BITMAP | Size of the software VMCS dirty bitmap member. |
Definition at line 170 of file __vm-vmx.h.
|
inline |
Save the content from the software VMCS to a different software VMCS.
vmcs | Pointer to the source software VMCS. |
dest_vmcs | Pointer to the destination software VMCS. |
This function is comparable to the VMX VMCLEAR instruction.
Definition at line 698 of file __vm-vmx.h.
References l4_vm_vmx_get_hw_vmcs(), l4_vm_vmx_set_hw_vmcs(), and L4_VM_VMX_VMCS_SIZE_DIRTY_BITMAP.
Referenced by l4_vm_vmx_ptr_load().
|
inline |
Return length in bytes of a VMCS field.
field | Field number. |
Definition at line 593 of file __vm-vmx.h.
References l4_vm_vmx_field_order().
|
inline |
Return length in power of two (bytes) of a VMCS field.
field | Field number. |
Definition at line 600 of file __vm-vmx.h.
Referenced by l4_vm_vmx_field_len().
|
inline |
Get a capability register for VMX.
vcpu_state | Pointer to the vCPU state. |
caps_reg | Capability register index (see L4_vm_vmx_caps_regs). |
Definition at line 884 of file __vm-vmx.h.
|
inline |
Get a default to one capability register for VMX.
vcpu_state | Pointer to the vCPU state. |
dfl1_reg | Default to 1 capability register index (see L4_vm_vmx_dfl1_regs). |
Definition at line 892 of file __vm-vmx.h.
|
inline |
Get the software VMCS field index of the virtual CR2 register.
vmcs | Pointer to the software VMCS. |
The CR2 register is actually not in the hardware VMCS, however our VMMs run in user mode and need to have access to this register so we put it into our software VMCS.
Definition at line 900 of file __vm-vmx.h.
|
inline |
Get the vCPU context (i.e.
the hardware VMCS object) associated with the software VMCS.
vmcs | Pointer to the software VMCS. |
Definition at line 915 of file __vm-vmx.h.
References L4_CAP_MASK.
Referenced by l4_vm_vmx_clear(), and l4_vm_vmx_ptr_load().
|
inline |
Load the content from a different software VMCS to the software VMCS.
vmcs | Pointer to the destination software VMCS. |
src_vmcs | Pointer to the source software VMCS. |
This function is comparable to the VMX VMPTRLD instruction.
Definition at line 719 of file __vm-vmx.h.
References l4_vm_vmx_clear(), l4_vm_vmx_get_hw_vmcs(), l4_vm_vmx_set_hw_vmcs(), and L4_VM_VMX_VMCS_SIZE_DIRTY_BITMAP.
|
inline |
Read any software VMCS field.
vmcs | Pointer to the software VMCS. |
field | The VMCS field index as used on VMX hardware. |
Definition at line 787 of file __vm-vmx.h.
References l4_vm_vmx_read_16(), l4_vm_vmx_read_32(), l4_vm_vmx_read_64(), and l4_vm_vmx_read_nat().
|
inline |
Read a 16-bit software VMCS field.
vmcs | Pointer to the software VMCS. |
field | The VMCS field index as used on VMX hardware. |
Definition at line 754 of file __vm-vmx.h.
Referenced by l4_vm_vmx_read().
|
inline |
Read a 32-bit software VMCS field.
vmcs | Pointer to the software VMCS. |
field | The VMCS field index as used on VMX hardware. |
Definition at line 765 of file __vm-vmx.h.
Referenced by l4_vm_vmx_read().
|
inline |
Read a 64-bit software VMCS field.
vmcs | Pointer to the software VMCS. |
field | The VMCS field index as used on VMX hardware. |
Definition at line 776 of file __vm-vmx.h.
Referenced by l4_vm_vmx_read().
|
inline |
Read a natural-width software VMCS field.
vmcs | Pointer to the software VMCS. |
field | The VMCS field index as used on VMX hardware. |
Definition at line 743 of file __vm-vmx.h.
Referenced by l4_vm_vmx_read().
|
inline |
Associate the software VMCS with a vCPU context, i.e.
a hardware VMCS object.
The VMX extended vCPU state is unable to be resumed unless it is associated with a vCPU context, i.e. a hardware VMCS object: An L4::Vcpu_context from the user space point of view with its kernel counterpart Vmx_vmcs
.
vmcs | Pointer to the software VMCS. |
vmcs_cap | vCPU context (hardware VMCS object) capability. |
Definition at line 907 of file __vm-vmx.h.
Referenced by l4_vm_vmx_clear(), and l4_vm_vmx_ptr_load().
|
inline |
Write to an arbitrary software VMCS field.
vmcs | Pointer to the software VMCS. |
field | The VMCS field index as used on VMX hardware. |
val | The value that shall be written to the given field. |
Definition at line 868 of file __vm-vmx.h.
References l4_vm_vmx_write_16(), l4_vm_vmx_write_32(), l4_vm_vmx_write_64(), and l4_vm_vmx_write_nat().
|
inline |
Write to a 16-bit software VMCS field.
vmcs | Pointer to the software VMCS. |
field | The VMCS field index as used on VMX hardware. |
val | The value that shall be written to the given field. |
Definition at line 820 of file __vm-vmx.h.
Referenced by l4_vm_vmx_write().
|
inline |
Write to a 32-bit software VMCS field.
vmcs | Pointer to the software VMCS. |
field | The VMCS field index as used on VMX hardware. |
val | The value that shall be written to the given field. |
Definition at line 836 of file __vm-vmx.h.
Referenced by l4_vm_vmx_write().
|
inline |
Write to a 64-bit software VMCS field.
vmcs | Pointer to the software VMCS. |
field | The VMCS field index as used on VMX hardware. |
val | The value that shall be written to the given field. |
Definition at line 852 of file __vm-vmx.h.
Referenced by l4_vm_vmx_write().
|
inline |
Write to a natural-width software VMCS field.
vmcs | Pointer to the software VMCS. |
field | The VMCS field index as used on VMX hardware. |
val | The value that shall be written to the given field. |
Definition at line 804 of file __vm-vmx.h.
Referenced by l4_vm_vmx_write().