# L4Re Operating System Framework: amd64/l4/sys/segment.h File Reference

Loading...
Searching...
No Matches
segment.h File Reference
Base API » Fiasco extensions

Segment handling (AMD64). More...

`#include <l4/sys/ipc.h>`
`#include <l4/sys/task.h>`
`#include <l4/sys/thread.h>`
Include dependency graph for segment.h:

Go to the source code of this file.

## Enumerations

enum | L4_task_ldt_x86_consts { L4_TASK_LDT_X86_ENTRY_SIZE = 8 , L4_TASK_LDT_X86_MAX_ENTRIES }
| Contants for LDT handling. More...
enum | L4_sys_segment { L4_AMD64_SEGMENT_FS = 0 , L4_AMD64_SEGMENT_GS = 1 }
| Constants for identifying segments. More...

## Functions

long | fiasco_ldt_set (l4_cap_idx_t task, void *ldt, unsigned int num_desc, unsigned int entry_number_start, l4_utcb_t *utcb)
| Set LDT segments descriptors.
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.
unsigned | fiasco_gdt_get_entry_offset (l4_cap_idx_t thread, l4_utcb_t *utcb)
| Return the offset of the entry in the GDT.
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.
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.
long | fiasco_amd64_segment_info (l4_cap_idx_t thread, unsigned *user_ds, unsigned *user_cs, unsigned *user32_cs, l4_utcb_t *utcb)
| Get segment information.

## Detailed Description

Segment handling (AMD64).

Definition in file segment.h.

## Enumeration Type Documentation

## L4_sys_segment

enum L4_sys_segment

Constants for identifying segments.

Enumerator
L4_AMD64_SEGMENT_FS | Constant identifying the FS segment.
L4_AMD64_SEGMENT_GS | Constant identifying the GS segment.

Definition at line 106 of file segment.h.

## L4_task_ldt_x86_consts

enum L4_task_ldt_x86_consts

Contants for LDT handling.

Enumerator
L4_TASK_LDT_X86_ENTRY_SIZE | Size of an LDT entry.
L4_TASK_LDT_X86_MAX_ENTRIES | Maximum number of LDT entries that can be written with one call.

Definition at line 75 of file segment.h.

## Function Documentation

## fiasco_amd64_segment_info()

long fiasco_amd64_segment_info | ( | l4_cap_idx_t | thread,
|  | unsigned * | user_ds,
|  | unsigned * | user_cs,
|  | unsigned * | user32_cs,
|  | l4_utcb_t * | utcb )

inline

Get segment information.

Parameters

  [in] | thread | Thread to get info from.
  [out] | user_ds | DS segment selector.
  [out] | user_cs | 64-bit CS segment selector.
  [out] | user32_cs | 32-bit CS segment selector.
  | utcb | UTCB to be used for this operation, shall be the UTCB of the calling thread. See l4_utcb.

Returns
  System call error

Definition at line 175 of file segment.h.

References l4_ipc_call(), L4_IPC_NEVER, l4_msgtag(), L4_PROTO_THREAD, L4_THREAD_AMD64_GET_SEGMENT_INFO_OP, and l4_msg_regs_t::mr.

Here is the call graph for this function:

## fiasco_amd64_set_fs()

long fiasco_amd64_set_fs | ( | l4_cap_idx_t | thread,
|  | l4_umword_t | base,
|  | l4_utcb_t * | utcb )

inline

Set the base address for the FS segment.

Parameters

  thread | Thread for which the FS base address shall be modified.
  base | Base address.
  utcb | UTCB to be used for this operation, shall be the UTCB of the calling thread. See l4_utcb.

Return values

  L4_EOK | Success.
  -L4_EINVAL | Invalid base address (`base`).
  -L4_ENOSYS | Operation not supported with current kernel configuration.

Note
  Calling this function is equivalent to calling fiasco_amd64_set_segment_base(thread, L4_AMD64_SEGMENT_FS, base, utcb).

Definition at line 24 of file segment.h.

References L4_AMD64_SEGMENT_FS, l4_ipc_call(), L4_IPC_NEVER, l4_msgtag(), L4_PROTO_THREAD, and L4_THREAD_AMD64_SET_SEGMENT_BASE_OP.

Here is the call graph for this function:

## fiasco_amd64_set_segment_base()

long fiasco_amd64_set_segment_base | ( | l4_cap_idx_t | thread,
|  | enum L4_sys_segment | segr,
|  | l4_umword_t | base,
|  | l4_utcb_t * | utcb )

inline

Set the base address for a segment.

Parameters

  thread | Thread for which the base address of the selected segment shall be modified.
  segr | Segment to modify (one of L4_sys_segment).
  base | Base address.
  utcb | UTCB to be used for this operation, shall be the UTCB of the calling thread. See l4_utcb.

Return values

  L4_EOK | Success.
  -L4_EINVAL | Invalid segment (`segr`) or base address (`base`).
  -L4_ENOSYS | Operation not supported with current kernel configuration.

Definition at line 32 of file segment.h.

References l4_ipc_call(), L4_IPC_NEVER, l4_msgtag(), L4_PROTO_THREAD, and L4_THREAD_AMD64_SET_SEGMENT_BASE_OP.

Here is the call graph for this function: