L4Re - L4 Runtime Environment
L4vcpu::Vcpu Class Reference

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

+ 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. More...
 
Statestate () throw ()
 Get state word. More...
 
State state () const throw ()
 Get state word. More...
 
Statesaved_state () throw ()
 Get saved_state word. More...
 
State saved_state () const throw ()
 Get saved_state word. More...
 
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. More...
 
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. More...
 
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. More...
 
void task (L4::Cap< L4::Task > const task=L4::Cap< L4::Task >::Invalid) throw ()
 Set the task of the vCPU. More...
 
int is_page_fault_entry () const
 Return whether the entry reason was a page fault. More...
 
int is_irq_entry () const
 Return whether the entry reason was an IRQ/IPC message. More...
 
l4_vcpu_regs_tr () throw ()
 Return pointer to register state. More...
 
l4_vcpu_regs_t const * r () const throw ()
 Return pointer to register state. More...
 
l4_vcpu_ipc_regs_ti () throw ()
 Return pointer to IPC state. More...
 
l4_vcpu_ipc_regs_t const * i () const throw ()
 Return pointer to IPC state. More...
 
void entry_sp (l4_umword_t sp)
 Set vCPU entry stack pointer. More...
 
void entry_ip (l4_umword_t ip)
 Set vCPU entry instruction pointer. More...
 
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. More...
 
static Vcpucast (void *x) throw ()
 Cast a void pointer to a class pointer. More...
 
static Vcpucast (l4_addr_t x) throw ()
 Cast an address to a class pointer. More...
 

Detailed Description

C++ implementation of the vCPU save state area.

Definition at line 72 of file vcpu.

Member Function Documentation

◆ cast() [1/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 265 of file vcpu.

◆ cast() [2/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 275 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 239 of file vcpu.

◆ 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 232 of file vcpu.

◆ 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.

Return values
vcpuAllocated vcpu-state area.
ext_stateAllocated extended vcpu-state area.
Parameters
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

◆ 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 216 of file vcpu.

◆ 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 223 of file vcpu.

◆ 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 85 of file vcpu.

◆ 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 142 of file vcpu.

◆ 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 157 of file vcpu.

◆ 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 195 of file vcpu.

◆ 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 188 of file vcpu.

◆ 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 202 of file vcpu.

◆ 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 209 of file vcpu.

◆ 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 113 of file vcpu.

◆ 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 123 of file vcpu.

◆ state() [1/2]

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

Get state word.

Returns
Pointer to state word in the vCPU

Definition at line 95 of file vcpu.

◆ state() [2/2]

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

Get state word.

Returns
Pointer to state word in the vCPU

Definition at line 106 of file vcpu.

◆ 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 181 of file vcpu.

◆ 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 173 of file vcpu.


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