1/**
2 * \file
3 * \brief Dispatcher architecture-specific code
4 */
5
6/*
7 * Copyright (c) 2007, 2008, 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, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#ifndef ARCH_ARM_BARRELFISH_CURDISPATCHER_H
16#define ARCH_ARM_BARRELFISH_CURDISPATCHER_H
17
18#include <barrelfish_kpi/dispatcher_handle.h>
19
20//
21// Helpers for pasting #defined values into inline assembler.
22//
23#define STR(x) #x
24#define XTR(x) STR(x)
25
26/**
27 * \brief Returns pointer to current dispatcher, using thread register
28 */
29static inline dispatcher_handle_t curdispatcher(void)
30{
31    dispatcher_handle_t ret = 0;
32    __asm("mrc p15, 0, %[ret], c13, c0, 3" : [ret] "=r" (ret));
33    return ret;
34}
35
36#endif // ARCH_ARM_BARRELFISH_CURDISPATCHER_H
37