1/** 2 * \file 3 * \brief Miscellaneous architecture-specific functions 4 */ 5 6/* 7 * Copyright (c) 2008, 2009, 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_MISC_H 16#define ARCH_MISC_H 17 18#include <x86.h> 19#include <irq.h> 20 21void maybe_reload_ldt(struct dcb *dcb, bool force_reload); 22 23/** 24 * \brief Set thread-local-storage register. 25 */ 26static inline void arch_set_thread_register(uintptr_t val) 27{ 28 panic("shouldn't be called for x64 -AB"); 29#if 0 30 curdisp->d.lo_base = val & ((1 << 24) - 1); 31 curdisp->d.hi_base = val >> 24; 32 __asm volatile("mov %[fs], %%fs" :: [fs] "r" (GSEL(DISP_SEL, SEL_UPL))); 33#else 34 wrmsr(MSR_IA32_FSBASE, val); 35#endif 36} 37 38#define arch_get_cycle_count() rdtscp() 39 40#endif 41