1/**
2 * \file
3 * \brief Architecture specific dispatcher struct shared between kernel and user
4 */
5
6/*
7 * Copyright (c) 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 ARCH_X86_32_BARRELFISH_KPI_DISPATCHER_SHARED_ARCH_H
16#define ARCH_X86_32_BARRELFISH_KPI_DISPATCHER_SHARED_ARCH_H
17
18#include <target/x86_32/barrelfish_kpi/dispatcher_shared_target.h>
19
20/**
21 * \brief Returns whether dispatcher is currently disabled, given IP.
22 *
23 * \param disp  Pointer to dispatcher
24 * \param ip    User-level instruction pointer.
25 *
26 * \return true if dispatcher disabled, false otherwise.
27 */
28static inline bool dispatcher_is_disabled_ip(dispatcher_handle_t handle,
29                                             uintptr_t rip)
30{
31    struct dispatcher_shared_generic *disp =
32        get_dispatcher_shared_generic(handle);
33    /* one crit_pc pair */
34    struct dispatcher_shared_x86_32 *disp32 =
35        get_dispatcher_shared_x86_32(handle);
36    return disp->disabled ||
37        (disp32->crit_pc_low <= rip && rip < disp32->crit_pc_high);
38}
39
40static inline arch_registers_state_t*
41dispatcher_get_enabled_save_area(dispatcher_handle_t handle)
42{
43    return dispatcher_x86_32_get_enabled_save_area(handle);
44}
45
46static inline arch_registers_state_t*
47dispatcher_get_disabled_save_area(dispatcher_handle_t handle)
48{
49    return dispatcher_x86_32_get_disabled_save_area(handle);
50}
51
52static inline arch_registers_state_t*
53dispatcher_get_trap_save_area(dispatcher_handle_t handle)
54{
55    return dispatcher_x86_32_get_trap_save_area(handle);
56}
57
58static inline arch_registers_fpu_state_t*
59dispatcher_get_enabled_fpu_save_area(dispatcher_handle_t handle)
60{
61    return dispatcher_x86_32_get_enabled_fpu_save_area(handle);
62}
63
64static inline arch_registers_fpu_state_t*
65dispatcher_get_disabled_fpu_save_area(dispatcher_handle_t handle)
66{
67    return dispatcher_x86_32_get_disabled_fpu_save_area(handle);
68}
69
70#endif // ARCH_X86_32_BARRELFISH_KPI_DISPATCHER_SHARED_ARCH_H
71