L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
utcb.h
Go to the documentation of this file.
1/*****************************************************************************/
7/*
8 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
9 * Alexander Warg <warg@os.inf.tu-dresden.de>,
10 * Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
11 * economic rights: Technische Universität Dresden (Germany)
12 *
13 * License: see LICENSE.spdx (in this directory or the directories above)
14 */
15/*****************************************************************************/
16#ifndef _L4_SYS_UTCB_H
17#define _L4_SYS_UTCB_H
18
19#include <l4/sys/types.h>
20#include <l4/sys/compiler.h>
21#include <l4/sys/l4int.h>
22
47
56typedef struct l4_utcb_t l4_utcb_t;
57
58typedef struct l4_exc_regs_t l4_exc_regs_t;
59
65L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW L4_PURE;
66
75
85
90L4_INLINE unsigned long l4_utcb_exc_typeval(l4_exc_regs_t const *u) L4_NOTHROW L4_PURE;
91
102
108
120
121#include <l4/sys/arch/utcb.h>
122
127
132typedef union l4_msg_regs_t
133{
134 l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE];
135 l4_uint64_t mr64[L4_UTCB_GENERIC_DATA_SIZE / (sizeof(l4_uint64_t)/sizeof(l4_umword_t))];
137
147typedef struct l4_buf_regs_t
148{
151
153 l4_umword_t br[L4_UTCB_GENERIC_BUFFERS_SIZE];
155
190
192
203L4_CV l4_utcb_t *l4_utcb_wrap(void) L4_NOTHROW L4_PURE;
204
210
217
222L4_INLINE l4_msg_regs_t *l4_utcb_mr_u(l4_utcb_t *u) L4_NOTHROW L4_PURE;
223
231
236L4_INLINE l4_buf_regs_t *l4_utcb_br_u(l4_utcb_t *u) L4_NOTHROW L4_PURE;
237
244
249L4_INLINE l4_thread_regs_t *l4_utcb_tcr_u(l4_utcb_t *u) L4_NOTHROW L4_PURE;
250
256
264
269L4_INLINE l4_exc_regs_t *l4_utcb_exc_u(l4_utcb_t *u) L4_NOTHROW L4_PURE;
270
275L4_INLINE void l4_utcb_inherit_fpu(int switch_on) L4_NOTHROW;
276
280L4_INLINE void l4_utcb_inherit_fpu_u(l4_utcb_t *u, int switch_on) L4_NOTHROW;
281
297l4_timeout_s l4_timeout_abs_u(l4_kernel_clock_t pint, int br,
298 l4_utcb_t *utcb) L4_NOTHROW;
314
323unsigned l4_utcb_mr64_idx(unsigned idx) L4_NOTHROW;
324
325/**************************************************************************
326 * Implementations
327 **************************************************************************/
328
330{ return (l4_msg_regs_t*)((char*)u + L4_UTCB_MSG_REGS_OFFSET); }
331
333{ return (l4_buf_regs_t*)((char*)u + L4_UTCB_BUF_REGS_OFFSET); }
334
336{ return (l4_thread_regs_t*)((char*)u + L4_UTCB_THREAD_REGS_OFFSET); }
337
339{ return (l4_exc_regs_t*)((char*)u + L4_UTCB_MSG_REGS_OFFSET); }
340
341L4_INLINE void l4_utcb_inherit_fpu_u(l4_utcb_t *u, int switch_on) L4_NOTHROW
342{
343 if (switch_on)
344 l4_utcb_br_u(u)->bdr |= L4_UTCB_INHERIT_FPU;
345 else
346 l4_utcb_br_u(u)->bdr &= ~L4_UTCB_INHERIT_FPU;
347}
348
350{
351#ifdef L4SYS_USE_UTCB_WRAP
352 return l4_utcb_wrap();
353#else
354 return l4_utcb_direct();
355#endif
356}
357
358
359
360
362{ return l4_utcb_mr_u(l4_utcb()); }
363
365{ return l4_utcb_br_u(l4_utcb()); }
366
368{ return l4_utcb_tcr_u(l4_utcb()); }
369
371{ return l4_utcb_exc_u(l4_utcb()); }
372
374{ l4_utcb_inherit_fpu_u(l4_utcb(), switch_on); }
375
377l4_timeout_s l4_timeout_abs_u(l4_kernel_clock_t val, int pos,
378 l4_utcb_t *utcb) L4_NOTHROW
379{
380 union T
381 {
383 l4_umword_t m[sizeof(l4_kernel_clock_t)/sizeof(l4_umword_t)];
384 };
385 l4_timeout_s to;
386 to.t = 0x8000 | pos;
387 ((union T*)(l4_utcb_br_u(utcb)->br + pos))->t = val;
388 return to;
389}
390
393{ return l4_timeout_abs_u(val, pos, l4_utcb()); }
394
396{ return idx / (sizeof(l4_uint64_t) / sizeof(l4_umword_t)); }
397
399
400#endif /* ! _L4_SYS_UTCB_H */
L4 compiler related defines.
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
l4_uint64_t l4_kernel_clock_t
Kernel clock type.
Definition l4int.h:53
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition l4int.h:31
l4_timeout_s l4_timeout_abs(l4_kernel_clock_t pint, int br) L4_NOTHROW
Set an absolute timeout.
Definition utcb.h:392
unsigned l4_utcb_mr64_idx(unsigned idx) L4_NOTHROW
Get index into 64bit message registers alias from native-sized index.
Definition utcb.h:395
l4_msg_regs_t * l4_utcb_mr(void) L4_NOTHROW L4_PURE
Get the message-register block of a UTCB.
Definition utcb.h:361
l4_thread_regs_t * l4_utcb_tcr(void) L4_NOTHROW L4_PURE
Get the thread-control-register block of a UTCB.
Definition utcb.h:367
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:349
l4_buf_regs_t * l4_utcb_br(void) L4_NOTHROW L4_PURE
Get the buffer-register block of a UTCB.
Definition utcb.h:364
void l4_utcb_inherit_fpu(int switch_on) L4_NOTHROW
Enable or disable inheritance of FPU state to receiver.
Definition utcb.h:373
l4_addr_t l4_utcb_exc_pfa(l4_exc_regs_t const *u) L4_NOTHROW
Function to get the L4 style page fault address out of an exception.
Definition utcb.h:103
int l4_utcb_exc_is_ex_regs_exception(l4_exc_regs_t const *u) L4_NOTHROW
Check whether an exception IPC was triggered via l4_thread_ex_regs().
Definition utcb.h:108
l4_exc_regs_t * l4_utcb_exc(void) L4_NOTHROW L4_PURE
Get the message-register block of a UTCB (for an exception IPC).
Definition utcb.h:370
int l4_utcb_exc_is_pf(l4_exc_regs_t const *u) L4_NOTHROW
Check whether an exception IPC is a page fault.
Definition utcb.h:98
l4_umword_t l4_utcb_exc_pc(l4_exc_regs_t const *u) L4_NOTHROW
Access function to get the program counter of the exception state.
Definition utcb.h:83
l4_umword_t l4_utcb_exc_typeval(l4_exc_regs_t const *u) L4_NOTHROW
Get the value out of an exception UTCB that describes the type of exception.
Definition utcb.h:93
void l4_utcb_exc_pc_set(l4_exc_regs_t *u, l4_addr_t pc) L4_NOTHROW
Set the program counter register in the exception state.
Definition utcb.h:88
#define L4_CV
Define calling convention.
Definition linkage.h:33
#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
#define L4_BEGIN_DECLS
Start section with C types and functions.
Definition compiler.h:165
#define L4_END_DECLS
End section with C types and functions.
Definition compiler.h:166
Fixed sized integer types, generic version.
Common L4 ABI Data Types.
Encapsulation of the buffer-registers block in the UTCB.
Definition utcb.h:148
l4_umword_t br[L4_UTCB_GENERIC_BUFFERS_SIZE]
Buffer registers.
Definition utcb.h:153
l4_umword_t bdr
Buffer descriptor.
Definition utcb.h:150
UTCB structure for exceptions.
Definition utcb.h:28
l4_umword_t pc
pc
Definition utcb.h:36
Encapsulation of the thread-control-register block of the UTCB.
Definition utcb.h:165
l4_umword_t free_marker
Kernel free marker.
Definition utcb.h:185
l4_umword_t error
System call error code (see l4_ipc_tcr_error_t).
Definition utcb.h:171
l4_umword_t user[3]
User values (ignored and preserved by the kernel).
Definition utcb.h:188
Basic timeout specification.
Definition __timeout.h:40
l4_uint16_t t
timeout value
Definition __timeout.h:41
Encapsulation of the message-register block in the UTCB.
Definition utcb.h:133
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:134
l4_uint64_t mr64[L4_UTCB_GENERIC_DATA_SIZE/(sizeof(l4_uint64_t)/sizeof(l4_umword_t))]
Message registers 64bit alias.
Definition utcb.h:135