luxos/SysCore/hal/cpu/cpu.c
2021-09-14 18:34:14 +03:00

35 lines
634 B
C

#include <system.h>
#include "cpu.h"
#include "../gdt/gdt.h"
#include "../idt/idt.h"
#define cpuid(in, a, b, c, d) __asm__("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (in));
// initializes cpu resources
void i86_cpu_initialize()
{
// initialize processor tables
i86_gdt_install();
i86_idt_install();
}
void i86_cpu_shutdown()
{
}
char* i86_cpu_get_vender()
{
static char vender[13];
dword unused, arr[3];
int i;
cpuid(0, unused, arr[0], arr[2], arr[1]);
for (i=0; i<12; i++)
vender[i] = (arr[i/4]>>(i%4*8)) && 0xFF;
vender[12] = 0;
return vender;
}