diff --git a/src/kernel/libroot/os/arch/x86/Jamfile b/src/kernel/libroot/os/arch/x86/Jamfile index 067ad0b68f..1ffeee5c10 100644 --- a/src/kernel/libroot/os/arch/x86/Jamfile +++ b/src/kernel/libroot/os/arch/x86/Jamfile @@ -3,8 +3,7 @@ SubDir OBOS_TOP src kernel libroot os arch x86 ; KernelMergeObject os_arch_$(OBOS_ARCH).o : atomic.S byteorder.S - cpuid.S - systeminfo.c + system_info.c system_time.S thread.c time.c @@ -15,6 +14,5 @@ KernelMergeObject os_arch_$(OBOS_ARCH).o : MergeObjectFromObjects kernel_os_arch_$(OBOS_ARCH).o : <$(SOURCE_GRIST)>atomic.o <$(SOURCE_GRIST)>byteorder.o - <$(SOURCE_GRIST)>cpuid.o <$(SOURCE_GRIST)>system_time.o ; diff --git a/src/kernel/libroot/os/arch/x86/cpuid.S b/src/kernel/libroot/os/arch/x86/cpuid.S deleted file mode 100644 index 69532570ae..0000000000 --- a/src/kernel/libroot/os/arch/x86/cpuid.S +++ /dev/null @@ -1,37 +0,0 @@ -/* -** Copyright 2001, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ - -#define FUNCTION(x) .global x; .type x,@function; x - -.text - -/* void cpuid(unsigned int eax_value, unsigned int *return_data) */ -FUNCTION(cpuid): - pushl %ebx - pushl %edi - movl 12(%esp),%eax /* first arg sets up eax */ - movl 16(%esp),%edi /* second arg points to the return area */ - cpuid - movl %eax,0(%edi) /* copy the regs into the return area */ - movl %ebx,4(%edi) /* ... */ - movl %ecx,8(%edi) /* ... */ - movl %edx,12(%edi) /* ... */ - popl %edi - popl %ebx - ret - - -/* unsigned int get_eflags(void) */ -FUNCTION(get_eflags): - pushfl - popl %eax - ret - - -/* void set_eflags(unsigned int val) */ -FUNCTION(set_eflags): - pushl 4(%esp) - popfl - ret diff --git a/src/kernel/libroot/os/arch/x86/system_info.c b/src/kernel/libroot/os/arch/x86/system_info.c new file mode 100644 index 0000000000..48de6e16da --- /dev/null +++ b/src/kernel/libroot/os/arch/x86/system_info.c @@ -0,0 +1,16 @@ +/* + * Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include +#include + + +status_t +get_cpuid(cpuid_info *info, uint32 eaxRegister, uint32 cpuNum) +{ + return _kern_get_cpuid(info, eaxRegister, cpuNum); +} + diff --git a/src/kernel/libroot/os/arch/x86/systeminfo.c b/src/kernel/libroot/os/arch/x86/systeminfo.c deleted file mode 100644 index 65a7dcd7de..0000000000 --- a/src/kernel/libroot/os/arch/x86/systeminfo.c +++ /dev/null @@ -1,66 +0,0 @@ -/* -** Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ - - -#include - - -// 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(uint32 selector, uint32 *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) -{ - uint32 data[4]; - - // ToDo: cpu_num is ignored, it's probably best fixed by introducing - // a syscall for this function and use the call_all_cpus() function - // inside the kernel. - // ToDo: the cpuid() and set_eflags()/get_eflags() shouldn't clobber - // the global namespace. - - // 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 - *((uint32 *)&vendor[0]) = data[1]; - *((uint32 *)&vendor[4]) = data[3]; - *((uint32 *)&vendor[8]) = data[2]; - } - - return B_OK; -} -