guest_vm.hThe guest vm interface is central to libsel4vm, providing definitions of the guest vm datastructure and primitives to run the VM instance and start its vcpus.
Functions:
vm_register_unhandled_mem_fault_callback(vm, fault_handler, cookie)
vm_register_notification_callback(vm, notification_callback, cookie)
Structs:
The interface guest_vm.h defines the following functions.
vm_run(vm_t *vm)Enter the VM event runtime loop. This funtion is a blocking call, returning on the event of an unhandled VM exit or error
Parameters:
vm {vm_t *}: A handle to the VM to runReturns:
Back to interface description.
vcpu_start(vcpu)Start an initialised vcpu thread
Parameters:
vcpu {vm_vcpu_t *}: A handle to vcpu to startReturns:
Back to interface description.
vm_register_unhandled_mem_fault_callback(vm, fault_handler, cookie)Register a callback for processing unhandled memory faults (memory regions not previously registered or reserved)
Parameters:
vm {vm_t *}: A handle to the VMfault_handler {unhandled_mem_fault_callback_fn}: A user supplied callback to process unhandled memory faultscookie {void *}: A cookie to supply to the memory fault handlerReturns:
Back to interface description.
vm_register_notification_callback(vm, notification_callback, cookie)Register a callback for processing unhandled notifications (events unknown to libsel4vm)
Parameters:
vm {vm_t *}: A handle to the VMnotification_callback {notification_callback_fn}: A user supplied callback to process unhandled notificationscookie {void *}: A cookie to supply to the callbackReturns:
Back to interface description.
The interface guest_vm.h defines the following structs.
vm_ram_regionStructure representing individual RAM region. A VM can have multiple regions to represent its total RAM
Elements:
start {uintptr_t}: Guest physical start address of regionsize {size_t}: Size of region in bytesallocated {int}: Whether or not this region has been ‘allocated’Back to interface description.
vm_memStructure representing VM memory managment
Elements:
vm_vspace {vspace_t}: Guest VM's vspacevm_vspace_root {vka_object_t}: VKA allocated guest VM root vspacevmm_vspace {vspace_t}: Hosts/VMMs vspacenum_ram_regions {int}: Total number of registered vm_ram_regionsSet {struct vm_ram_region *}: of registered vm_ram_regionsInitialised {vm_memory_reservation_cookie_t *}: instance of vm memory interfaceunhandled_mem_fault_handler {unhandled_mem_fault_callback_fn}: Registered callback for unhandled memory faultsunhandled_mem_fault_cookie {void *}: User data passed onto unhandled mem fault callbackBack to interface description.
vm_tcbStructure used for TCB management within a VCPU
Elements:
tcb {vka_object_t}: VKA allocated TCB objectsc {vka_object_t}: VKA allocated scheduling contextpriority {int}: VCPU scheduling priorityBack to interface description.
vm_vcpuStructure used to represent a VCPU
Elements:
vm {struct vm *}: Parent VMvcpu {vka_object_t}: VKA allocated vcpu objecttcb {struct vm_tcb}: VCPUs TCB management structurevcpu_id {unsigned int}: VCPU Identifiertarget_cpu {int}: The target core the vcpu is assigned tovcpu_online {bool}: Flag representing if the vcpu has been startedvcpu_arch {struct vm_vcpu_arch}: Architecture specific vcpu propertiesBack to interface description.
vm_runVM Runtime management structure
Elements:
exit_reason {int}: Records last vm exit reasonnotification_callback {notification_callback_fn}: Callback for processing unhandled notificationsnotification_callback_cookie {void *}: A cookie to supply to the notification callbackBack to interface description.
vm_cspaceVM cspace management structure
Elements:
cspace_obj {vka_object_t}: VKA allocated cspace objectcspace_root_data {seL4_Word}: cspace root data capabilityBack to interface description.
vmStructure representing a VM instance
Elements:
arch {struct vm_arch}: Architecture specfic vm structurenum_vcpus {unsigned int}: Number of vcpus created for the VMvcpus {struct vm_vcpu*}: vcpu's belonging to the VMmem {struct vm_mem}: Memory management structurerun {struct vm_run}: VM Runtime management structurecspace {struct vm_cspace}: VM CSpace management structurehost_endpoint {seL4_CPtr}: Host/VMM endpoint. vm_run waits on this enpointvka {vka_t *}: Handle to virtual kernel allocator for seL4 kernel object allocationio_ops {ps_io_ops_t *}: Handle to platforms io opssimple {simple_t *}: Handle to hosts simple environmentvm_name {char *}: String used to describe VM. Useful for debuggingvm_id {unsigned int}: Identifier for VM. Useful for debuggingvm_initialised {bool}: Boolean flagging whether VM is intialised or notBack to interface description.
Back to top.