vmx – virtual PC


vmx [ -M mem ] [ -c com1 ] [ -C com2 ] [ -n nic ] [ -d blockfile ] [ -v vga ] [ -m bootmod ] kernel [ args ... ]


Vmx uses Intel VT-x through vmx(3) to simulate a virtual PC, running the specified kernel (see below for supported formats).

By default the virtual PC has 64 MB of memory. The amount of memory can be changed with the -M option, the argument of which is interpreted in bytes unless suffixed by K, M, or G to change the unit to kilobytes, megabytes or gigabytes, respectively.

Args is passed to the kernel as its command line. Boot modules can be specified with the -m argument.

If -v is specified, a graphics device, PS/2 keyboard and mouse are simulated. Clicking on the screen "grabs" the mouse; pressing Ctrl and Alt simultaneously releases the grab. Valid values for the argument are


Simulate a VGA text-mode console.  

widthxheight [ xchan ] [ @addr ]

Simulate a framebuffer at address addr of the specified size and channel format chan (see image(6)). xchan and @addr are optional, in which case they default to x8r8g8b8 and 0xf0000000, respectively (in this mode there is no way to change the resolution and accesses to VGA registers have no effect).  

vesa:modes [ @addr ]

(modes is a comma separated list of modes of the format widthxheightxchan with the chan optional as before.) Simulate a VESA-compatible PCI graphics adapter, initially in text mode. The guest can use VESA functions to switch the mode to one of those listed, which are assigned consecutive mode numbers starting with 0x120. The first mode is indicated as the preferred mode of the monitor.  

The -c and -C options specify the targets for the COM1 and COM2 devices. The argument consists of two fields separated by a comma, which specify the file to be used for input and output, respectively. Either field can be left empty. If there is no comma in the argument, the same value is used for both fields.

A -n option adds a network card. The argument to -n specifies a physical network device (such as ether0) to use. Alternatively, a dial string such as udp!host!port can be used. It can also be prefixed by file! to interpret the argument as a file instead and it can be prefixed by hdr! to enable headers matching the binary snoopy(8) format. The MAC address can be specified with the ea:nnnnnnnnnnnn! prefix, otherwise a random address is used.

A -d option adds a virtio block device (a hard disk) with the argument as a disk image.

Multiboot kernels

If the specified kernel complies with the Multiboot specification, then args is concatenated with spaces and passed as the cmdline; the -m modules are passed as boot modules.

Note that 9front is Multiboot compliant and interprets the first boot module as plan9.ini(8).

OpenBSD kernels

If the specified kernel is an OpenBSD kernel, the boot modules are ignored and the cmdline is interpreted as

[ -asdc ] [ var=value ... ]  

where the options correspond to the boot options and the assignments to the boot variables, which are defined in the OpenBSD manpage boot(8).

Linux kernels

If the specified kernel is a Linux kernel (which must be 2.6.22 or newer and in bzImage format), args are concatenated with spaces and passed as the cmdline (see Documentation/admin-guide/kernel-parameters.txt). The first boot module is passed as the initrd; any further boot modules are ignored.




vmx(3), cpuid(8)


Vmx can and will crash your kernel.

Currently only one core is supported.

The Linux vga= option is not supported, as well as many of the OpenBSD boot variables.


Vmx first appeared in 9front (June, 2017).