vmx – x86 virtualization interface|
The vmx device supports "virtual CPUs" using the Intel VT–x extension
(a.k.a. VMX instruction set). This is used by vmx(3) to implement
virtual machines. Access to the vmx device is restricted to the
The top level directory contains a clone file and numbered subdirectories
representing the allocated virtual CPUs. Opening the clone file
allocates a new virtual CPU and returns the file descriptor to
its ctl file. The ctl file provides the main control interface.
See below for a list of commands. Reading returns the
subdirectory number. Removing the ctl file marks the virtual CPU
as moribund. The status file contains the current status of the
virtual CPU, which is one of
The map file contains the memory map that the virtual CPU will
see. It consists of lines of the form
Writes to the map file append lines to the end. Multiple lines can be written at once but all lines written must be newline terminated. Regions can be overlapping, in which case later definitions always override earlier ones. The map can be cleared by opening the file with OTRUNC (see open (2)).
The regs file contains the registers of the virtual CPU in the
format name value. Writes to the file (in the same format) write
to the referenced registers (if possible). Multiple lines can
be written at once but all lines written must be newline terminated.
Some registers (CR0 and CR4) are split into three registers, suffixed
real, fake and mask. In this case, real corresponds to the bits
that affect actual CPU execution, fake corresponds to the bits
read back by the guest and the bits set in mask are those "owned"
by the host. The guest is free to modify the bits
that it owns (in which case it always has the same value in both
real and fake), but attempting to change a host–owned bit from
the status in fake causes a VM exit. Certain bits are owned by
the kernel, which means they are fixed in both mask and real.
Reading the wait file will stall the reading process until the
virtual CPU reaches a point where it cannot continue (a "VM exit").
This may be due to the an access to hardware or a software exception.
Each exit is indicated by a single line in a format compatible
with tokenize (see getfields(2)). The first column contains
the cause of the exit and the second column contains the "exit
qualification" field that may contain more details on the exit
(see Intel SDM). The remaining columns come in pairs and contain
further info and the values of relevant registers.
Some notable exit causes are (see kernel source code for a complete
The fpregs file contains the virtual CPU's floating point registers,
in the same binary format used by proc(3).
Intel 64 and IA–32 Architectures Software Developer's Manual, Volume 3B, Chapters 23–33.
Devvmx can and will crash your kernel.|
Devvmx first appeared in 9front (June, 2017).|