Renamed systeminfo.c to system_info.c - also replaced the (broken) get_cpuid()
implementation by a syscall. Moved cpuid.S to src/kernel/core/arch/x86. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10318 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
72873ebe36
commit
fc4ff6bda0
@ -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
|
||||
;
|
||||
|
@ -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
|
16
src/kernel/libroot/os/arch/x86/system_info.c
Normal file
16
src/kernel/libroot/os/arch/x86/system_info.c
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright 2003-2004, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <syscalls.h>
|
||||
|
||||
|
||||
status_t
|
||||
get_cpuid(cpuid_info *info, uint32 eaxRegister, uint32 cpuNum)
|
||||
{
|
||||
return _kern_get_cpuid(info, eaxRegister, cpuNum);
|
||||
}
|
||||
|
@ -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 <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(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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user