1/** 2 * \file 3 * \brief Threads architecture-specific code 4 */ 5 6/* 7 * Copyright (c) 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, Universitaetstr. 6, CH-8092 Zurich. Attn: Systems Group. 13 */ 14 15#ifndef LIBBARRELFISH_ARCH_THREADS_H 16#define LIBBARRELFISH_ARCH_THREADS_H 17 18/* this is a label defined in the assembler code that implements cap_invoke() */ 19extern void barrelfish_cap_invoke_post_syscall_instr(void); 20extern void barrelfish_lrpc_post_syscall_instr(void); 21 22/// 16-byte alignment required for aarch64 23#define STACK_ALIGNMENT (sizeof(uint64_t) * 2) 24 25#define THREAD_ALIGNMENT (16) 26 27/** 28 * Returns true iff the thread with the given save area has successfully 29 * performed a syscall. Used for the thread_invoke_cap_and_exit() hack. 30 */ 31static inline bool thread_check_syscall_succeeded(uintptr_t *save_area) 32{ 33 assert(!"thread_check_syscall_succeeded: called"); 34 abort(); 35#if 0 36 return ((save_area[RIP_REG] == (vaddr_t)barrelfish_cap_invoke_post_syscall_instr 37 || save_area[RIP_REG] == (vaddr_t)barrelfish_lrpc_post_syscall_instr) 38 && save_area[RAX_REG] == 0); 39#endif 40} 41 42#endif // LIBBARRELFISH_ARCH_THREADS_H 43