L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
thread_group.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022-2025 Kernkonzept GmbH.
3 * Author(s): Adam Lackorzynski <adam@os.inf.tu-dresden.de>
4 * Frank Mehnert <frank.mehnert@kernkonzept.com>
5 *
6 * License: see LICENSE.spdx (in this directory or the directories above)
7 */
11#pragma once
12
13#include <l4/sys/types.h>
14#include <l4/sys/utcb.h>
15
34enum L4_thread_group_ops
35{
36 L4_THREAD_GROUP_ADD_OP = 2UL,
37 L4_THREAD_GROUP_REMOVE_OP = 3UL,
38};
39
40enum L4_thread_group_policy
41{
42 L4_THREAD_GROUP_POLICY_STRICT_CORE_LOCAL = 0,
43 L4_THREAD_GROUP_POLICY_SOFT_CORE_LOCAL = 1,
44};
45
55
60l4_thread_group_add_u(l4_cap_idx_t tg,
61 l4_cap_idx_t thread,
62 l4_utcb_t *utcb) L4_NOTHROW;
63
73
78l4_thread_group_remove_u(l4_cap_idx_t tg,
79 l4_cap_idx_t thread,
80 l4_utcb_t *utcb) L4_NOTHROW;
81
82
83/* IMPLEMENTATION -----------------------------------------------------------*/
84
85#include <l4/sys/ipc.h>
86
88l4_thread_group_add_u(l4_cap_idx_t tg,
89 l4_cap_idx_t thread,
91{
92 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
93 v->mr[0] = L4_THREAD_GROUP_ADD_OP;
94 v->mr[1] = l4_map_obj_control(0, 0);
95 v->mr[2] = l4_obj_fpage(thread, 0, L4_CAP_FPAGE_RWS).raw;
96 return l4_ipc_call(tg, utcb,
98}
99
101l4_thread_group_remove_u(l4_cap_idx_t tg,
102 l4_cap_idx_t thread,
103 l4_utcb_t *utcb) L4_NOTHROW
104{
105 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
106 v->mr[0] = L4_THREAD_GROUP_REMOVE_OP;
107 v->mr[1] = l4_map_obj_control(0, 0);
108 v->mr[2] = l4_obj_fpage(thread, 0, L4_CAP_FPAGE_RWS).raw;
109 return l4_ipc_call(tg, utcb,
111}
112
116{
117 return l4_thread_group_add_u(tg, thread, l4_utcb());
118}
119
123{
124 return l4_thread_group_remove_u(tg, thread, l4_utcb());
125}
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:336
l4_fpage_t l4_obj_fpage(l4_cap_idx_t obj, unsigned int order, unsigned char rights) L4_NOTHROW
Create a kernel-object flexpage.
Definition __l4_fpage.h:715
@ L4_CAP_FPAGE_RWS
Read, interface specific 'W', and 'S' rights for capability flexpages.
Definition __l4_fpage.h:206
l4_msgtag_t l4_ipc_call(l4_cap_idx_t object, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW
Object call (usual invocation).
Definition ipc.h:565
l4_umword_t l4_map_obj_control(l4_umword_t spot, unsigned grant) L4_NOTHROW
Create the first word for a map item that is a send item for the object space.
Definition __l4_fpage.h:749
l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items, unsigned flags) L4_NOTHROW
Create a message tag from the specified values.
Definition types.h:405
@ L4_PROTO_THREAD_GROUP
Protocol for messages to a thread group obj.
Definition types.h:51
l4_msgtag_t l4_thread_group_remove(l4_cap_idx_t tg, l4_cap_idx_t thread) L4_NOTHROW
Remove thread from a thread group.
l4_msgtag_t l4_thread_group_add(l4_cap_idx_t tg, l4_cap_idx_t thread) L4_NOTHROW
Add thread to a thread group.
#define L4_IPC_NEVER
never timeout
Definition __timeout.h:76
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:346
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:161
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
Common L4 ABI Data Types.
Message tag data structure.
Definition types.h:154
l4_umword_t raw
Raw value.
Definition __l4_fpage.h:78
Encapsulation of the message-register block in the UTCB.
Definition utcb.h:68
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:69