L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4::Thread::Attr Class Reference

Thread attributes used for control(). More...

#include <thread>

+ Collaboration diagram for L4::Thread::Attr:

Public Member Functions

 Attr (l4_utcb_t *utcb=l4_utcb()) noexcept
 Create a thread-attribute object with the given UTCB.
 
void pager (Cap< void > const &pager) noexcept
 Set the pager capability selector.
 
Cap< void > pager () noexcept
 Get the capability selector used for page-fault messages.
 
void exc_handler (Cap< void > const &exc_handler) noexcept
 Set the exception-handler capability selector.
 
Cap< void > exc_handler () noexcept
 Get the capability selector used for exception messages.
 
void bind (l4_utcb_t *thread_utcb, Cap< Task > const &task) noexcept
 Bind the thread to a task.
 
void alien (int on) noexcept
 Enable alien mode.
 
void ux_host_syscall (int on) noexcept
 Allow host system calls on Fiasco-UX.
 

Friends

class L4::Thread
 

Detailed Description

Thread attributes used for control().

This class is responsible for initializing various attributes of a thread in a UTCB for the control() method.

Note
Instantiation of this class starts the preparation of the UTCB. Do not invoke any non-Attr functions between the instantiation and the call to L4::Thread::control().
See also
Thread control for some more details.

Definition at line 141 of file thread.

Constructor & Destructor Documentation

◆ Attr()

L4::Thread::Attr::Attr ( l4_utcb_t utcb = l4_utcb())
inlineexplicitnoexcept

Create a thread-attribute object with the given UTCB.

Parameters
utcbThe UTCB to use for the later L4::Thread::control() function. Usually this is the UTCB of the calling thread. See l4_utcb().

Definition at line 155 of file thread.

Member Function Documentation

◆ alien()

void L4::Thread::Attr::alien ( int  on)
inlinenoexcept

Enable alien mode.

Parameters
onBoolean value defining the state of the feature.

For a thread in alien mode the kernel produces just an exception IPC for each IPC and exception caused by the alien thread instead of handling these events regularly. (Page faults of alien threads and interrupts occuring while the alien thread is running are always handled regularly.) While the alien thread is blocking, the execption handler can inspect and modify the state of the alien thread and potentially also the systemcall arguments. If the exception handler replies with L4_PROTO_ALLOW_SYSCALL as message tag, the kernel handles the next IPC or exception of the alien thread in a regular way. If the exception handler leaves certain thread state unchanged (in particular the instruction pointer), this will be the IPC or exception that caused the call of the exception handler. For a regularly processed IPC or exception of the alien thread the kernel also performs an exception IPC on kernel exit.

This feature can be used to attach a debugger to a thread and trace all object invocations and their results. It could also be used to handle other systems that use the same syscall instruction as L4Re.

Definition at line 223 of file thread.

◆ bind()

void L4::Thread::Attr::bind ( l4_utcb_t thread_utcb,
Cap< Task > const &  task 
)
inlinenoexcept

Bind the thread to a task.

Parameters
thread_utcbThe thread’s UTCB address within the task it shall be bound to. The address must be aligned (architecture dependent; at least word aligned) and it must point to at least L4_UTCB_OFFSET bytes of kernel-user memory.
taskThe task the thread shall be bound to.
Precondition
The thread must not be bound to a task yet.

A thread may execute code in the context of a task if and only if the thread is bound to the task. To actually start execution, L4::Thread::ex_regs() needs to be used. Execution in the context of the task means that the code has access to all the task’s resources (and only those). The executed code itself must be one of those resources. A thread can be bound at most once to a task.

Note
The UTCBs of different threads in the same task should not overlap in order to prevent data corruption.

Definition at line 217 of file thread.

◆ exc_handler() [1/2]

Cap< void > L4::Thread::Attr::exc_handler ( )
inlinenoexcept

Get the capability selector used for exception messages.

Returns
The capability selector used to send exception messages. The selector is valid in the task the thread is bound to.

Definition at line 193 of file thread.

Referenced by exc_handler().

+ Here is the caller graph for this function:

◆ exc_handler() [2/2]

void L4::Thread::Attr::exc_handler ( Cap< void > const &  exc_handler)
inlinenoexcept

Set the exception-handler capability selector.

Parameters
exc_handlerThe capability selector that shall be used for exception messages. This capability selector must be valid within the task the thread is bound to.

Definition at line 184 of file thread.

References exc_handler().

+ Here is the call graph for this function:

◆ pager() [1/2]

Cap< void > L4::Thread::Attr::pager ( )
inlinenoexcept

Get the capability selector used for page-fault messages.

Returns
The capability selector used to send page-fault messages. The selector is valid in the task the thread is bound to.

Definition at line 174 of file thread.

Referenced by pager().

+ Here is the caller graph for this function:

◆ pager() [2/2]

void L4::Thread::Attr::pager ( Cap< void > const &  pager)
inlinenoexcept

Set the pager capability selector.

Parameters
pagerThe capability selector that shall be used for page-fault messages. This capability selector must be valid within the task the thread is bound to.

Definition at line 165 of file thread.

References pager().

+ Here is the call graph for this function:

◆ ux_host_syscall()

void L4::Thread::Attr::ux_host_syscall ( int  on)
inlinenoexcept

Allow host system calls on Fiasco-UX.

Precondition
Running on Fiasco-UX.

Definition at line 231 of file thread.


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