Data Structures | Functions
common.h File Reference

Go to the source code of this file.

Data Structures

struct  module_t
 

Functions

int64_t common_vmm_status (void)
 
int64_t common_reset (void)
 
int64_t common_init (void)
 
int64_t common_fini (void)
 
int64_t common_add_module (const char *file, uint64_t fsize)
 
int64_t common_load_vmm (void)
 
int64_t common_unload_vmm (void)
 
int64_t common_start_vmm (void)
 
int64_t common_stop_vmm (void)
 
int64_t common_dump_vmm (struct debug_ring_resources_t **drr, uint64_t vcpuid)
 
int64_t common_vmcall (struct vmcall_registers_t *regs, uint64_t cpuid)
 

Function Documentation

◆ common_vmm_status()

int64_t common_vmm_status ( void  )

VMM Status

Returns
returns the current status of the VMM.

Definition at line 227 of file common.c.

◆ common_reset()

int64_t common_reset ( void  )

Reset

This function should not be called directly. Instead, use common_unload. This is only exposed publically for unit testing.

Returns
will always return BF_SUCCESS

Definition at line 233 of file common.c.

◆ common_init()

int64_t common_init ( void  )

Initialize Driver Entry

This code should be run as part of the driver entry's init code. This sets up some resources that are needed throughout the lifetime of the driver entry.

Returns
BF_SUCCESS on success, negative error code on failure

Definition at line 267 of file common.c.

◆ common_fini()

int64_t common_fini ( void  )

Finalize Driver Entry

This code should be run as part of the driver entry's fini code. This cleans up some resources that were needed throughout the lifetime of the driver entry.

Returns
BF_SUCCESS on success, negative error code on failure

Definition at line 273 of file common.c.

◆ common_add_module()

int64_t common_add_module ( const char *  file,
uint64_t  fsize 
)

Add Module

Add's a module into memory to be executed once start_vmm is run. This function uses the platform functions to allocate memory for the executable. The file that is provided should not be removed until after stop_vmm is run. Removing the file from memory could cause a crash, as the start_vmm function uses the file that is being added to search for symbols that are needed, as well as the stop_vmm function. Once stop_vmm is run, it's safe to remove the files. Also, this function cannot be run if the vmm has already been started.

Parameters
filethe file to add to memory
fsizethe size of the file in bytes
Returns
BF_SUCCESS on success, negative error code on failure

Definition at line 305 of file common.c.

◆ common_load_vmm()

int64_t common_load_vmm ( void  )

Load VMM

This function loads the vmm (assuming that the modules that were loaded are actually a vmm). Once a VMM is loaded, it is placed in memory, and all of the modules are properly reloacted such that, code within each module is now capable of executing.

Returns
BF_SUCCESS on success, negative error code on failure

Definition at line 357 of file common.c.

◆ common_unload_vmm()

int64_t common_unload_vmm ( void  )

Unload VMM

This function unloads the vmm. Once the VMM is unloaded, all of the symbols for the VMM are removed from memory, and are no longer accessible. The VMM cannot be unloaded unless the VMM is already loaded, but is not running.

Returns
BF_SUCCESS on success, negative error code on failure

Definition at line 451 of file common.c.

◆ common_start_vmm()

int64_t common_start_vmm ( void  )

Start VMM

This function starts the vmm. Before the VMM can be started, it must first be loaded.

Returns
BF_SUCCESS on success, negative error code on failure

Definition at line 490 of file common.c.

◆ common_stop_vmm()

int64_t common_stop_vmm ( void  )

Stop VMM

This function stops the vmm. Before a VMM can be stopped, it must first be loaded, and running.

Returns
BF_SUCCESS on success, negative error code on failure

Definition at line 543 of file common.c.

◆ common_dump_vmm()

int64_t common_dump_vmm ( struct debug_ring_resources_t **  drr,
uint64_t  vcpuid 
)

Dump VMM

This grabs the conents of the debug ring, and dumps the contents to the driver entry's console. This is one of a couple of ways to get feedback from the VMM. Note that the VMM must at least be loaded for this function to work as it has to do a symbol lookup

Parameters
drra pointer to the drr provided by the user
vcpuidindicates which drr to get as each vcpu has its own drr
Returns
BF_SUCCESS on success, negative error code on failure

Definition at line 592 of file common.c.

◆ common_vmcall()

int64_t common_vmcall ( struct vmcall_registers_t regs,
uint64_t  cpuid 
)

VMCall

This performs a vmcall on the requested CPU.

Parameters
regsthe vmcall registers used in the vmcall
cpuidindicates which cpu to vmcall
Returns
BF_SUCCESS on success, negative error code on failure

Definition at line 610 of file common.c.