* Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31078 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2008, Axel Dörfler, [email protected].
|
* Copyright 2002-2009, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||||
@@ -128,7 +128,8 @@ acpi_shutdown(void)
|
|||||||
static void
|
static void
|
||||||
disable_caches()
|
disable_caches()
|
||||||
{
|
{
|
||||||
x86_write_cr0((x86_read_cr0() | CR0_CACHE_DISABLE) & ~CR0_NOT_WRITE_THROUGH);
|
x86_write_cr0((x86_read_cr0() | CR0_CACHE_DISABLE)
|
||||||
|
& ~CR0_NOT_WRITE_THROUGH);
|
||||||
wbinvd();
|
wbinvd();
|
||||||
arch_cpu_global_TLB_invalidate();
|
arch_cpu_global_TLB_invalidate();
|
||||||
}
|
}
|
||||||
@@ -140,14 +141,16 @@ enable_caches()
|
|||||||
{
|
{
|
||||||
wbinvd();
|
wbinvd();
|
||||||
arch_cpu_global_TLB_invalidate();
|
arch_cpu_global_TLB_invalidate();
|
||||||
x86_write_cr0(x86_read_cr0() & ~(CR0_CACHE_DISABLE | CR0_NOT_WRITE_THROUGH));
|
x86_write_cr0(x86_read_cr0()
|
||||||
|
& ~(CR0_CACHE_DISABLE | CR0_NOT_WRITE_THROUGH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_mtrr(void *_parameter, int cpu)
|
set_mtrr(void *_parameter, int cpu)
|
||||||
{
|
{
|
||||||
struct set_mtrr_parameter *parameter = (struct set_mtrr_parameter *)_parameter;
|
struct set_mtrr_parameter *parameter
|
||||||
|
= (struct set_mtrr_parameter *)_parameter;
|
||||||
|
|
||||||
// wait until all CPUs have arrived here
|
// wait until all CPUs have arrived here
|
||||||
smp_cpu_rendezvous(&sCpuRendezvous, cpu);
|
smp_cpu_rendezvous(&sCpuRendezvous, cpu);
|
||||||
@@ -244,8 +247,7 @@ load_tss(int cpu)
|
|||||||
static void
|
static void
|
||||||
init_double_fault(int cpuNum)
|
init_double_fault(int cpuNum)
|
||||||
{
|
{
|
||||||
/* set up the double fault tss */
|
// set up the double fault TSS
|
||||||
/* TODO: Axel - fix SMP support */
|
|
||||||
struct tss *tss = &gCPU[cpuNum].arch.double_fault_tss;
|
struct tss *tss = &gCPU[cpuNum].arch.double_fault_tss;
|
||||||
|
|
||||||
memset(tss, 0, sizeof(struct tss));
|
memset(tss, 0, sizeof(struct tss));
|
||||||
@@ -426,15 +428,26 @@ detect_cpu(int currentCPU)
|
|||||||
// build the model string (need to swap ecx/edx data before copying)
|
// build the model string (need to swap ecx/edx data before copying)
|
||||||
unsigned int temp;
|
unsigned int temp;
|
||||||
memset(cpu->arch.model_name, 0, sizeof(cpu->arch.model_name));
|
memset(cpu->arch.model_name, 0, sizeof(cpu->arch.model_name));
|
||||||
|
|
||||||
get_current_cpuid(&cpuid, 0x80000002);
|
get_current_cpuid(&cpuid, 0x80000002);
|
||||||
temp = cpuid.regs.edx; cpuid.regs.edx = cpuid.regs.ecx; cpuid.regs.ecx = temp;
|
temp = cpuid.regs.edx;
|
||||||
|
cpuid.regs.edx = cpuid.regs.ecx;
|
||||||
|
cpuid.regs.ecx = temp;
|
||||||
memcpy(cpu->arch.model_name, cpuid.as_chars, sizeof(cpuid.as_chars));
|
memcpy(cpu->arch.model_name, cpuid.as_chars, sizeof(cpuid.as_chars));
|
||||||
|
|
||||||
get_current_cpuid(&cpuid, 0x80000003);
|
get_current_cpuid(&cpuid, 0x80000003);
|
||||||
temp = cpuid.regs.edx; cpuid.regs.edx = cpuid.regs.ecx; cpuid.regs.ecx = temp;
|
temp = cpuid.regs.edx;
|
||||||
memcpy(cpu->arch.model_name + 16, cpuid.as_chars, sizeof(cpuid.as_chars));
|
cpuid.regs.edx = cpuid.regs.ecx;
|
||||||
|
cpuid.regs.ecx = temp;
|
||||||
|
memcpy(cpu->arch.model_name + 16, cpuid.as_chars,
|
||||||
|
sizeof(cpuid.as_chars));
|
||||||
|
|
||||||
get_current_cpuid(&cpuid, 0x80000004);
|
get_current_cpuid(&cpuid, 0x80000004);
|
||||||
temp = cpuid.regs.edx; cpuid.regs.edx = cpuid.regs.ecx; cpuid.regs.ecx = temp;
|
temp = cpuid.regs.edx;
|
||||||
memcpy(cpu->arch.model_name + 32, cpuid.as_chars, sizeof(cpuid.as_chars));
|
cpuid.regs.edx = cpuid.regs.ecx;
|
||||||
|
cpuid.regs.ecx = temp;
|
||||||
|
memcpy(cpu->arch.model_name + 32, cpuid.as_chars,
|
||||||
|
sizeof(cpuid.as_chars));
|
||||||
|
|
||||||
// some cpus return a right-justified string
|
// some cpus return a right-justified string
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
@@ -714,8 +727,10 @@ arch_cpu_invalidate_TLB_list(addr_t pages[], int num_pages)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
arch_cpu_user_strlcpy(char *to, const char *from, size_t size, addr_t *faultHandler)
|
arch_cpu_user_strlcpy(char *to, const char *from, size_t size,
|
||||||
|
addr_t *faultHandler)
|
||||||
{
|
{
|
||||||
int fromLength = 0;
|
int fromLength = 0;
|
||||||
addr_t oldFaultHandler = *faultHandler;
|
addr_t oldFaultHandler = *faultHandler;
|
||||||
|
|||||||
Reference in New Issue
Block a user