mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
cpuid
This commit is contained in:
parent
6c504cff34
commit
90761c4a10
@ -43,9 +43,10 @@ typedef struct ListNode_t ListNode_t;
|
|||||||
typedef struct Thread_t Thread_t;
|
typedef struct Thread_t Thread_t;
|
||||||
typedef struct Process_t Process_t;
|
typedef struct Process_t Process_t;
|
||||||
typedef struct BootInfo_t BootInfo_t;
|
typedef struct BootInfo_t BootInfo_t;
|
||||||
typedef struct Processor_t Processor_t;
|
typedef struct CpuCore_t CpuCore_t;
|
||||||
|
typedef struct CpuInfo_t CpuInfo_t;
|
||||||
typedef struct ISRFrame_t ISRFrame_t;
|
typedef struct ISRFrame_t ISRFrame_t;
|
||||||
typedef enum ProcState_t ProcState_t;
|
typedef enum ProcState_t ProcState_t;
|
||||||
|
|
||||||
typedef struct IdtDescriptor_t IdtDescriptor_t;
|
typedef struct IdtDescriptor_t IdtDescriptor_t;
|
||||||
typedef struct IdtEntry_t IdtEntry_t;
|
typedef struct IdtEntry_t IdtEntry_t;
|
||||||
@ -63,7 +64,7 @@ typedef struct GdtPtr_t GdtPtr_t;
|
|||||||
//
|
//
|
||||||
// Holds all CPU-local variables
|
// Holds all CPU-local variables
|
||||||
//
|
//
|
||||||
struct Processor_t
|
struct CpuCore_t
|
||||||
{
|
{
|
||||||
// CPU number, index in CPU list
|
// CPU number, index in CPU list
|
||||||
int index;
|
int index;
|
||||||
@ -71,17 +72,10 @@ struct Processor_t
|
|||||||
// CPU APIC id
|
// CPU APIC id
|
||||||
int apicId;
|
int apicId;
|
||||||
|
|
||||||
// CPU Vendor String (always 12 characters)
|
CpuInfo_t *infos;
|
||||||
char vendorStr[12];
|
|
||||||
|
|
||||||
// CPU Model code (enum in cpu.h)
|
|
||||||
int modelCode;
|
|
||||||
|
|
||||||
// CPU Features flag
|
|
||||||
uint featureFlag;
|
|
||||||
|
|
||||||
// Number of ticks since boot time
|
// Number of ticks since boot time
|
||||||
ulong ticks;
|
ulong ticks; // XXX I/O APIC
|
||||||
|
|
||||||
// Current process & thread
|
// Current process & thread
|
||||||
Process_t *process;
|
Process_t *process;
|
||||||
@ -100,6 +94,18 @@ struct Processor_t
|
|||||||
ListHead_t *timeCritProcs;
|
ListHead_t *timeCritProcs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct CpuInfo_t
|
||||||
|
{
|
||||||
|
// CPU Vendor String (always 12 characters)
|
||||||
|
char vendorStr[12];
|
||||||
|
|
||||||
|
// CPU Model code (enum in cpu.h)
|
||||||
|
int modelCode;
|
||||||
|
|
||||||
|
// CPU Features flag
|
||||||
|
uint featureFlag;
|
||||||
|
};
|
||||||
|
|
||||||
struct ISRFrame_t {
|
struct ISRFrame_t {
|
||||||
/* The register file */
|
/* The register file */
|
||||||
ulong regs[15];
|
ulong regs[15];
|
||||||
@ -126,9 +132,9 @@ struct ISRFrame_t {
|
|||||||
// Current CPU number
|
// Current CPU number
|
||||||
#define _KeCurCPU 0
|
#define _KeCurCPU 0
|
||||||
|
|
||||||
extern int KeCPUCount;
|
extern int KeCPUCount;
|
||||||
extern volatile Processor_t *KeCurCPU;
|
extern volatile CpuCore_t *KeCurCPU;
|
||||||
extern Processor_t _KeCPUTable[NCPUS];
|
extern CpuCore_t _KeCPUTable[NCPUS];
|
||||||
|
|
||||||
//----------------------------------------------------------------------------//
|
//----------------------------------------------------------------------------//
|
||||||
|
|
||||||
|
@ -93,6 +93,8 @@ enum {
|
|||||||
FEAT_EDX_PBE = 1 << 31
|
FEAT_EDX_PBE = 1 << 31
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------- //
|
// -------------------------------------------------------------------------- //
|
||||||
|
|
||||||
// Issue a single request to CPUID. Fits 'intel features', for instance
|
// Issue a single request to CPUID. Fits 'intel features', for instance
|
||||||
|
@ -24,9 +24,11 @@
|
|||||||
|
|
||||||
#include <kernel/cpuid.h>
|
#include <kernel/cpuid.h>
|
||||||
|
|
||||||
char* CpuGetVendorString(void) {
|
|
||||||
uint where[5] = { 0 };
|
void CpuGetInfos(void)
|
||||||
return (char *)&where[1];
|
{
|
||||||
|
CpuCpuidString(0, CpuVendorString);
|
||||||
|
return (char *)&CpuVendorString[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,11 +25,11 @@
|
|||||||
#include <kernel/boot.h>
|
#include <kernel/boot.h>
|
||||||
|
|
||||||
int KeCPUCount = 1;
|
int KeCPUCount = 1;
|
||||||
Processor_t _KeCPUTable[NCPUS] = {0};
|
CpuCore_t _KeCPUTable[NCPUS] = {0};
|
||||||
|
|
||||||
volatile BootInfo_t BtBootTab = {0};
|
volatile BootInfo_t BtBootTab = {0};
|
||||||
volatile bool KeIsPanicking = 0;
|
volatile bool KeIsPanicking = 0;
|
||||||
|
|
||||||
volatile Processor_t *KeCurCPU = &_KeCPUTable[0];
|
volatile CpuCore_t *KeCurCPU = &_KeCPUTable[0];
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user