xref: /haiku/src/system/libroot/os/arch/x86/thread.c (revision 830f67ef991407f287dbc1238aa5f5906d90c991)
1 /*
2  * Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
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 	// BeOS R5 applications also use this trick as find_thread was available
15 	// in BeOS R5 OS.h as inline function. Do not change storage of thread id.
16 	if (!name) {
17 		thread_id thread;
18 		__asm__ __volatile__ (
19 			"movl	%%fs:4, %%eax \n\t"
20 			: "=a" (thread));
21 		return thread;
22 	}
23 	return _kern_find_thread(name);
24 }
25 
26 
27 // see OS.h from BeOS R5 for the reason why we need this
28 // there find_thread (see above) is provided as inline function
29 extern thread_id _kfind_thread_(const char *name);
30 
31 
32 thread_id
33 _kfind_thread_(const char *name)
34 {
35 	return _kern_find_thread(name);
36 }
37 
38 
39 extern thread_id _kget_thread_stacks_(thread_id thread, uint32 *stacks);
40 
41 status_t
42 _kget_thread_stacks_(thread_id thread, uint32 *stacks)
43 {
44 	// This one is obviously called from the R4.5 startup code. I am not
45 	// exactly sure how it returns its infos, but just returning an
46 	// error seems to work fine as well
47 	return B_ERROR;
48 }
49 
50