Moved to asm cpuid call. Support for CPU name string. Output skecth on main

This commit is contained in:
Dr-Noob
2018-03-24 23:57:49 +01:00
parent 7afefdb672
commit 97e21a64ba
7 changed files with 132 additions and 16 deletions

15
02h.c
View File

@@ -1,6 +1,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "02h.h"
#include "cpuid.h"
#define MASK1 0xFF;
#define MASK2 0xFF00;
@@ -23,18 +24,6 @@ struct TLB {
//http://www.sandpile.org/x86/cpuid.htm
//http://www.hugi.scene.org/online/coding/hugi%2016%20-%20corawhd4.htm
/*** EXEC CPUID INSTRUCTION ***/
static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx)
{
asm volatile("cpuid"
: "=a" (*eax),
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "0" (*eax), "2" (*ecx));
}
/*** ACCORDING TO CPUID TABLE ***/
//TO BE IMPLEMENTED
void fillWithDescriptor(unsigned int desc, struct level2* data) {
@@ -328,7 +317,7 @@ struct level2* fillLevel2(struct level2* data) {
unsigned eax, ebx, ecx, edx;
eax = 2;
native_cpuid(&eax, &ebx, &ecx, &edx);
cpuid(&eax, &ebx, &ecx, &edx);
unsigned int desc[16];