L4Re - L4 Runtime Environment
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 /*****************************************************************************/
25 #ifndef __L4_SYS__INCLUDE__ARCH_AMD64__UTCB_H__
26 #define __L4_SYS__INCLUDE__ARCH_AMD64__UTCB_H__
27 
28 #include <l4/sys/types.h>
29 
40 {
44 
46  L4_UTCB_BUF_REGS_OFFSET = 64 * sizeof(l4_umword_t),
48 
49  L4_UTCB_INHERIT_FPU = 1UL << 24,
50  L4_UTCB_OFFSET = 1024,
51 };
52 
57 typedef struct l4_exc_regs_t
58 {
81  l4_umword_t sp;
83  l4_umword_t fs_base;
84  l4_umword_t gs_base;
85  l4_uint16_t ds, es, fs, gs;
87 
88 
89 #include_next <l4/sys/utcb.h>
90 
91 /*
92  * ==================================================================
93  * Implementations.
94  */
95 
96 L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW
97 {
98  l4_utcb_t *res;
99  __asm__ ( "mov %%gs:0, %0 \n" : "=r"(res));
100  return res;
101 }
102 
104 {
105  return u->ip;
106 }
107 
109 {
110  u->ip = pc;
111 }
112 
114 {
115  return u->trapno;
116 }
117 
119 {
120  return u->trapno == 14;
121 }
122 
124 {
125  return (u->pfa & ~7UL) | (u->err & 2);
126 }
127 
129 {
130  return l4_utcb_exc_typeval(u) == 0xff;
131 }
132 
133 #endif /* ! __L4_SYS__INCLUDE__ARCH_AMD64__UTCB_H__ */
Total number of message register (MRs) available.
Definition: utcb.h:47
l4_umword_t sp
stack pointer
Definition: utcb.h:44
l4_umword_t dummy1
dummy
Definition: utcb.h:79
L4_utcb_consts_amd64
UTCB constants for AMD64.
Definition: utcb.h:39
int l4_utcb_exc_is_pf(l4_exc_regs_t const *u) L4_NOTHROW L4_PURE
Check whether an exception IPC is a page fault.
Definition: utcb.h:105
l4_umword_t trapno
trap number
Definition: utcb.h:76
l4_umword_t flags
rflags
Definition: utcb.h:80
int l4_utcb_exc_is_ex_regs_exception(l4_exc_regs_t const *u) L4_NOTHROW L4_PURE
Check whether an exception IPC was triggered via l4_thread_ex_regs().
Definition: utcb.h:115
l4_umword_t rdi
rdi
Definition: utcb.h:67
l4_umword_t r15
r15
Definition: utcb.h:59
unsigned short int l4_uint16_t
Unsigned 16bit value.
Definition: l4int.h:38
Common L4 ABI Data Types.
l4_umword_t err
error code
Definition: utcb.h:41
l4_umword_t ip
instruction pointer
Definition: utcb.h:78
l4_umword_t rsi
rsi
Definition: utcb.h:68
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition: utcb.h:67
BDR flag to accept reception of FPU state.
Definition: utcb.h:62
unsigned long l4_utcb_exc_typeval(l4_exc_regs_t const *u) L4_NOTHROW L4_PURE
Get the value out of an exception UTCB that describes the type of exception.
Definition: utcb.h:100
l4_umword_t rbp
rbp
Definition: utcb.h:69
l4_umword_t r14
r14
Definition: utcb.h:60
Number if message registers used for exception IPC.
Definition: utcb.h:44
Offset of MR[0] relative to the UTCB pointer.
Definition: utcb.h:53
l4_umword_t rdx
rdx
Definition: utcb.h:72
Total number of buffer registers (BRs) available.
Definition: utcb.h:50
l4_umword_t pc
pc
Definition: utcb.h:47
l4_umword_t rax
rax
Definition: utcb.h:74
l4_umword_t r12
r12
Definition: utcb.h:62
struct l4_exc_regs_t l4_exc_regs_t
UTCB structure for exceptions.
unsigned long l4_umword_t
Unsigned machine word.
Definition: l4int.h:52
l4_addr_t l4_utcb_exc_pfa(l4_exc_regs_t const *u) L4_NOTHROW L4_PURE
Function to get the L4 style page fault address out of an exception.
Definition: utcb.h:110
l4_umword_t rbx
rbx
Definition: utcb.h:71
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:95
Offset of BR[0] relative to the UTCB pointer.
Definition: utcb.h:56
Offset of TCR[0] relative to the UTCB pointer.
Definition: utcb.h:59
l4_umword_t pfa
page fault address
Definition: utcb.h:40
l4_umword_t ss
stack segment register
Definition: utcb.h:82
l4_umword_t r8
r8
Definition: utcb.h:66
Offset of two consecutive UTCBs.
Definition: utcb.h:65
UTCB structure for exceptions.
Definition: utcb.h:38
l4_umword_t r10
r10
Definition: utcb.h:64
unsigned long l4_addr_t
Address type.
Definition: l4int.h:45
l4_umword_t r9
r9
Definition: utcb.h:65
l4_umword_t r11
r11
Definition: utcb.h:63
l4_umword_t rcx
rcx
Definition: utcb.h:73
l4_umword_t l4_utcb_exc_pc(l4_exc_regs_t const *u) L4_NOTHROW L4_PURE
Access function to get the program counter of the exception state.
Definition: utcb.h:90
l4_umword_t r13
r13
Definition: utcb.h:61
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition: compiler.h:185