L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
utcb.h
Go to the documentation of this file.
1
6/*
7 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8 * Alexander Warg <warg@os.inf.tu-dresden.de>
9 * economic rights: Technische Universität Dresden (Germany)
10 *
11 * License: see LICENSE.spdx (in this directory or the directories above)
12 */
13#ifndef __L4_SYS__INCLUDE__ARCH_ARM__UTCB_H__
14#define __L4_SYS__INCLUDE__ARCH_ARM__UTCB_H__
15
16#include <l4/sys/types.h>
17
22
41
42#define L4_UTCB_EXCEPTION_REGS_SIZE (sizeof(l4_exc_regs_t) / sizeof(l4_umword_t))
43#define L4_UTCB_GENERIC_DATA_SIZE 63
44#define L4_UTCB_GENERIC_BUFFERS_SIZE 58
45
46#define L4_UTCB_MSG_REGS_OFFSET 0
47#define L4_UTCB_BUF_REGS_OFFSET (64 * sizeof(l4_umword_t))
48#define L4_UTCB_THREAD_REGS_OFFSET (123 * sizeof(l4_umword_t))
49
50#define L4_UTCB_INHERIT_FPU (1UL << 24)
51
52#define L4_UTCB_OFFSET 512
53
54/*
55 * ==================================================================
56 * Implementations.
57 */
58
59#ifdef __GNUC__
60L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW
61{
62# if defined(__ARM_ARCH) && __ARM_ARCH >= 7
63 l4_utcb_t *utcb;
64 __asm__ ("mrc p15, 0, %0, c13, c0, 2" : "=r" (utcb)); // TPIDRURW
65#else
66 register l4_utcb_t *utcb __asm__ ("r0");
67 __asm__ ("mov lr, pc \n"
68 "mvn pc, #0xff \n" // write 0xffffff00 to pc
69 : "=r"(utcb) : : "lr");
70#endif
71 return utcb;
72}
73#endif
74
76{
77 return u->pc;
78}
79
84
86{
87 return u->err >> 26;
88}
89
91{
92 return ((u->err >> 26) & 0x30) == 0x20;
93}
94
96{
97 return (u->pfa & ~7UL) | ((u->err >> 5) & 2);
98}
99
104
105#endif /* ! __L4_SYS__INCLUDE__ARCH_ARM__UTCB_H__ */
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
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
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_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.
UTCB structure for exceptions.
Definition utcb.h:28
l4_umword_t r[13]
registers
Definition utcb.h:32
l4_umword_t sp
stack pointer
Definition utcb.h:33
l4_umword_t pfa
page fault address
Definition utcb.h:29
l4_umword_t tpidrurw
Thread-ID register.
Definition utcb.h:39
l4_umword_t ulr
ulr
Definition utcb.h:34
l4_umword_t _dummy1
dummy
Definition utcb.h:35
l4_umword_t err
error code
Definition utcb.h:30
l4_umword_t tpidruro
Thread-ID register.
Definition utcb.h:38
l4_umword_t pc
pc
Definition utcb.h:36
l4_umword_t cpsr
cpsr
Definition utcb.h:37