1/**
2 * \file
3 * \brief Architecture specific dispatcher struct shared between kernel and user
4 */
5
6/*
7 * Copyright (c) 2007, 2008, 2009, 2010, 2011, ETH Zurich.
8 * All rights reserved.
9 *
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#ifndef TARGET_X86_64_BARRELFISH_KPI_DISPATCHER_SHARED_H
16#define TARGET_X86_64_BARRELFISH_KPI_DISPATCHER_SHARED_H
17
18#include <barrelfish_kpi/dispatcher_shared.h>
19
20///< Architecture specific kernel/user shared dispatcher struct
21struct dispatcher_shared_x86_64 {
22    struct dispatcher_shared_generic d; ///< Generic portion
23
24    lvaddr_t    crit_pc_low;        ///< Critical section lower PC bound
25    lvaddr_t    crit_pc_high;       ///< Critical section upper PC bound
26
27    lvaddr_t    ldt_base;           ///< Base address of local descriptor table (LDT)
28    size_t      ldt_npages;         ///< Size of local descriptor table (# 4k pages)
29
30    struct registers_x86_64 enabled_save_area;  ///< Enabled register save area
31    struct registers_x86_64 disabled_save_area; ///< Disabled register save area
32    struct registers_x86_64 trap_save_area;     ///< Trap register save area
33};
34
35static inline struct dispatcher_shared_x86_64*
36get_dispatcher_shared_x86_64(dispatcher_handle_t handle)
37{
38    return (struct dispatcher_shared_x86_64*)handle;
39}
40
41static inline struct registers_x86_64*
42dispatcher_x86_64_get_enabled_save_area(dispatcher_handle_t handle)
43{
44    struct dispatcher_shared_x86_64 *disp =
45        get_dispatcher_shared_x86_64(handle);
46    return &disp->enabled_save_area;
47}
48
49static inline struct registers_x86_64*
50dispatcher_x86_64_get_disabled_save_area(dispatcher_handle_t handle)
51{
52    struct dispatcher_shared_x86_64 *disp =
53        get_dispatcher_shared_x86_64(handle);
54    return &disp->disabled_save_area;
55}
56
57static inline struct registers_x86_64*
58dispatcher_x86_64_get_trap_save_area(dispatcher_handle_t handle)
59{
60    struct dispatcher_shared_x86_64 *disp =
61        get_dispatcher_shared_x86_64(handle);
62    return &disp->trap_save_area;
63}
64
65#endif // TARGET_X86_64_BARRELFISH_KPI_DISPATCHER_SHARED_H
66