mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-30 00:08:03 +00:00
More checks for SSE
This commit is contained in:
parent
3ab856feca
commit
fd477325a3
40
Core/CPU.cpp
40
Core/CPU.cpp
@ -228,27 +228,29 @@ namespace CPU
|
|||||||
|
|
||||||
bool SSEEnableAfter = false;
|
bool SSEEnableAfter = false;
|
||||||
|
|
||||||
if (strcmp(CPU::Hypervisor(), x86_CPUID_VENDOR_TCG) != 0) /* Not sure if my code is not working properly or something else is the issue. */
|
/* Not sure if my code is not working properly or something else is the issue. */
|
||||||
if (SSESupport)
|
if ((strcmp(Hypervisor(), x86_CPUID_VENDOR_TCG) != 0 &&
|
||||||
{
|
strcmp(Hypervisor(), x86_CPUID_VENDOR_VIRTUALBOX) != 0) &&
|
||||||
debug("Enabling SSE support...");
|
SSESupport)
|
||||||
if (!BSP)
|
{
|
||||||
KPrint("SSE is supported.");
|
debug("Enabling SSE support...");
|
||||||
cr0.EM = 0;
|
if (!BSP)
|
||||||
cr0.MP = 1;
|
KPrint("SSE is supported.");
|
||||||
cr4.OSFXSR = 1;
|
cr0.EM = 0;
|
||||||
cr4.OSXMMEXCPT = 1;
|
cr0.MP = 1;
|
||||||
|
cr4.OSFXSR = 1;
|
||||||
|
cr4.OSXMMEXCPT = 1;
|
||||||
|
|
||||||
CPUData *CoreData = GetCPU(Core);
|
CPUData *CoreData = GetCPU(Core);
|
||||||
CoreData->Data.FPU = (CPU::x64::FXState *)KernelAllocator.RequestPages(TO_PAGES(sizeof(CPU::x64::FXState)));
|
CoreData->Data.FPU = (CPU::x64::FXState *)KernelAllocator.RequestPages(TO_PAGES(sizeof(CPU::x64::FXState)));
|
||||||
memset(CoreData->Data.FPU, 0, FROM_PAGES(TO_PAGES(sizeof(CPU::x64::FXState))));
|
memset(CoreData->Data.FPU, 0, FROM_PAGES(TO_PAGES(sizeof(CPU::x64::FXState))));
|
||||||
CoreData->Data.FPU->mxcsr = 0b0001111110000000;
|
CoreData->Data.FPU->mxcsr = 0b0001111110000000;
|
||||||
CoreData->Data.FPU->mxcsrmask = 0b1111111110111111;
|
CoreData->Data.FPU->mxcsrmask = 0b1111111110111111;
|
||||||
CoreData->Data.FPU->fcw = 0b0000001100111111;
|
CoreData->Data.FPU->fcw = 0b0000001100111111;
|
||||||
CPU::x64::fxrstor(CoreData->Data.FPU);
|
CPU::x64::fxrstor(CoreData->Data.FPU);
|
||||||
|
|
||||||
SSEEnableAfter = true;
|
SSEEnableAfter = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BSP)
|
if (!BSP)
|
||||||
KPrint("Enabling CPU cache.");
|
KPrint("Enabling CPU cache.");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user