Barrelfish
Macros | Functions
dispatch.h File Reference

The API to lib/barrelfish/dispatch. More...

Macros

#define DISPATCHER_STACK_BYTES   (8192) /* 8kB */
 Stack size for dispatcher, in words.
 

Functions

void disp_init_disabled (dispatcher_handle_t handle)
 Initialise the dispatcher, while disabled. More...
 
dispatcher_handle_t disp_disable (void)
 Disable the dispatcher. More...
 
dispatcher_handle_t disp_try_disable (bool *was_enabled)
 Try to disable the dispatcher. More...
 
void disp_enable (dispatcher_handle_t handle)
 Re-enable the dispatcher. More...
 
void disp_arch_init (dispatcher_handle_t handle)
 Architecture-specific dispatcher initialisation.
 
void disp_resume (dispatcher_handle_t handle, arch_registers_state_t *archregs)
 Resume execution of a given register state. More...
 
void disp_switch (dispatcher_handle_t handle, arch_registers_state_t *from_state, arch_registers_state_t *to_state)
 Switch execution between two register states, and turn off disabled activations. More...
 
void disp_save (dispatcher_handle_t handle, arch_registers_state_t *state, bool yield, capaddr_t yield_to)
 Save the current register state and optionally yield the CPU. More...
 
void disp_save_rm_kcb (void)
 Save register state, remove our KCB from current CPU.
 
void disp_yield_disabled (dispatcher_handle_t handle)
 Yield the dispatcher's CPU. More...
 
const char * disp_name (void)
 Return a pointer to the name field of the current dispatcher. More...
 

Detailed Description

The API to lib/barrelfish/dispatch.

Function Documentation

dispatcher_handle_t disp_disable ( void  )

Disable the dispatcher.

This function disables the current dispatcher, returning a pointer to it. The dispatcher must be enabled.

While the dispatcher is disabled, the current thread cannot be preempted, and no incoming LMP messages can be received.

void disp_enable ( dispatcher_handle_t  handle)

Re-enable the dispatcher.

This function re-enables the current dispatcher. The dispatcher must be disabled.

void disp_init_disabled ( dispatcher_handle_t  handle)

Initialise the dispatcher, while disabled.

This function is called to setup the dispatcher structure while still disabled.

Parameters
dispDispatcher
const char* disp_name ( void  )

Return a pointer to the name field of the current dispatcher.

May be called when the dispatcher is either enabled or disabled.

Returns
a string of at most #DISP_NAME_LEN characters, which may not be nul-terminated.
void disp_resume ( dispatcher_handle_t  handle,
arch_registers_state_t archregs 
)

Resume execution of a given register state.

This function resumes the execution of the given register state on the current dispatcher. It may only be called while the dispatcher is disabled.

Parameters
dispCurrent dispatcher pointer
regsRegister state snapshot
void disp_save ( dispatcher_handle_t  handle,
arch_registers_state_t state,
bool  yield,
capaddr_t  yield_to 
)

Save the current register state and optionally yield the CPU.

This function saves as much as necessary of the current register state (which, when resumed will return to the caller), and then either re-enters the thread scheduler or yields the CPU. It may only be called while the dispatcher is disabled. Note that the thread context saved is a voluntary save so only callee save registers need to be saved, but we dont currently provide any way to optimise the corresponding resume.

Parameters
dispCurrent dispatcher pointer
regsLocation to save current register state
yieldIf true, yield CPU to kernel; otherwise re-run thread scheduler
yield_toEndpoint capability for dispatcher to which we want to yield

This function saves as much as necessary of the current register state (which, when resumed will return to the caller), and then either re-enters the thread scheduler or yields the CPU. It may only be called while the dispatcher is disabled.

Parameters
dispCurrent dispatcher pointer
regsLocation to save current register state
yieldIf true, yield CPU to kernel; otherwise re-run thread scheduler
yield_toEndpoint capability for dispatcher to which we want to yield
void disp_switch ( dispatcher_handle_t  handle,
arch_registers_state_t from_state,
arch_registers_state_t to_state 
)

Switch execution between two register states, and turn off disabled activations.

This function saves as much as necessary of the current register state (which, when resumed will return to the caller), and switches execution by resuming the given register state. It may only be called while the dispatcher is disabled. A side effect is that activations are reenabled. Note that the thread context saved is a voluntary save so only callee save registers need to be saved, but we dont currently provide any way to optimise the corresponding resume.

Parameters
dispCurrent dispatcher pointer
from_regsLocation to save current register state
to_regsLocation from which to resume new register state

Switch execution between two register states, and turn off disabled activations.

This function saves as much as necessary of the current register state (which, when resumed will return to the caller), and switches execution by resuming the given register state. It may only be called while the dispatcher is disabled.

Parameters
dispCurrent dispatcher pointer
from_regsLocation to save current register state
to_regsLocation from which to resume new register state
dispatcher_handle_t disp_try_disable ( bool *  was_enabled)

Try to disable the dispatcher.

This function disables the current dispatcher if it's enabled and returns a pointer to it.

While the dispatcher is disabled, the current thread cannot be preempted, and no incoming LMP messages can be received.

Parameters
was_enabledTrue, if the dispatcher was enabled
void disp_yield_disabled ( dispatcher_handle_t  handle)

Yield the dispatcher's CPU.

This function yields the CPU. It may only be called while disabled.

Parameters
dispCurrent dispatcher