1/** 2 * \file 3 * \brief Implementation of curdispatcher 4 */ 5 6/* 7 * Copyright (c) 2007, 2008, 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, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. 13 */ 14 15#ifndef ARCH_X86_64_BARRELFISH_CURDISPATCHER_H 16#define ARCH_X86_64_BARRELFISH_CURDISPATCHER_H 17 18/** 19 * \brief Returns pointer to current dispatcher, using thread register 20 */ 21static inline dispatcher_handle_t curdispatcher(void) 22{ 23 dispatcher_handle_t ret; 24 25 __asm("movq %%fs:8, %[ret]" // XXX: assume offsetof(struct thread, disp) == 8 26 : [ret] "=r" (ret)); 27 28 return ret; 29} 30 31#endif // ARCH_X86_64_BARRELFISH_CURDISPATCHER_H 32