diff --git a/course/02-KVM.md b/course/02-KVM.md index aa8549e8559bf06e3c83b4c6ead0cd12ab9bc76c..df6a0361baef257731df83034c9eb18056d6c2d7 100644 --- a/course/02-KVM.md +++ b/course/02-KVM.md @@ -856,16 +856,6 @@ if (!run->mmio.is_write) { // See struct kvm_run [//]: # ---------------------------------------------------------------- # Device emulation -[//]: # ---------------------------------------------------------------- -## Reminder: MMIO registers - -When the VM is created: - -- The VMM constructs the VM address space by: - - mapping the RAM into the VM address space - - if the VM exposes some device programmed through MMIO registers, it must ensure there is no memory mapping (RAM) where device registers are located: - - ensure `VMexits` (`KVM_EXIT_MMIO`) will be triggered when OS driver code read/write to these addresses (registers) - [//]: # ---------------------------------------------------------------- ## Reminder: VMexits @@ -914,8 +904,8 @@ outb(0x3C5, 0x0F); \footnotesize - The code above would typically be part of the VGA driver in the guest OS - How can the VMM emulate the behavior of a real PC running this code? - - \footnotesize by analyzing the code ran by the guest OS - - if the VMM detects the exact code above, it then emulates the behavior on the host + - \footnotesize by analyzing the sequence of VMExits triggered by the guest OS + - if the VMM detects the exact sequence of I/O registers reads/writes above, it then emulates the behavior on the host - for instance by opening a 400x300 pixels window in which pixels will be rendered [//]: # ---------------------------------------------------------------- @@ -947,10 +937,10 @@ outb(0x3C5, 0x0F); [//]: # ---------------------------------------------------------------- ## Generic state machine representation (1/2) -Represent each state by a structure that defines: +**\textcolor{myblue}{Idea}**: to represent each state by a structure that defines: - the operation to perform -- the written/read address +- the address written to/read from - the expected written value or value to inject - the size of the operation (8, 16, or 32 bits) - possibly a custom user function that would be executed at the beginning or end of the state