@@ -637,7 +637,10 @@ as to what fault occurred.
637637The ` reply_msginfo ` argument is given by libmicrokit and can be used to reply to the fault.
638638
639639The returned ` seL4_Bool ` is whether or not to reply to the fault with the message ` reply_msginfo ` .
640- Returning ` seL4_True ` will reply to the fault. Returning ` seL4_False ` will not reply to the fault.
640+ Returning ` seL4_True ` will reply to the fault and resume the child PD or vCPU at the fault restart program counter.
641+ For more details, please see the "Faults" section of the [ seL4 Manual] ( https://sel4.systems/Info/Docs/seL4-manual-latest.pdf ) .
642+
643+ Returning ` seL4_False ` will not reply to the fault and causes the child PD or vCPU to no longer run.
641644
642645You can use ` microkit_msginfo_get_label ` on ` msginfo ` to deduce what kind of fault happened
643646(for example, whether it was a user exception or a virtual memory fault).
@@ -649,6 +652,43 @@ To find the full list of possible faults that could occur and details regarding
649652kind of fault, please see the 'Faults' section of the
650653[ seL4 reference manual] ( https://sel4.systems/Info/Docs/seL4-manual-latest.pdf ) .
651654
655+ ### x86 VCPU fault
656+ Please see the 'VMX BASIC EXIT REASONS' section of the
657+ [ Intel® 64 and IA-32 Architectures Software Developer’s Manual Combined Volumes: 1, 2A, 2B, 2C, 2D, 3A, 3B, 3C, 3D, and 4]
658+ (https://cdrdv2.intel.com/v1/dl/getContent/671200 ) for a list of possible VM Exit reasons.
659+
660+ These message registers contain data relating to the VM Exit:
661+ - ` SEL4_VMENTER_CALL_EIP_MR ` : Instruction Pointer,
662+ - ` SEL4_VMENTER_CALL_CONTROL_PPC_MR ` : Primary Processor Based VM Execution Controls,
663+ - ` SEL4_VMENTER_CALL_INTERRUPT_INFO_MR ` : VM Entry Interruption-Information,
664+ - ` SEL4_VMENTER_FAULT_REASON_MR ` : VM Exit reason,
665+ - ` SEL4_VMENTER_FAULT_QUALIFICATION_MR ` : VM Exit qualification,
666+ - ` SEL4_VMENTER_FAULT_INSTRUCTION_LEN_MR ` : Length of instruction that caused the VM Exit,
667+ - ` SEL4_VMENTER_FAULT_GUEST_PHYSICAL_MR ` : Guest Physical Address of the VM Exit,
668+ - ` SEL4_VMENTER_FAULT_RFLAGS_MR ` : Guest FLAGS register,
669+ - ` SEL4_VMENTER_FAULT_GUEST_INT_MR ` : Guest interruptability,
670+ - ` SEL4_VMENTER_FAULT_CR3_MR ` : Guest CR3.
671+
672+ Some of these message registers may not contain valid data depending on the VM Exit reason,
673+ please consult the Intel SDM for more details.
674+
675+ These message registers contain the guest general purpose registers at the time of VM Exit:
676+ - ` SEL4_VMENTER_FAULT_EAX `
677+ - ` SEL4_VMENTER_FAULT_EBX `
678+ - ` SEL4_VMENTER_FAULT_ECX `
679+ - ` SEL4_VMENTER_FAULT_EDX `
680+ - ` SEL4_VMENTER_FAULT_ESI `
681+ - ` SEL4_VMENTER_FAULT_EDI `
682+ - ` SEL4_VMENTER_FAULT_EBP `
683+ - ` SEL4_VMENTER_FAULT_R8 `
684+ - ` SEL4_VMENTER_FAULT_R9 `
685+ - ` SEL4_VMENTER_FAULT_R10 `
686+ - ` SEL4_VMENTER_FAULT_R11 `
687+ - ` SEL4_VMENTER_FAULT_R12 `
688+ - ` SEL4_VMENTER_FAULT_R13 `
689+ - ` SEL4_VMENTER_FAULT_R14 `
690+ - ` SEL4_VMENTER_FAULT_R15 `
691+
652692## ` microkit_msginfo microkit_ppcall(microkit_channel ch, microkit_msginfo msginfo) `
653693
654694Performs a call to a protected procedure in a different PD.
@@ -826,6 +866,22 @@ virtual CPU with ID `vcpu`.
826866Write the registers of a given virtual CPU with ID ` vcpu ` . The ` regs ` argument is the pointer to
827867the struct of registers ` seL4_VCPUContext ` that are written from.
828868
869+ ## ` void microkit_vcpu_x86_on(void) `
870+
871+ Start running the vCPU bound to this PD.
872+
873+ The vCPU runs after every return from a Microkit entrypoint; it does not run concurrently with the native thread.
874+
875+ The kernel performs minimal setup of the vCPU's architectural state, configuring only the hardware-mandated
876+ fixed bits and setting VMCS fields required to safely context-switch between VMX root and non-root operations.
877+ The caller is responsible for initialising all other architectural state such as the instruction pointer using
878+ ` microkit_vcpu_x86_write_vmcs() ` , in accordance with the
879+ [ Intel SDM] ( https://cdrdv2.intel.com/v1/dl/getContent/671200 ) .
880+
881+ ## ` void microkit_vcpu_x86_off(void) `
882+
883+ Stop the PD from switching to guest execution mode when a Microkit entrypoint returns.
884+
829885## ` seL4_CPtr microkit_cspace_root_slot_to_cptr(seL4_Word slot) ` {#libmicrokit_cspace_root_slot_to_cptr}
830886
831887Converts the slot identifier of the ` <cspace> ` 's capability element into an
@@ -938,6 +994,8 @@ The `protection_domain` element has the same attributes as any other protection
938994* ` id ` : The ID of the child for the parent to refer to.
939995* ` setvar_id ` : (optional) Specifies a symbol in the parent program image. This symbol will be rewritten with the ID of the child.
940996
997+ On x86-64, a PD with a VCPU cannot have child PDs.
998+
941999The ` virtual_machine ` element has the following attributes:
9421000
9431001* ` name ` : A unique name for the virtual machine
@@ -948,6 +1006,7 @@ The `virtual_machine` element has the following attributes:
9481006Additionally, it supports the following child elements:
9491007
9501008* ` vcpu ` : (one or more) Describes the virtual CPU that will be tied to the virtual machine.
1009+ * On x86-64, there is a limit of one VCPU per PD.
9511010* ` map ` : (zero or more) Describes mapping of memory regions into the virtual machine.
9521011
9531012The ` vcpu ` element has the following attributes:
@@ -1027,6 +1086,7 @@ The `end` element has the following attributes:
10271086* ` id ` : Channel identifier in the context of the named protection domain. Must be at least 0 and less than 63.
10281087* ` pp ` : (optional) Indicates that the protection domain for this end can perform a protected procedure call to the other end; defaults to false.
10291088 Protected procedure calls can only be to PDs of strictly higher priority.
1089+ On x86-64, PDs with virtual machines cannot receive protected procedure calls.
10301090* ` notify ` : (optional) Indicates that the protection domain for this end can send a notification to the other end; defaults to true.
10311091* ` setvar_id ` : (optional) Specifies a symbol in the program image. This symbol will be rewritten with the channel identifier.
10321092
0 commit comments