This removes the inline assembly code for find_thread

from OS.h, sorry for triggering a complete rebuild.
To avoid doing a syscall for find_thread(0), the assembly
version is now in libroot. For BeOS R5 compatibility, 
_kfind_thread_ is retained. This will fix some compile 
problems, and provides a cleaner OS.h for future Haiku
versions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14014 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen 2005-08-20 23:57:11 +00:00
parent f721f59acd
commit 794df3bf25
6 changed files with 28 additions and 30 deletions

View File

@ -296,29 +296,7 @@ extern void exit_thread(status_t status);
extern status_t wait_for_thread (thread_id thread, status_t *threadReturnValue);
extern status_t on_exit_thread(void (*callback)(void *), void *data);
#if __INTEL__ && !_KERNEL_MODE && !_NO_INLINE_ASM
static inline thread_id
find_thread(const char *name) {
# ifndef __HAIKU__
/* ToDo: this can be removed once we don't need BeOS compatibility of our source files */
# define _kern_find_thread _kfind_thread_
# endif
extern thread_id _kern_find_thread(const char *name);
if (!name) {
thread_id thread;
__asm__ __volatile__ (
"movl %%fs:4, %%eax \n\t"
: "=a" (thread));
return thread;
}
return _kern_find_thread(name);
# ifndef __HAIKU__
# undef _kern_find_thread
# endif
}
#else
extern thread_id find_thread(const char *name);
#endif
extern status_t send_data(thread_id thread, int32 code, const void *buffer,
size_t bufferSize);

View File

@ -5,6 +5,7 @@ KernelMergeObject os_arch_$(OBOS_ARCH).o :
<$(SOURCE_GRIST)>byteorder.S
# <$(SOURCE_GRIST)>systeminfo.c
<$(SOURCE_GRIST)>system_time.S
<$(SOURCE_GRIST)>thread.c
<$(SOURCE_GRIST)>tls.c
:
-fPIC -DPIC

View File

@ -0,0 +1,9 @@
#include <OS.h>
#include "syscalls.h"
thread_id
find_thread(const char *name)
{
return _kern_find_thread(name);
}

View File

@ -8,8 +8,24 @@
#include "syscalls.h"
thread_id
find_thread(const char *name)
{
// BeOS R5 applications also use this trick as find_thread was available
// in BeOS R5 OS.h as inline function. Do not change storage of thread id.
if (!name) {
thread_id thread;
__asm__ __volatile__ (
"movl %%fs:4, %%eax \n\t"
: "=a" (thread));
return thread;
}
return _kern_find_thread(name);
}
// see OS.h from BeOS R5 for the reason why we need this
// (it's referenced there in the same way we reference _kern_find_thread())
// there find_thread (see above) is provided as inline function
extern thread_id _kfind_thread_(const char *name);

View File

@ -70,13 +70,6 @@ suspend_thread(thread_id thread)
}
thread_id
find_thread(const char *name)
{
return _kern_find_thread(name);
}
status_t
rename_thread(thread_id thread, const char *name)
{

View File

@ -15,6 +15,7 @@ KernelStaticLibraryObjects librld.a :
<src!system!libroot!os>syscalls.o
<src!system!libroot!os>sem.o
<src!system!libroot!os!arch!$(OBOS_ARCH)>atomic.o
<src!system!libroot!os!arch!$(OBOS_ARCH)>thread.o
<src!system!libroot!posix>errno.o