3 * \brief UTCB definitions for ARM.
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)
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.
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.
24 #ifndef __L4_SYS__INCLUDE__ARCH_ARM__UTCB_H__
25 #define __L4_SYS__INCLUDE__ARCH_ARM__UTCB_H__
27 #include <l4/sys/types.h>
30 * \defgroup l4_utcb_api_arm ARM Virtual Registers (UTCB)
31 * \ingroup l4_utcb_api
35 * \brief UTCB constants for ARM
36 * \ingroup l4_utcb_api_arm
39 enum L4_utcb_consts_arm
41 L4_UTCB_EXCEPTION_REGS_SIZE = 21,
42 L4_UTCB_GENERIC_DATA_SIZE = 63,
43 L4_UTCB_GENERIC_BUFFERS_SIZE = 58,
45 L4_UTCB_MSG_REGS_OFFSET = 0,
46 L4_UTCB_BUF_REGS_OFFSET = 64 * sizeof(l4_umword_t),
47 L4_UTCB_THREAD_REGS_OFFSET = 123 * sizeof(l4_umword_t),
49 L4_UTCB_INHERIT_FPU = 1UL << 24,
55 * \brief UTCB structure for exceptions.
56 * \ingroup l4_utcb_api_arm
58 typedef struct l4_exc_regs_t
60 l4_umword_t pfa; /**< page fault address */
61 l4_umword_t err; /**< error code */
63 l4_umword_t tpidruro;/**< Thread-ID register */
64 l4_umword_t r[13]; /**< registers */
65 l4_umword_t sp; /**< stack pointer */
66 l4_umword_t ulr; /**< ulr */
67 l4_umword_t _dummy1; /**< dummy \internal */
68 l4_umword_t pc; /**< pc */
69 l4_umword_t cpsr; /**< cpsr */
72 #include_next <l4/sys/utcb.h>
75 * ==================================================================
80 L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW
82 register l4_utcb_t *utcb __asm__ ("r0");
83 __asm__ ("mov lr, pc \n"
84 "mov pc, #0xffffff00 \n"
85 : "=r"(utcb) : : "lr");
90 L4_INLINE l4_umword_t l4_utcb_exc_pc(l4_exc_regs_t *u) L4_NOTHROW
95 L4_INLINE void l4_utcb_exc_pc_set(l4_exc_regs_t *u, l4_addr_t pc) L4_NOTHROW
100 L4_INLINE l4_umword_t l4_utcb_exc_typeval(l4_exc_regs_t *u) L4_NOTHROW
105 L4_INLINE int l4_utcb_exc_is_pf(l4_exc_regs_t *u) L4_NOTHROW
107 return ((u->err >> 26) & 0x30) == 0x20;
110 L4_INLINE l4_addr_t l4_utcb_exc_pfa(l4_exc_regs_t *u) L4_NOTHROW
112 return (u->pfa & ~7) | ((u->err >> 5) & 2);
115 #endif /* ! __L4_SYS__INCLUDE__ARCH_ARM__UTCB_H__ */