1/**
2 * \file
3 * \brief Architecture specific dispatcher struct shared between kernel and user
4 */
5
6/*
7 * Copyright (c) 2010, 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_ARM_BARRELFISH_KPI_DISPATCHER_SHARED_ARCH_H
16#define ARCH_ARM_BARRELFISH_KPI_DISPATCHER_SHARED_ARCH_H
17
18#include <target/arm/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_arm *disparm =
35        get_dispatcher_shared_arm(handle);
36    return disp->disabled ||
37        (disparm->crit_pc_low <= rip && rip < disparm->crit_pc_high);
38}
39
40static inline arch_registers_state_t*
41dispatcher_get_enabled_save_area(dispatcher_handle_t handle)
42{
43    return &((struct dispatcher_shared_arm *)handle)->enabled_save_area;
44}
45
46static inline arch_registers_state_t*
47dispatcher_get_disabled_save_area(dispatcher_handle_t handle)
48{
49    return &((struct dispatcher_shared_arm *)handle)->disabled_save_area;
50}
51
52static inline arch_registers_state_t*
53dispatcher_get_trap_save_area(dispatcher_handle_t handle)
54{
55    return &((struct dispatcher_shared_arm *)handle)->trap_save_area;
56}
57
58#endif // ARCH_ARM_BARRELFISH_KPI_DISPATCHER_SHARED_ARCH_H
59