1 /* 2 * Copyright 2018, Jaroslaw Pelczar <jarek@jpelczar.com> 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _KERNEL_ARCH_ARM64_ARCH_THREAD_H_ 6 #define _KERNEL_ARCH_ARM64_ARCH_THREAD_H_ 7 8 9 #include <arch/cpu.h> 10 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 17 static inline Thread * arch_thread_get_current_thread(void) 18 { 19 return (Thread *)READ_SPECIALREG(tpidr_el1); 20 } 21 22 23 static inline void arch_thread_set_current_thread(Thread *t) 24 { 25 WRITE_SPECIALREG(tpidr_el1, t); 26 } 27 28 29 #ifdef __cplusplus 30 } 31 #endif 32 33 34 #endif /* _KERNEL_ARCH_ARM64_ARCH_THREAD_H_ */ 35