L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
segment.h
Go to the documentation of this file.
1#include_next <l4/sys/segment.h>
2
8/*
9 * (c) 2011 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
10 * economic rights: Technische Universität Dresden (Germany)
11 *
12 * License: see LICENSE.spdx (in this directory or the directories above)
13 */
14#ifndef __L4_SYS__ARCH_AMD64__L4API_L4F__SEGMENT_H__
15#define __L4_SYS__ARCH_AMD64__L4API_L4F__SEGMENT_H__
16
17#include <l4/sys/compiler.h>
18
19/*****************************************************************************
20 *** Implementation
21 *****************************************************************************/
22
23L4_INLINE long
25{
27 l4_utcb_mr_u(utcb)->mr[1] = base;
28 return l4_error_u(l4_ipc_call(thread, utcb, l4_msgtag(L4_PROTO_THREAD, 2, 0, 0), L4_IPC_NEVER), utcb);
29}
30
31L4_INLINE long
33 l4_umword_t base, l4_utcb_t *utcb)
34{
35 l4_utcb_mr_u(utcb)->mr[0] = L4_THREAD_AMD64_SET_SEGMENT_BASE_OP | ((l4_umword_t)segr << 16);
36 l4_utcb_mr_u(utcb)->mr[1] = base;
37 return l4_error_u(l4_ipc_call(thread, utcb, l4_msgtag(L4_PROTO_THREAD, 2, 0, 0), L4_IPC_NEVER), utcb);
38}
39
40L4_INLINE long
41fiasco_gdt_set(l4_cap_idx_t thread, void *desc, unsigned int size,
42 unsigned int entry_number_start, l4_utcb_t *utcb)
43{
44 l4_utcb_mr_u(utcb)->mr[0] = L4_THREAD_X86_GDT_OP;
45 l4_utcb_mr_u(utcb)->mr[1] = entry_number_start;
46 __builtin_memcpy(&l4_utcb_mr_u(utcb)->mr[2], desc, size);
47 return l4_error_u(l4_ipc_call(thread, utcb, l4_msgtag(L4_PROTO_THREAD, 2 + (size / 8), 0, 0), L4_IPC_NEVER), utcb);
48}
49
50#endif /* ! __L4_SYS__ARCH_X86__L4API_L4F__SEGMENT_H__ */
L4_sys_segment
Constants for identifying segments.
Definition segment.h:107
@ L4_AMD64_SEGMENT_FS
Constant identifying the FS segment.
Definition segment.h:109
long fiasco_amd64_set_segment_base(l4_cap_idx_t thread, enum L4_sys_segment segr, l4_umword_t base, l4_utcb_t *utcb)
Set the base address for a segment.
Definition segment.h:32
long fiasco_amd64_set_fs(l4_cap_idx_t thread, l4_umword_t base, l4_utcb_t *utcb)
Set the base address for the FS segment.
Definition segment.h:24
L4 compiler related defines.
long fiasco_gdt_set(l4_cap_idx_t thread, void *desc, unsigned int size, unsigned int entry_number_start, l4_utcb_t *utcb)
Set GDT segment descriptors.
Definition segment.h:41
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:335
l4_msgtag_t l4_ipc_call(l4_cap_idx_t object, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW
Object call (usual invocation).
Definition ipc.h:565
l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items, unsigned flags) L4_NOTHROW
Create a message tag from the specified values.
Definition types.h:404
@ L4_PROTO_THREAD
Protocol for messages to a thread object.
Definition types.h:53
@ L4_THREAD_AMD64_SET_SEGMENT_BASE_OP
Set segment base.
Definition thread.h:723
@ L4_THREAD_X86_GDT_OP
Gdt.
Definition thread.h:721
#define L4_IPC_NEVER
never timeout
Definition __timeout.h:76
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:69