README.txt
1Two additional components are shipped with NVMM as demonstrators, toyvirt and
2smallkern: the former is a toy virtualizer, that executes in a VM the 64bit ELF
3binary given as argument, the latter is an example of such binary.
4
5The goal of toyvirt and smallkern is to demonstrate the libnvmm API.
6
7Originally obtained from: https://www.netbsd.org/~maxv/nvmm/nvmm-demo.zip
8
9Folders:
10
11 toyvirt/
12 A toy virtualizer.
13
14 smallkern/
15 A small kernel, that can be booted by toyvirt.
16
17Use:
18
19 $ make
20 # /tmp/toyvirt /tmp/smallkern
21
22Expected output:
23
24 [+] NVMM initialization succeeded
25 [+] Machine creation succeeded
26 [+] VCPU creation succeeded
27 [+] VCPU callbacks configuration succeeded
28 [+] State set
29 mach> _________ __ __ __
30 mach> / _____/ _____ _____ | | | | | | __ ___________ ____
31 mach> \_____ \ / \\__ \ | | | | | |/ // __ \_ __ \/ \
32 mach> / \ Y Y \/ __ \| |_| |_| <\ ___/| | \/ | \
33 mach> /_______ /__|_| (____ /____/____/__|_ \\___ >__| |___| /
34 mach> \/ \/ \/ \/ \/ \/
35 mach> [+] TSS created
36 mach> [+] IDT created
37 mach> [+] APICBASE is correct
38 mach> [+] PG_NX is disabled
39 mach> [+] Running on cpu120
40 mach> [+] LAPIC information matches
41 mach>
42 mach> ****** FAULT OCCURRED ******
43 mach> privileged instruction fault
44 mach> ****************************
45 mach>
46 [+] Inject #GP event
47 mach>
48 mach> ****** FAULT OCCURRED ******
49 mach> protection fault
50 mach> ****************************
51 mach>
52 [+] Inject #NMI event
53 mach>
54 mach> ****** FAULT OCCURRED ******
55 mach> non-maskable interrupt
56 mach> ****************************
57 mach>
58 [+] Inject hardware interrupt event
59 mach>
60 mach> ****** FAULT OCCURRED ******
61 mach> hardware interrupt
62 mach> ****************************
63 mach>
64 [+] Inject #GP event
65 mach>
66 mach> ****** FAULT OCCURRED ******
67 mach> protection fault
68 mach> ****************************
69 mach>
70 [+] Inject #NMI event
71 [+] Inject #GP event
72 mach>
73 mach> ****** FAULT OCCURRED ******
74 mach> protection fault
75 mach> ****************************
76 mach>
77 [+] Inject #NMI event
78 [+] Inject #GP event
79 [+] Machine received shutdown
80 [+] Machine execution successful
81 [+] Machine destroyed
82
83The VM executes 'vmmcall', which causes a privileged instruction fault.
84
85Toyvirt injects in the VM, at regular intervals, a protection fault (#GP),
86followed by a non-maskable interrupt (#NMI), followed by an external
87hardware interrupt.
88
89The first NMI blocks further NMIs until 'iret' is executed by the VM.
90Given that the VM never executes this instruction, all the secondary NMIs
91are blocked. That's why the NMI message gets displayed only once.
92
93The protection faults, however, are not subject to blocking, and are
94received all the time.
95
96After receiving the first external hardware interrupt, the VM disables
97these interrupts by setting CR8 to 15. From then on, no hardware interrupt
98is received.
99
100The VM accepts up to six faults. Beyond that, it shuts down.
101
102All the while, the VM performs a few FPU operations, and verifies their
103correctness.
104