Working on CPUID

This commit is contained in:
Adrien Bourmault 2019-05-22 19:41:00 +02:00
parent b80c912a34
commit e176990138
6 changed files with 17 additions and 6 deletions

View File

@ -113,6 +113,8 @@ static inline int CpuCpuidString(int code, uint where[4])
return (int)where[0];
}
void CpuGetInfos(void);
// -------------------------------------------------------------------------- //
#endif

View File

@ -61,6 +61,7 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
// Interrupts launching
KeSetupIDT();
KeEnableIRQs();
CpuGetInfos();
MmInitGdt();
// Start drivers

View File

@ -33,6 +33,7 @@
#include <mm/heap.h>
#include <mm/mm.h>
#include <io/vga.h>
#include <ke/cpuid.h>
// info.c
extern void BtDoSanityChecks(uint mbMagic);

View File

@ -28,6 +28,6 @@ ulong __stack_chk_guard = 0x447c0ffe4dbf9e55;
noreturn void __stack_chk_fail(void)
{
KeStartPanic("Stack has been smashed!\n");
KeStartPanic("Stack has been smashed!");
}

View File

@ -31,5 +31,6 @@ volatile BootInfo_t BtBootTab = {0};
volatile bool KeIsPanicking = 0;
volatile CpuCore_t *KeCurCPU = &_KeCPUTable[0];
volatile CpuInfo_t CpuInfo = { 0 };

View File

@ -23,13 +23,19 @@
//----------------------------------------------------------------------------//
#include <ke/cpuid.h>
#include <io/vga.h>
void CpuGetInfos(void)
{
uint CpuVendorString[5] = {0};
extern CpuInfo_t CpuInfo;
/* void CpuGetInfos(void) */
/* { */
/* CpuCpuidString(0, CpuVendorString); */
/* return (char *)&CpuVendorString[1]; */
/* } */
CpuCpuidString(0, CpuVendorString);
memmove(CpuInfo.vendorStr, (char *)&CpuVendorString[1], 12*sizeof(char));
KernLog("\tCPU %s detected\n", CpuInfo.vendorStr);
}