Kernel: Remove obsole CPUID::IsAvailable

This is now a harware requirement that is verified already in boot.S
This commit is contained in:
Bananymous 2023-01-10 21:28:59 +02:00
parent 7d45b3cbd6
commit 64c57ea3d0
5 changed files with 1 additions and 38 deletions

View File

@ -341,12 +341,6 @@ namespace APIC
static bool InitializeAPIC() static bool InitializeAPIC()
{ {
if (!CPUID::IsAvailable())
{
kprintln("CPUID not available");
return false;
}
uint32_t ecx, edx; uint32_t ecx, edx;
CPUID::GetFeatures(ecx, edx); CPUID::GetFeatures(ecx, edx);
if (!(edx & CPUID::Features::EDX_APIC)) if (!(edx & CPUID::Features::EDX_APIC))

View File

@ -12,24 +12,6 @@ namespace CPUID
asm volatile ("cpuid": "=a"(out[0]), "=b"(out[0]), "=d"(out[1]), "=c"(out[2]) : "a"(code)); asm volatile ("cpuid": "=a"(out[0]), "=b"(out[0]), "=d"(out[1]), "=c"(out[2]) : "a"(code));
} }
bool IsAvailable()
{
uint32_t res;
asm volatile(
"pushfl;"
"pushfl;"
"popl %0;"
"xorl %1, %0;"
"pushl %0;"
"popfl;"
"pushfl;"
"popl %0;"
"popfl;"
: "=r"(res)
: "i" (0x00200000));
return res != 0;
}
const char* GetVendor() const char* GetVendor()
{ {
static char vendor[13] {}; static char vendor[13] {};
@ -48,9 +30,6 @@ namespace CPUID
bool Is64Bit() bool Is64Bit()
{ {
if (!IsAvailable())
return false;
uint32_t buffer[4] {}; uint32_t buffer[4] {};
get_cpuid(0x80000000, buffer); get_cpuid(0x80000000, buffer);
if (buffer[0] < 0x80000001) if (buffer[0] < 0x80000001)

View File

@ -148,7 +148,6 @@ namespace CPUID
} }
} }
bool IsAvailable();
const char* GetVendor(); const char* GetVendor();
void GetFeatures(uint32_t& ecx, uint32_t& edx); void GetFeatures(uint32_t& ecx, uint32_t& edx);
bool Is64Bit(); bool Is64Bit();

View File

@ -125,11 +125,6 @@ namespace Kernel
TTY_PRINTLN("'cpuinfo' does not support command line arguments"); TTY_PRINTLN("'cpuinfo' does not support command line arguments");
return; return;
} }
if (!CPUID::IsAvailable())
{
TTY_PRINTLN("'cpuid' instruction not available");
return;
}
uint32_t ecx, edx; uint32_t ecx, edx;
auto vendor = CPUID::GetVendor(); auto vendor = CPUID::GetVendor();
@ -154,11 +149,6 @@ namespace Kernel
TTY_PRINTLN("'random' does not support command line arguments"); TTY_PRINTLN("'random' does not support command line arguments");
return; return;
} }
if (!CPUID::IsAvailable())
{
TTY_PRINTLN("'cpuid' instruction not available");
return;
}
uint32_t ecx, edx; uint32_t ecx, edx;
CPUID::GetFeatures(ecx, edx); CPUID::GetFeatures(ecx, edx);
if (!(ecx & CPUID::Features::ECX_RDRND)) if (!(ecx & CPUID::Features::ECX_RDRND))

View File

@ -1,3 +1,4 @@
#include <BAN/Memory.h>
#include <kernel/APIC.h> #include <kernel/APIC.h>
#include <kernel/GDT.h> #include <kernel/GDT.h>
#include <kernel/IDT.h> #include <kernel/IDT.h>