L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
L4vcpu::Vcpu Class Reference

C++ implementation of the vCPU save state area. More...

#include <vcpu>

+ Inheritance diagram for L4vcpu::Vcpu:
+ Collaboration diagram for L4vcpu::Vcpu:

Public Member Functions

void irq_disable () throw ()
 Disable the vCPU for event delivery.
 
unsigned irq_disable_save () throw ()
 Disable the vCPU for event delivery and return previous state.
 
Statestate () throw ()
 Get state word.
 
State state () const throw ()
 Get state word.
 
Statesaved_state () throw ()
 Get saved_state word.
 
State saved_state () const throw ()
 Get saved_state word.
 
l4_uint16_t sticky_flags () const throw ()
 Get sticky flags.
 
void irq_enable (l4_utcb_t *utcb, l4vcpu_event_hndl_t do_event_work_cb, l4vcpu_setup_ipc_t setup_ipc) throw ()
 Enable the vCPU for event delivery.
 
void irq_restore (unsigned s, l4_utcb_t *utcb, l4vcpu_event_hndl_t do_event_work_cb, l4vcpu_setup_ipc_t setup_ipc) throw ()
 Restore a previously saved IRQ/event state.
 
void wait_for_event (l4_utcb_t *utcb, l4vcpu_event_hndl_t do_event_work_cb, l4vcpu_setup_ipc_t setup_ipc) throw ()
 Wait for event.
 
void task (L4::Cap< L4::Task > const task=L4::Cap< L4::Task >::Invalid) throw ()
 Set the task of the vCPU.
 
int is_page_fault_entry () const
 Return whether the entry reason was a page fault.
 
int is_irq_entry () const
 Return whether the entry reason was an IRQ/IPC message.
 
l4_vcpu_regs_tr () throw ()
 Return pointer to register state.
 
l4_vcpu_regs_t const * r () const throw ()
 Return pointer to register state.
 
l4_vcpu_ipc_regs_ti () throw ()
 Return pointer to IPC state.
 
l4_vcpu_ipc_regs_t const * i () const throw ()
 Return pointer to IPC state.
 
void entry_sp (l4_umword_t sp)
 Set vCPU entry stack pointer.
 
void entry_ip (l4_umword_t ip)
 Set vCPU entry instruction pointer.
 
void print_state (const char *prefix="") const throw ()
 Print the state of the vCPU.
 

Static Public Member Functions

static int ext_alloc (Vcpu **vcpu, l4_addr_t *ext_state, L4::Cap< L4::Task > task=L4Re::Env::env() ->task(), L4::Cap< L4Re::Rm > rm=L4Re::Env::env() ->rm()) throw ()
 Allocate state area for an extended vCPU.
 
static Vcpucast (void *x) throw ()
 Cast a void pointer to a class pointer.
 
static Vcpucast (l4_addr_t x) throw ()
 Cast an address to a class pointer.
 

Detailed Description

C++ implementation of the vCPU save state area.

Definition at line 76 of file vcpu.

Member Function Documentation

◆ cast() [1/2]

static Vcpu * L4vcpu::Vcpu::cast ( l4_addr_t  x)
throw (
)
inlinestatic

Cast an address to a class pointer.

Parameters
xPointer.
Returns
Pointer to Vcpu class.

Definition at line 280 of file vcpu.

◆ cast() [2/2]

static Vcpu * L4vcpu::Vcpu::cast ( void *  x)
throw (
)
inlinestatic

Cast a void pointer to a class pointer.

Parameters
xPointer.
Returns
Pointer to Vcpu class.

Definition at line 270 of file vcpu.

◆ entry_ip()

void L4vcpu::Vcpu::entry_ip ( l4_umword_t  ip)
inline

Set vCPU entry instruction pointer.

Parameters
ipInstruction pointer address to set.

Definition at line 243 of file vcpu.

References l4_vcpu_state_t::entry_ip.

◆ entry_sp()

void L4vcpu::Vcpu::entry_sp ( l4_umword_t  sp)
inline

Set vCPU entry stack pointer.

Parameters
spStack pointer address to set.
Note
The value is only used when entering from a user-task.

Definition at line 236 of file vcpu.

References l4_vcpu_state_t::entry_sp.

◆ ext_alloc()

static int L4vcpu::Vcpu::ext_alloc ( Vcpu **  vcpu,
l4_addr_t ext_state,
L4::Cap< L4::Task task = L4Re::Env::env() ->task(),
L4::Cap< L4Re::Rm rm = L4Re::Env::env() ->rm() 
)
throw (
)
static

Allocate state area for an extended vCPU.

Parameters
[out]vcpuAllocated vcpu-state area.
[out]ext_stateAllocated extended vcpu-state area.
taskTask to use for allocation, defaults to own task.
rmRegion manager to use for allocation defaults to standard region manager.
Returns
0 for success, error code otherwise

References task().

+ Here is the call graph for this function:

◆ i() [1/2]

l4_vcpu_ipc_regs_t * L4vcpu::Vcpu::i ( )
throw (
)
inline

Return pointer to IPC state.

Returns
Pointer to IPC state.

Definition at line 220 of file vcpu.

