API for Thread Control method.
More...
API for Thread Control method.
The thread control API provides access to almost any parameter of a thread object. The API is based on a single invocation of the thread object. However, because of the huge amount of parameters, the API provides a set of functions to set specific parameters of a thread and a commit function to commit the thread control call (see l4_thread_control_commit()).
A thread control operation must always start with l4_thread_control_start() and be committed with l4_thread_control_commit(). All other thread control parameter setter functions must be called between these two functions.
An example for a sequence of thread control API calls can be found below.
l4_utcb_t *u = l4_utcb();
l4_thread_control_start(u);
l4_thread_control_pager(u, pager_cap);
l4_thread_control_bind (u, thread_utcb, task);
l4_thread_control_commit(u, thread_cap);
◆ l4_thread_control_alien()
void l4_thread_control_alien |
( |
int |
on | ) |
|
|
inline |
Enable alien mode.
- Parameters
-
on | Boolean value defining the state of the feature. |
Alien mode means the thread is not allowed to invoke L4 kernel objects directly and it is also not allowed to allocate FPU state. All those operations result in an exception IPC that gets sent through the pager capability. The responsible pager can then selectively allow an object invocation or allocate FPU state for the thread.
This feature can be used to attach a debugger to a thread and trace all object invocations.
- Examples
- examples/sys/aliens/main.c, and examples/sys/singlestep/main.c.
Definition at line 877 of file thread.h.
◆ l4_thread_control_bind()
Bind the thread to a task.
- Parameters
-
thread_utcb | The 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. |
task | The task the thread shall be bound to. |
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.
- Note
- The UTCBs of different threads in the same task should not overlap in order to prevent data corruption.
- Examples
- examples/sys/aliens/main.c, examples/sys/singlestep/main.c, examples/sys/start-with-exc/main.c, and examples/sys/utcb-ipc/main.c.
Definition at line 871 of file thread.h.
◆ l4_thread_control_commit()
◆ l4_thread_control_exc_handler()
void l4_thread_control_exc_handler |
( |
l4_cap_idx_t |
exc_handler | ) |
|
|
inline |
◆ l4_thread_control_pager()
◆ l4_thread_control_start()
void l4_thread_control_start |
( |
void |
| ) |
|
|
inline |
◆ l4_thread_control_ux_host_syscall()
void l4_thread_control_ux_host_syscall |
( |
int |
on | ) |
|
|
inline |
Enable pass through of native host (Linux) system calls.
- Parameters
-
on | Boolean value defining the state of the feature. |
- Precondition
- Running on Fiasco-UX
This enables the thread to do host system calls. This feature is only available in Fiasco-UX and ignored in other environments.
Definition at line 883 of file thread.h.