Loading...
Searching...
No Matches
utcb.h
Go to the documentation of this file.
/*****************************************************************************/
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
/*****************************************************************************/
#ifndef __L4_SYS__INCLUDE__ARCH_X86__UTCB_H__
#define __L4_SYS__INCLUDE__ARCH_X86__UTCB_H__
#include <l4/sys/types.h>
enum L4_utcb_consts_x86
{
L4_UTCB_EXCEPTION_REGS_SIZE = 19,
L4_UTCB_GENERIC_DATA_SIZE = 63,
L4_UTCB_GENERIC_BUFFERS_SIZE = 58,
L4_UTCB_MSG_REGS_OFFSET = 0,
L4_UTCB_BUF_REGS_OFFSET = 64 * sizeof(l4_umword_t),
L4_UTCB_THREAD_REGS_OFFSET = 123 * sizeof(l4_umword_t),
L4_UTCB_INHERIT_FPU = 1UL << 24,
L4_UTCB_OFFSET = 512,
};
typedef struct l4_exc_regs_t
{
l4_umword_t es;
l4_umword_t ds;
l4_umword_t gs;
l4_umword_t fs;
l4_umword_t edi;
l4_umword_t esi;
l4_umword_t ebp;
l4_umword_t pfa;
l4_umword_t ebx;
l4_umword_t edx;
l4_umword_t ecx;
l4_umword_t eax;
l4_umword_t trapno;
l4_umword_t err;
l4_umword_t ip;
l4_umword_t dummy1;
l4_umword_t flags;
l4_umword_t sp;
l4_umword_t ss;
} l4_exc_regs_t;
#include_next <l4/sys/utcb.h>
/*
* ==================================================================
* Implementations.
*/
L4_INLINE l4_utcb_t *l4_utcb_direct(void) L4_NOTHROW
{
l4_utcb_t *utcb;
__asm__ ("mov %%fs:0, %0" : "=r" (utcb));
return utcb;
}
L4_INLINE l4_umword_t l4_utcb_exc_pc(l4_exc_regs_t const *u) L4_NOTHROW
{
return u->ip;
}
L4_INLINE void l4_utcb_exc_pc_set(l4_exc_regs_t *u, l4_addr_t pc) L4_NOTHROW
{
u->ip = pc;
}
L4_INLINE void l4_utcb_exc_sp_set(l4_exc_regs_t *u, l4_addr_t sp) L4_NOTHROW
{
u->sp = sp;
}
L4_INLINE l4_umword_t l4_utcb_exc_typeval(l4_exc_regs_t const *u) L4_NOTHROW
{
return u->trapno;
}
L4_INLINE int l4_utcb_exc_is_pf(l4_exc_regs_t const *u) L4_NOTHROW
{
return u->trapno == 14;
}
L4_INLINE l4_addr_t l4_utcb_exc_pfa(l4_exc_regs_t const *u) L4_NOTHROW
{
return (u->pfa & ~7UL) | (u->err & 2);
}
L4_INLINE int l4_utcb_exc_is_ex_regs_exception(l4_exc_regs_t const *u) L4_NOTHROW
{
return l4_utcb_exc_typeval(u) == 0xff;
}
#endif /* ! __L4_SYS__INCLUDE__ARCH_X86__UTCB_H__ */
l4_umword_t
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
l4_addr_t
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
L4_utcb_consts_x86
L4_utcb_consts_x86
UTCB constants for x86.
Definition utcb.h:31
l4_utcb_t
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
l4_utcb_exc_pfa
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:112
l4_utcb_exc_is_ex_regs_exception
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:117
l4_utcb_exc_is_pf
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:107
l4_utcb_exc_pc
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:92
l4_utcb_exc_typeval
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:102
l4_utcb_exc_pc_set
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:97
L4_NOTHROW
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:161
L4_INLINE
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
types.h
Common L4 ABI Data Types.
l4_exc_regs_t
UTCB structure for exceptions.
Definition utcb.h:28
l4_exc_regs_t::trapno
l4_umword_t trapno
trap number
Definition utcb.h:65
l4_exc_regs_t::sp
l4_umword_t sp
stack pointer
Definition utcb.h:33
l4_exc_regs_t::ss
l4_umword_t ss
stack segment register
Definition utcb.h:71
l4_exc_regs_t::pfa
l4_umword_t pfa
page fault address
Definition utcb.h:29
l4_exc_regs_t::ip
l4_umword_t ip
instruction pointer
Definition utcb.h:36
l4_exc_regs_t::flags
l4_umword_t flags
rflags
Definition utcb.h:37
l4_exc_regs_t::dummy1
l4_umword_t dummy1
dummy
Definition utcb.h:68
l4_exc_regs_t::edx
l4_umword_t edx
edx register
Definition utcb.h:73
l4_exc_regs_t::err
l4_umword_t err
error code
Definition utcb.h:30
l4_exc_regs_t::esi
l4_umword_t esi
esi register
Definition utcb.h:69
l4_exc_regs_t::ebp
l4_umword_t ebp
ebp register
Definition utcb.h:70
l4_exc_regs_t::eax
l4_umword_t eax
eax register
Definition utcb.h:75
l4_exc_regs_t::ecx
l4_umword_t ecx
ecx register
Definition utcb.h:74
l4_exc_regs_t::ebx
l4_umword_t ebx
ebx register
Definition utcb.h:72
l4_exc_regs_t::edi
l4_umword_t edi
edi register
Definition utcb.h:68