1 /* 2 * Copyright 2012, Alex Smith, alex@alex-smith.me.uk. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include <OS.h> 8 #include "syscalls.h" 9 10 11 thread_id 12 find_thread(const char* name) 13 { 14 if (!name) { 15 thread_id thread; 16 static_assert(sizeof(thread_id) <= sizeof(uint32_t), 17 "thread_id is larger than uint32_t"); 18 __asm__ __volatile__ ("movl %%fs:8, %0" : "=r" (thread)); 19 return thread; 20 } 21 22 return _kern_find_thread(name); 23 } 24 25