L4Re - L4 Runtime Environment
vCPU Support Library

vCPU handling functionality. More...

+ Collaboration diagram for vCPU Support Library:

Modules

 Extended vCPU support
 extended vCPU handling functionality.
 

Data Structures

class  L4vcpu::State
 C++ implementation of state word in the vCPU area. More...
 
class  L4vcpu::Vcpu
 C++ implementation of the vCPU save state area. More...
 

Functions

void l4vcpu_irq_disable (l4_vcpu_state_t *vcpu) L4_NOTHROW
 Disable a vCPU for event delivery. More...
 
unsigned l4vcpu_irq_disable_save (l4_vcpu_state_t *vcpu) L4_NOTHROW
 Disable a vCPU for event delivery and return previous state. More...
 
void l4vcpu_irq_enable (l4_vcpu_state_t *vcpu, l4_utcb_t *utcb, l4vcpu_event_hndl_t do_event_work_cb, l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW
 Enable a vCPU for event delivery. More...
 
void l4vcpu_irq_restore (l4_vcpu_state_t *vcpu, unsigned s, l4_utcb_t *utcb, l4vcpu_event_hndl_t do_event_work_cb, l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW
 Restore a previously saved IRQ/event state. More...
 
void l4vcpu_wait_for_event (l4_vcpu_state_t *vcpu, l4_utcb_t *utcb, l4vcpu_event_hndl_t do_event_work_cb, l4vcpu_setup_ipc_t setup_ipc) L4_NOTHROW
 Wait for event. More...
 
void l4vcpu_print_state (const l4_vcpu_state_t *vcpu, const char *prefix) L4_NOTHROW
 Print the state of a vCPU. More...
 
int l4vcpu_is_irq_entry (l4_vcpu_state_t const *vcpu) L4_NOTHROW
 Return whether the entry reason was an IRQ/IPC message. More...
 
int l4vcpu_is_page_fault_entry (l4_vcpu_state_t const *vcpu) L4_NOTHROW
 Return whether the entry reason was a page fault. More...
 

Detailed Description

vCPU handling functionality.

This library provides convenience functionality on top of the l4sys vCPU interface to ease programming. It wraps commonly used code and abstracts architecture depends parts as far as reasonable.

Function Documentation

◆ l4vcpu_irq_disable()

void l4vcpu_irq_disable ( l4_vcpu_state_t vcpu)
inline

Disable a vCPU for event delivery.

Parameters
vcpuPointer to vCPU area.

Definition at line 208 of file vcpu.h.

References l4_barrier(), L4_CV, and L4_VCPU_F_IRQ.

Referenced by l4vcpu_irq_disable_save(), and l4vcpu_irq_restore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ l4vcpu_irq_disable_save()

unsigned l4vcpu_irq_disable_save ( l4_vcpu_state_t vcpu)
inline

Disable a vCPU for event delivery and return previous state.

Parameters
vcpuPointer to vCPU area.
Returns
IRQ state before disabling IRQs.

Definition at line 216 of file vcpu.h.

References l4_vcpu_state_t::i, L4_CV, l4_ipc_wait(), L4_LIKELY, l4_msgtag_has_error(), L4_NOTHROW, and l4vcpu_irq_disable().

+ Here is the call graph for this function:

◆ l4vcpu_irq_enable()

void l4vcpu_irq_enable ( l4_vcpu_state_t vcpu,
l4_utcb_t utcb,
l4vcpu_event_hndl_t  do_event_work_cb,
l4vcpu_setup_ipc_t  setup_ipc 
)
inline

Enable a vCPU for event delivery.

Parameters
vcpuPointer to vCPU area.
utcbUtcb pointer of the calling vCPU.
do_event_work_cbCall-back function that is called in case an event (such as an interrupt) is pending.
setup_ipcFunction call-back that is called right before any IPC operation, and before event delivery is enabled.

Definition at line 239 of file vcpu.h.

References l4_barrier(), L4_CV, L4_IPC_BOTH_TIMEOUT_0, L4_LIKELY, L4_VCPU_F_IRQ, L4_VCPU_SF_IRQ_PENDING, l4_vcpu_state_t::state, and l4_vcpu_state_t::sticky_flags.

Referenced by l4vcpu_irq_restore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ l4vcpu_irq_restore()

void l4vcpu_irq_restore ( l4_vcpu_state_t vcpu,
unsigned  s,
l4_utcb_t utcb,
l4vcpu_event_hndl_t  do_event_work_cb,
l4vcpu_setup_ipc_t  setup_ipc 
)
inline

Restore a previously saved IRQ/event state.

Parameters
vcpuPointer to vCPU area.
sIRQ state to be restored.
utcbUtcb pointer of the calling vCPU.
do_event_work_cbCall-back function that is called in case an event (such as an interrupt) is pending after enabling.
setup_ipcFunction call-back that is called right before any IPC operation, and before event delivery is enabled.

Definition at line 264 of file vcpu.h.

References L4_CV, L4_VCPU_F_IRQ, l4vcpu_irq_disable(), l4vcpu_irq_enable(), and l4_vcpu_state_t::state.

+ Here is the call graph for this function:

◆ l4vcpu_is_irq_entry()

int l4vcpu_is_irq_entry ( l4_vcpu_state_t const *  vcpu)
inline

Return whether the entry reason was an IRQ/IPC message.

Parameters
vcpuPointer to vCPU area.

return 0 if not, !=0 otherwise.

◆ l4vcpu_is_page_fault_entry()

int l4vcpu_is_page_fault_entry ( l4_vcpu_state_t const *  vcpu)
inline

Return whether the entry reason was a page fault.

Parameters
vcpuPointer to vCPU area.

return 0 if not, !=0 otherwise.

◆ l4vcpu_print_state()

void l4vcpu_print_state ( const l4_vcpu_state_t vcpu,
const char *  prefix 
)

Print the state of a vCPU.

Parameters
vcpuPointer to vCPU area.
prefixA prefix for each line printed.

◆ l4vcpu_wait_for_event()

void l4vcpu_wait_for_event ( l4_vcpu_state_t vcpu,
l4_utcb_t utcb,
l4vcpu_event_hndl_t  do_event_work_cb,
l4vcpu_setup_ipc_t  setup_ipc 
)
inline

Wait for event.

Parameters
vcpuPointer to vCPU area.
utcbUtcb pointer of the calling vCPU.
do_event_work_cbCall-back function that is called when the vCPU awakes and needs to handle an event/IRQ.
setup_ipcFunction call-back that is called right before any IPC operation.

Note that event delivery remains disabled after this function returns.

Definition at line 277 of file vcpu.h.

References __END_DECLS, and L4_IPC_NEVER.