L4Re - L4 Runtime Environment
|
Thread object. More...
Modules | |
Thread control | |
API for Thread Control method. | |
vCPU API | |
vCPU API | |
Enumerations | |
enum | L4_thread_control_flags { L4_THREAD_CONTROL_SET_PAGER = 0x0010000, L4_THREAD_CONTROL_BIND_TASK = 0x0200000, L4_THREAD_CONTROL_ALIEN = 0x0400000, L4_THREAD_CONTROL_UX_NATIVE = 0x0800000, L4_THREAD_CONTROL_SET_EXC_HANDLER = 0x1000000 } |
Flags for the thread control operation. More... | |
enum | L4_thread_control_mr_indices { L4_THREAD_CONTROL_MR_IDX_FLAGS = 0, L4_THREAD_CONTROL_MR_IDX_PAGER = 1, L4_THREAD_CONTROL_MR_IDX_EXC_HANDLER = 2, L4_THREAD_CONTROL_MR_IDX_FLAG_VALS = 4, L4_THREAD_CONTROL_MR_IDX_BIND_UTCB = 5, L4_THREAD_CONTROL_MR_IDX_BIND_TASK = 6 } |
Indices for the values in the message register for thread control. More... | |
enum | L4_thread_ex_regs_flags { L4_THREAD_EX_REGS_CANCEL = 0x10000UL, L4_THREAD_EX_REGS_TRIGGER_EXCEPTION = 0x20000UL } |
Flags for the thread ex-regs operation. More... | |
Thread object.
An L4 thread is a thread of execution in the L4 context. Usually user-level and kernel threads are mapped 1:1 to each other. Thread kernel objects are created using a factory, see Factory (l4_factory_create_thread()).
Amongst other things an L4 thread encapsulates:
Thread objects provide an API for
The thread control functions are used to control various aspects of a thread. See l4_thread_control_start() for more information.
For the C++ interface refer to L4::Thread.
Flags for the thread control operation.
Indices for the values in the message register for thread control.
Enumerator | |
---|---|
L4_THREAD_CONTROL_MR_IDX_FLAGS |
|
L4_THREAD_CONTROL_MR_IDX_PAGER | Index for pager cap. |
L4_THREAD_CONTROL_MR_IDX_EXC_HANDLER | Index for exception handler. |
L4_THREAD_CONTROL_MR_IDX_FLAG_VALS | Index for feature values. |
L4_THREAD_CONTROL_MR_IDX_BIND_UTCB | Index for UTCB address for bind. |
L4_THREAD_CONTROL_MR_IDX_BIND_TASK | Index for task flex-page for bind. |
|
inline |
|
inline |
Exchange basic thread registers.
thread | Capability selector of the thread to manipulate. |
ip | New instruction pointer, use ~0UL to leave the instruction pointer unchanged. |
sp | New stack pointer, use ~0UL to leave the stack pointer unchanged. |
flags | Ex-regs flags, see L4_thread_ex_regs_flags. |
This method allows to manipulate a thread. The basic functionality is to set the instruction pointer and the stack pointer of a thread. Additionally, this method allows also to cancel ongoing IPC operations and to force the thread to raise an artificial exception (see flags
).
The thread is started using l4_scheduler_run_thread(). However, if at the time l4_scheduler_run_thread() is called, the instruction pointer of the thread is invalid, a later call to l4_thread_ex_regs() with a valid instruction pointer might start the thread.
Definition at line 829 of file thread.h.
References l4_thread_ex_regs_u(), and l4_utcb().
|
inline |
Exchange basic thread registers and return previous values.
thread | Capability selector of the thread to manipulate. | |
[in,out] | ip | New instruction pointer, use ~0UL to leave the instruction pointer unchanged, return previous instruction pointer. |
[in,out] | sp | New stack pointer, use ~0UL to leave the stack pointer unchanged, returns previous stack pointer. |
[in,out] | flags | Ex-regs flags, see L4_thread_ex_regs_flags, return previous CPU flags of the thread. |
This method allows to manipulate and start a thread. The basic functionality is to set the instruction pointer and the stack pointer of a thread. Additionally, this method allows also to cancel ongoing IPC operations and to force the thread to raise an artificial exception (see flags
).
Returned values are valid only if function returns successfully.
Definition at line 836 of file thread.h.
References l4_thread_ex_regs_ret_u(), and l4_utcb().
|
inline |
Exchange basic thread registers and return previous values.
thread | Capability selector of the thread to manipulate. | |
[in,out] | ip | New instruction pointer, use ~0UL to leave the instruction pointer unchanged, return previous instruction pointer. |
[in,out] | sp | New stack pointer, use ~0UL to leave the stack pointer unchanged, returns previous stack pointer. |
[in,out] | flags | Ex-regs flags, see L4_thread_ex_regs_flags, return previous CPU flags of the thread. |
utcb | UTCB to use for this operation. |
This method allows to manipulate and start a thread. The basic functionality is to set the instruction pointer and the stack pointer of a thread. Additionally, this method allows also to cancel ongoing IPC operations and to force the thread to raise an artificial exception (see flags
).
Definition at line 702 of file thread.h.
Referenced by L4::Thread::ex_regs(), and l4_thread_ex_regs_ret().
|
inline |
Exchange basic thread registers.
thread | Capability selector of the thread to manipulate. |
ip | New instruction pointer, use ~0UL to leave the instruction pointer unchanged. |
sp | New stack pointer, use ~0UL to leave the stack pointer unchanged. |
flags | Ex-regs flags, see L4_thread_ex_regs_flags. |
utcb | UTCB to use for this operation. |
This method allows to manipulate a thread. The basic functionality is to set the instruction pointer and the stack pointer of a thread. Additionally, this method allows also to cancel ongoing IPC operations and to force the thread to raise an artificial exception (see flags
).
The thread is started using L4::Scheduler::run_thread(). However, if at the time L4::Scheduler::run_thread() is called, the instruction pointer of the thread is invalid, a later call to ex_regs() with a valid instruction pointer might start the thread.
Definition at line 691 of file thread.h.
Referenced by L4::Thread::ex_regs(), and l4_thread_ex_regs().
|
inline |
Add a modification pattern to a sender modification sequence.
tag | Tag received from l4_thread_modify_sender_start() or previous l4_thread_modify_sender_add() calls from the same sequence. |
match_mask | Bitmask of bits to match the label. |
match | Bitmask that must be equal to the label after applying match_mask. |
del_bits | Bits to be deleted from the label. |
add_bits | Bits to be added to the label. |
In pseudo code: if ((sender_label & match_mask) == match) { label = (label & ~del_bits) | add_bits; }
Only the first match is applied.
|
inline |
Apply (commit) a sender modification sequence.
|
inline |
Start a thread sender modification sequence.
Add modification rules with l4_thread_modify_sender_add() and commit with l4_thread_modify_sender_commit(). Do not touch the UTCB between l4_thread_modify_sender_start() and l4_thread_modify_sender_commit().
|
inline |
Register an IRQ that will trigger upon deletion events.
thread | Thread to register IRQ for. |
irq | Capability selector for the IRQ object to be triggered. |
An example of a deletion event is the removal of an IPC gate that is bound to this thread.
|
inline |
|
inline |
|
inline |
Enable or disable the vCPU feature for the thread.
thread | Capability selector of the thread for which the vCPU feature shall be enabled or disabled. |
vcpu_state | The virtual address where the kernel shall store the vCPU state in case of vCPU exits. The address must be a valid kernel-user-memory address (see l4_task_add_ku_mem()). |
This function enables the vCPU feature of the thread
if vcpu_state
is set to a valid kernel-user-memory address, or disables the vCPU feature if vcpu_state
is 0. (Disable: optional, currently unsupported.)
Definition at line 947 of file thread.h.
References l4_thread_vcpu_control_u(), and l4_utcb().
|
inline |
Enable or disable the extended vCPU feature for the thread.
thread | Capability selector of the thread for which the extended vCPU feature shall be enabled or disabled. |
ext_vcpu_state | The virtual address where the kernel shall store the vCPU state in case of vCPU exits. The address must be a valid kernel-user-memory address (see l4_task_add_ku_mem()). |
The extended vCPU feature allows the use of hardware-virtualization features such as Intel's VT or AMD's SVM.
This function enables the extended vCPU feature of the thread
if ext_vcpu_state
is set to a valid kernel-user-memory address, or disables the vCPU feature if ext_vcpu_state
is 0.
Definition at line 962 of file thread.h.
References l4_thread_vcpu_control_ext_u(), and l4_utcb().
|
inline |
Enable or disable the extended vCPU feature for the thread.
thread | Capability selector of the thread for which the extended vCPU feature shall be enabled or disabled. |
ext_vcpu_state | The virtual address where the kernel shall store the vCPU state in case of vCPU exits. The address must be a valid kernel-user-memory address (see L4::Task::add_ku_mem()). |
utcb | UTCB to use for this operation. |
The extended vCPU feature allows the use of hardware-virtualization features such as Intel's VT or AMD's SVM.
This function enables the extended vCPU feature of this
thread if ext_vcpu_state
is set to a valid kernel-user-memory address, or disables the vCPU feature if ext_vcpu_state
is 0.
Definition at line 952 of file thread.h.
Referenced by l4_thread_vcpu_control_ext(), and L4::Thread::vcpu_control_ext().
|
inline |
Enable or disable the vCPU feature for the thread.
thread | Capability selector of the thread for which the vCPU feature shall be enabled or disabled. |
vcpu_state | The virtual address where the kernel shall store the vCPU state in case of vCPU exits. The address must be a valid kernel-user-memory address (see L4::Task::add_ku_mem()). |
utcb | UTCB to use for this operation. |
This function enables the vCPU feature of this
thread if vcpu_state
is set to a valid kernel-user-memory address, or disables the vCPU feature if vcpu_state
is 0. (Disable: optional, currently unsupported.)
Definition at line 937 of file thread.h.
Referenced by l4_thread_vcpu_control(), and L4::Thread::vcpu_control().
|
inline |
Commit vCPU resume.
thread | Thread to be resumed, the invalid cap can be used for the current thread. |
tag | Tag to use, returned by l4_thread_vcpu_resume_start() |
To resume into another address space the capability to the target task must be set in the vCPU-state, with all lower bits in the task capability cleared (see L4_CAP_MASK). The kernel adds the L4_SYSF_SEND flag to this field to indicate that the capability has been referenced in the kernel. Consecutive resumes will not reference the task capability again until all bits are cleared again. To release a task use the different task capability or use an invalid capability with the L4_SYSF_REPLY flag set.
|
inline |
vCPU return from event handler.
The vCPU resume functionality is split in multiple functions to allow the specification of additional send-flex-pages using l4_sndfpage_add().
|
inline |
Yield current time slice.
Definition at line 778 of file thread.h.
References L4_INVALID_CAP, and l4_ipc_receive().