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 * This file is part of TUD:OS and distributed under the terms of the
12 * GNU General Public License 2.
13 * Please see the COPYING-GPL-2 file for details.
14 *
15 * As a special exception, you may use this file as part of a free software
16 * library without restriction. Specifically, if other files instantiate
17 * templates or use macros or inline functions from this file, or you compile
18 * this file and link it with other files to produce an executable, this
19 * file does not by itself cause the resulting executable to be covered by
20 * the GNU General Public License. This exception does not however
21 * invalidate any other reasons why the executable file might be covered by
22 * the GNU General Public License.
23 */
24#ifndef __L4_SYS__INCLUDE__ARCH_ARM__UTCB_H__
25#define __L4_SYS__INCLUDE__ARCH_ARM__UTCB_H__
26
27#include <l4/sys/types.h>
28
52
59{
60 L4_UTCB_EXCEPTION_REGS_SIZE = sizeof(l4_exc_regs_t) / sizeof(l4_umword_t),
61 L4_UTCB_GENERIC_DATA_SIZE = 63,
62 L4_UTCB_GENERIC_BUFFERS_SIZE = 58,
63
64 L4_UTCB_MSG_REGS_OFFSET = 0,
65 L4_UTCB_BUF_REGS_OFFSET = 64 * sizeof(l4_umword_t),
66 L4_UTCB_THREAD_REGS_OFFSET = 123 * sizeof(l4_umword_t),
67
68 L4_UTCB_INHERIT_FPU = 1UL << 24,
69
70 L4_UTCB_OFFSET = 512,
71};
72
73#include_next <l4/sys/utcb.h>
74
75/*
76 * ==================================================================
77 * Implementations.
78 */
79
80#ifdef __GNUC__
81L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW
82{
83# if defined(__ARM_ARCH) && __ARM_ARCH >= 7
84 l4_utcb_t *utcb;
85 __asm__ ("mrc p15, 0, %0, c13, c0, 2" : "=r" (utcb)); // TPIDRURW
86#else
87 register l4_utcb_t *utcb __asm__ ("r0");
88 __asm__ ("mov lr, pc \n"
89 "mvn pc, #0xff \n" // write 0xffffff00 to pc
90 : "=r"(utcb) : : "lr");
91#endif
92 return utcb;
93}
94#endif
95
97{
98 return u->pc;
99}
100
102{
103 u->pc = pc;
104}
105
107{
108 return u->err >> 26;
109}
110
112{
113 return ((u->err >> 26) & 0x30) == 0x20;
114}
115
117{
118 return (u->pfa & ~7UL) | ((u->err >> 5) & 2);
119}
120
125
126#endif /* ! __L4_SYS__INCLUDE__ARCH_ARM__UTCB_H__ */
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:51
unsigned long l4_addr_t
Address type.
Definition l4int.h:45
struct l4_exc_regs_t l4_exc_regs_t
UTCB structure for exceptions.
L4_utcb_consts_arm
UTCB constants for ARM.
Definition utcb.h:59
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:67
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:123
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:128
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:118
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:103
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:113
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:108
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:188
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:62
Common L4 ABI Data Types.
UTCB structure for exceptions.
Definition utcb.h:39
l4_umword_t sp
stack pointer
Definition utcb.h:44
l4_umword_t pfa
page fault address
Definition utcb.h:40
l4_umword_t tpidrurw
Thread-ID register.
Definition utcb.h:50
l4_umword_t ulr
ulr
Definition utcb.h:45
l4_umword_t r[13]
registers
Definition utcb.h:43
l4_umword_t _dummy1
dummy
Definition utcb.h:46
l4_umword_t err
error code
Definition utcb.h:41
l4_umword_t tpidruro
Thread-ID register.
Definition utcb.h:49
l4_umword_t pc
pc
Definition utcb.h:47
l4_umword_t cpsr
cpsr
Definition utcb.h:48