Moved arch-dependent stuff to the correct location, no more #if __INTEL__
anymore. Adapted tls.c to honour the reserved slots. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2375 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0464331f06
commit
2d6ab447f9
@ -11,7 +11,6 @@ KernelMergeObject os_main.o :
|
||||
<$(SOURCE_GRIST)>team.c
|
||||
<$(SOURCE_GRIST)>thread.c
|
||||
<$(SOURCE_GRIST)>time.c
|
||||
<$(SOURCE_GRIST)>tls.c
|
||||
<$(SOURCE_GRIST)>syscalls.S
|
||||
:
|
||||
-fPIC -DPIC
|
||||
|
@ -3,6 +3,9 @@ SubDir OBOS_TOP src kernel libroot os arch x86 ;
|
||||
KernelMergeObject os_arch_$(OBOS_ARCH).o :
|
||||
<$(SOURCE_GRIST)>atomic.S
|
||||
<$(SOURCE_GRIST)>cpuid.S
|
||||
<$(SOURCE_GRIST)>systeminfo.c
|
||||
<$(SOURCE_GRIST)>thread.c
|
||||
<$(SOURCE_GRIST)>tls.c
|
||||
:
|
||||
-fPIC -DPIC
|
||||
;
|
||||
@ -12,4 +15,3 @@ MergeObjectFromObjects kernel_os_arch_$(OBOS_ARCH).o :
|
||||
#<$(SOURCE_GRIST)>atomic.o
|
||||
<$(SOURCE_GRIST)>cpuid.o
|
||||
;
|
||||
|
||||
|
60
src/kernel/libroot/os/arch/x86/systeminfo.c
Normal file
60
src/kernel/libroot/os/arch/x86/systeminfo.c
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
// this declaration could be placed in a header file somewhere, but it doesn't
|
||||
// appear likely that any user functions besides 'get_cpuid()' would need it...
|
||||
void cpuid(unsigned int selector, unsigned int *data);
|
||||
|
||||
|
||||
/*
|
||||
* get_cpuid() -- uses the 'cpuid' instruction to retrieve information
|
||||
* about the computer make & model and the capabilities of the cpu(s)
|
||||
* ...this means the function is strictly INTEL PLATFORM ONLY!!!
|
||||
*
|
||||
* parameters:
|
||||
* info: out - the structure to hold the cpuid information
|
||||
* eax_register: in - the value to place in eax before invoking 'cpuid'
|
||||
* cpu_num: in - the number of the cpu to gather information about
|
||||
* (currently not used)
|
||||
*
|
||||
* Note: the stage2 bootloader already verifies at startup time that the
|
||||
* 'cpuid' instruction can be called by the host computer, so no checking
|
||||
* for this is done here.
|
||||
*/
|
||||
|
||||
status_t
|
||||
get_cpuid(cpuid_info *info, uint32 eax_register, uint32 cpu_num)
|
||||
{
|
||||
unsigned int data[4];
|
||||
|
||||
// call the instruction
|
||||
cpuid(eax_register, data);
|
||||
|
||||
// fill the info struct with the return values
|
||||
info->regs.eax = data[0];
|
||||
info->regs.ebx = data[1];
|
||||
info->regs.ecx = data[2];
|
||||
info->regs.edx = data[3];
|
||||
|
||||
if (eax_register == 0) {
|
||||
// fixups for this special case
|
||||
char *vendor = info->eax_0.vendorid;
|
||||
|
||||
// the high-order word is non-zero on some Cyrix CPUs
|
||||
info->eax_0.max_eax = data[0] & 0xffff;
|
||||
|
||||
// the vendor string bytes need a little re-ordering
|
||||
*((unsigned int *) &vendor[0]) = data[1];
|
||||
*((unsigned int *) &vendor[4]) = data[3];
|
||||
*((unsigned int *) &vendor[8]) = data[2];
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
22
src/kernel/libroot/os/arch/x86/thread.c
Normal file
22
src/kernel/libroot/os/arch/x86/thread.c
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <stdio.h>
|
||||
#include "syscalls.h"
|
||||
|
||||
|
||||
// see OS.h for the reason why we need this
|
||||
thread_id _kfind_thread_(const char *name);
|
||||
|
||||
thread_id
|
||||
_kfind_thread_(const char *name)
|
||||
{
|
||||
// ToDo: _kfind_thread_()
|
||||
printf("find_thread(): Not yet implemented!!\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** Copyright 2002, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
@ -10,17 +10,10 @@
|
||||
#endif
|
||||
|
||||
#include "support/TLS.h"
|
||||
#include "tls.h"
|
||||
|
||||
|
||||
// ToDo: we probably need to set some standard slots (like it's done in BeOS)!
|
||||
// Slot 1 is obviously the thread ID, but there are 8 pre-allocated slots in BeOS.
|
||||
// I have no idea what the other slots are used for; they are all NULL when the
|
||||
// thread has just started, but slots 0 & 1.
|
||||
// Slot 0 seems to be an address somewhere on the stack. Another slot is most probably
|
||||
// reserved for "errno", the others could have been used to make some POSIX calls
|
||||
// thread-safe - but we also have to find out which supposely non-thread-safe POSIX
|
||||
// calls are thread-safe in BeOS.
|
||||
static int32 gNextSlot = 0;
|
||||
static int32 gNextSlot = TLS_FIRST_FREE_SLOT;
|
||||
|
||||
|
||||
int32
|
||||
@ -34,8 +27,6 @@ tls_allocate(void)
|
||||
}
|
||||
|
||||
|
||||
#if __INTEL__ && __GNUC__
|
||||
|
||||
void *
|
||||
tls_get(int32 index)
|
||||
{
|
||||
@ -67,6 +58,3 @@ tls_set(int32 index, void *value)
|
||||
: : "d"(index), "a"(value) );
|
||||
}
|
||||
|
||||
#else
|
||||
# error "TLS has not been implemented for this platform"
|
||||
#endif
|
@ -8,62 +8,6 @@
|
||||
#include "syscalls.h"
|
||||
|
||||
|
||||
#ifdef __INTEL__
|
||||
|
||||
// this declaration could be placed in a header file somewhere, but it doesn't
|
||||
// appear likely that any user functions besides 'get_cpuid()' would need it...
|
||||
void cpuid(unsigned int selector, unsigned int *data);
|
||||
|
||||
|
||||
/*
|
||||
* get_cpuid() -- uses the 'cpuid' instruction to retrieve information
|
||||
* about the computer make & model and the capabilities of the cpu(s)
|
||||
* ...this means the function is strictly INTEL PLATFORM ONLY!!!
|
||||
*
|
||||
* parameters:
|
||||
* info: out - the structure to hold the cpuid information
|
||||
* eax_register: in - the value to place in eax before invoking 'cpuid'
|
||||
* cpu_num: in - the number of the cpu to gather information about
|
||||
* (currently not used)
|
||||
*
|
||||
* Note: the stage2 bootloader already verifies at startup time that the
|
||||
* 'cpuid' instruction can be called by the host computer, so no checking
|
||||
* for this is done here.
|
||||
*/
|
||||
|
||||
status_t
|
||||
get_cpuid(cpuid_info *info, uint32 eax_register, uint32 cpu_num)
|
||||
{
|
||||
unsigned int data[4];
|
||||
|
||||
// call the instruction
|
||||
cpuid(eax_register, data);
|
||||
|
||||
// fill the info struct with the return values
|
||||
info->regs.eax = data[0];
|
||||
info->regs.ebx = data[1];
|
||||
info->regs.ecx = data[2];
|
||||
info->regs.edx = data[3];
|
||||
|
||||
if (eax_register == 0) {
|
||||
// fixups for this special case
|
||||
char *vendor = info->eax_0.vendorid;
|
||||
|
||||
// the high-order word is non-zero on some Cyrix CPUs
|
||||
info->eax_0.max_eax = data[0] & 0xffff;
|
||||
|
||||
// the vendor string bytes need a little re-ordering
|
||||
*((unsigned int *) &vendor[0]) = data[1];
|
||||
*((unsigned int *) &vendor[4]) = data[3];
|
||||
*((unsigned int *) &vendor[8]) = data[2];
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
status_t
|
||||
_get_system_info(system_info *returned_info, size_t size)
|
||||
{
|
||||
|
@ -50,20 +50,6 @@ find_thread(const char *name)
|
||||
}
|
||||
|
||||
|
||||
#ifdef __INTEL__
|
||||
// see OS.h for the reason why we need this
|
||||
thread_id _kfind_thread_(const char *name);
|
||||
|
||||
thread_id
|
||||
_kfind_thread_(const char *name)
|
||||
{
|
||||
// ToDo: _kfind_thread_()
|
||||
printf("find_thread(): Not yet implemented!!\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
status_t
|
||||
rename_thread(thread_id thread, const char *name)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user