References l4_vcpu_state_t::i.

◆ i() [2/2]

l4_vcpu_ipc_regs_t const * L4vcpu::Vcpu::i ( ) const
throw (
)
inline

Return pointer to IPC state.

Returns
Pointer to IPC state.

Definition at line 227 of file vcpu.

References l4_vcpu_state_t::i.

◆ irq_disable_save()

unsigned L4vcpu::Vcpu::irq_disable_save ( )
throw (
)
inline

Disable the vCPU for event delivery and return previous state.

Returns
IRQ state before disabling IRQs.

Definition at line 89 of file vcpu.

References l4vcpu_irq_disable_save().

+ Here is the call graph for this function:

◆ irq_enable()

void L4vcpu::Vcpu::irq_enable ( l4_utcb_t utcb,
l4vcpu_event_hndl_t  do_event_work_cb,
l4vcpu_setup_ipc_t  setup_ipc 
)
throw (
)
inline

Enable the vCPU for event delivery.

Parameters
utcbThe UTCB to use.
do_event_work_cbCall-back function that is called in case an event (such as an interrupt) is pending.
setup_ipcCall-back function that is called before an IPC operation is called, and before event delivery is enabled.

Definition at line 146 of file vcpu.

References l4vcpu_irq_enable().

+ Here is the call graph for this function:

◆ irq_restore()

void L4vcpu::Vcpu::irq_restore ( unsigned  s,
l4_utcb_t utcb,
l4vcpu_event_hndl_t  do_event_work_cb,
l4vcpu_setup_ipc_t  setup_ipc 
)
throw (
)
inline

Restore a previously saved IRQ/event state.

Parameters
sIRQ state to be restored.
utcbThe UTCB to use.
do_event_work_cbCall-back function that is called in case an event (such as an interrupt) is pending.
setup_ipcCall-back function that is called before an IPC operation is called, and before event delivery is enabled.

Definition at line 161 of file vcpu.

References l4vcpu_irq_restore().

+ Here is the call graph for this function:

◆ is_irq_entry()

int L4vcpu::Vcpu::is_irq_entry ( ) const
inline

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

return 0 if not, !=0 otherwise.

Definition at line 199 of file vcpu.

References l4vcpu_is_irq_entry().

+ Here is the call graph for this function:

◆ is_page_fault_entry()

int L4vcpu::Vcpu::is_page_fault_entry ( ) const
inline

Return whether the entry reason was a page fault.

return 0 if not, !=0 otherwise.

Definition at line 192 of file vcpu.

References l4vcpu_is_page_fault_entry().

+ Here is the call graph for this function:

◆ r() [1/2]

l4_vcpu_regs_t * L4vcpu::Vcpu::r ( )
throw (
)
inline

Return pointer to register state.

Returns
Pointer to register state.

Definition at line 206 of file vcpu.

References l4_vcpu_state_t::r.

◆ r() [2/2]

l4_vcpu_regs_t const * L4vcpu::Vcpu::r ( ) const
throw (
)
inline

Return pointer to register state.

Returns
Pointer to register state.

Definition at line 213 of file vcpu.

References l4_vcpu_state_t::r.

◆ saved_state() [1/2]

State * L4vcpu::Vcpu::saved_state ( )
throw (
)
inline

Get saved_state word.

Returns
Pointer to saved_state word in the vCPU

Definition at line 117 of file vcpu.

References l4_vcpu_state_t::saved_state.

◆ saved_state() [2/2]

State L4vcpu::Vcpu::saved_state ( ) const
throw (
)
inline

Get saved_state word.

Returns
Pointer to saved_state word in the vCPU

Definition at line 127 of file vcpu.

References l4_vcpu_state_t::saved_state.

◆ state() [1/2]

State * L4vcpu::Vcpu::state ( )
throw (
)
inline

Get state word.

Returns
Pointer to state word in the vCPU

Definition at line 99 of file vcpu.

References l4_vcpu_state_t::state.

◆ state() [2/2]

State L4vcpu::Vcpu::state ( ) const
throw (
)
inline

Get state word.

Returns
Pointer to state word in the vCPU

Definition at line 110 of file vcpu.

References l4_vcpu_state_t::state.

◆ task()

void L4vcpu::Vcpu::task ( L4::Cap< L4::Task > const  task = L4::Cap<L4::Task>::Invalid)
throw (
)
inline

Set the task of the vCPU.

Parameters
taskTask to set, defaults to invalid task.

Definition at line 185 of file vcpu.

References task(), and l4_vcpu_state_t::user_task.

Referenced by ext_alloc(), and task().

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

◆ wait_for_event()

void L4vcpu::Vcpu::wait_for_event ( l4_utcb_t utcb,
l4vcpu_event_hndl_t  do_event_work_cb,
l4vcpu_setup_ipc_t  setup_ipc 
)
throw (
)
inline

Wait for event.

Parameters
utcbThe UTCB to use.
do_event_work_cbCall-back function that is called in case an event (such as an interrupt) is pending.
setup_ipcCall-back function that is called before an IPC operation is called.

Note that event delivery remains disabled after this function returns.

Definition at line 177 of file vcpu.

References l4vcpu_wait_for_event().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: