1 /**
2 * \file
3 * \brief UTCB definitions for Sparc.
4 * \ingroup l4_utcb_api
5 */
6 /*
7 * (c) 2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
8 * Björn Döbel <doebel@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_SPARC__UTCB_H__
25 #define __L4_SYS__INCLUDE__ARCH_SPARC__UTCB_H__
26
27 #include <l4/sys/types.h>
28
29 /**
30 * \defgroup l4_utcb_api_arm SPARC Virtual Registers (UTCB)
31 * \ingroup l4_utcb_api
32 */
33
34 /**
35 * \brief UTCB constants for SPARC
36 * \ingroup l4_utcb_api_arm
37 * \hideinitializer
38 */
39 enum L4_utcb_consts_sparc
40 {
41 L4_UTCB_EXCEPTION_REGS_SIZE = 39,
42 L4_UTCB_GENERIC_DATA_SIZE = 63,
43 L4_UTCB_GENERIC_BUFFERS_SIZE = 58,
44
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),
48
49 L4_UTCB_INHERIT_FPU = 1UL << 24,
50
51 L4_UTCB_OFFSET = 512,
52 };
53
54 /**
55 * \brief UTCB structure for exceptions.
56 * \ingroup l4_utcb_api_arm
57 */
58 typedef struct l4_exc_regs_t
59 {
60 l4_umword_t pfa; /**< page fault address */
61 l4_umword_t err; /**< error code */
62
63 l4_umword_t r[30]; /**< G0-7, I0-8, L0-7, O0-7 */
64 l4_umword_t sp; /**< O6 */
65 l4_umword_t o7;
66 l4_umword_t trapno;
67 l4_umword_t ip;
68 } l4_exc_regs_t;
69
70 #include_next <l4/sys/utcb.h>
71
72 /*
73 * ==================================================================
74 * Implementations.
75 */
76
77 #ifdef __GNUC__
l4_utcb_direct(void)78 L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW
79 {
80 l4_utcb_t *utcb = 0;
81
82 return utcb;
83 }
84 #endif
85
l4_utcb_exc_pc(l4_exc_regs_t const * u)86 L4_INLINE l4_umword_t l4_utcb_exc_pc(l4_exc_regs_t const *u) L4_NOTHROW
87 {
88 return u->ip;
89 }
90
l4_utcb_exc_pc_set(l4_exc_regs_t * u,l4_addr_t pc)91 L4_INLINE void l4_utcb_exc_pc_set(l4_exc_regs_t *u, l4_addr_t pc) L4_NOTHROW
92 {
93 u->ip = pc;
94 }
95
l4_utcb_exc_typeval(l4_exc_regs_t const * u)96 L4_INLINE l4_umword_t l4_utcb_exc_typeval(l4_exc_regs_t const *u) L4_NOTHROW
97 {
98 return u->trapno;
99 }
100
l4_utcb_exc_is_pf(l4_exc_regs_t const * u)101 L4_INLINE int l4_utcb_exc_is_pf(l4_exc_regs_t const *u) L4_NOTHROW
102 {
103 (void)u;
104 return 0;
105 }
106
l4_utcb_exc_pfa(l4_exc_regs_t const * u)107 L4_INLINE l4_addr_t l4_utcb_exc_pfa(l4_exc_regs_t const *u) L4_NOTHROW
108 {
109 return (u->pfa & ~7ul) | 0; /* TODO: Add u->err & xx */
110 }
111
l4_utcb_exc_is_ex_regs_exception(l4_exc_regs_t const * u)112 L4_INLINE int l4_utcb_exc_is_ex_regs_exception(l4_exc_regs_t const *u) L4_NOTHROW
113 {
114 // ex_regs trigger exception not implemented.
115 (void)u;
116 return 0;
117 }
118
119 #endif /* ! __L4_SYS__INCLUDE__ARCH_SPARC__UTCB_H__ */
120