1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00
This commit is contained in:
Adrien Bourmault 2019-05-09 21:57:54 +02:00
parent 6c504cff34
commit 90761c4a10
4 changed files with 30 additions and 20 deletions

View File

@ -43,9 +43,10 @@ typedef struct ListNode_t ListNode_t;
typedef struct Thread_t Thread_t;
typedef struct Process_t Process_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 enum ProcState_t ProcState_t;
typedef enum ProcState_t ProcState_t;
typedef struct IdtDescriptor_t IdtDescriptor_t;
typedef struct IdtEntry_t IdtEntry_t;
@ -63,7 +64,7 @@ typedef struct GdtPtr_t GdtPtr_t;
//
// Holds all CPU-local variables
//
struct Processor_t
struct CpuCore_t
{
// CPU number, index in CPU list
int index;
@ -71,17 +72,10 @@ struct Processor_t
// CPU APIC id
int apicId;
// CPU Vendor String (always 12 characters)
char vendorStr[12];
// CPU Model code (enum in cpu.h)
int modelCode;
// CPU Features flag
uint featureFlag;
CpuInfo_t *infos;
// Number of ticks since boot time
ulong ticks;
ulong ticks; // XXX I/O APIC
// Current process & thread
Process_t *process;
@ -100,6 +94,18 @@ struct Processor_t
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 {
/* The register file */
ulong regs[15];
@ -126,9 +132,9 @@ struct ISRFrame_t {
// Current CPU number
#define _KeCurCPU 0
extern int KeCPUCount;
extern volatile Processor_t *KeCurCPU;
extern Processor_t _KeCPUTable[NCPUS];
extern int KeCPUCount;
extern volatile CpuCore_t *KeCurCPU;
extern CpuCore_t _KeCPUTable[NCPUS];
//----------------------------------------------------------------------------//

View File

@ -93,6 +93,8 @@ enum {
FEAT_EDX_PBE = 1 << 31
};
// -------------------------------------------------------------------------- //
// Issue a single request to CPUID. Fits 'intel features', for instance

View File

@ -24,9 +24,11 @@
#include <kernel/cpuid.h>
char* CpuGetVendorString(void) {
uint where[5] = { 0 };
return (char *)&where[1];
void CpuGetInfos(void)
{
CpuCpuidString(0, CpuVendorString);
return (char *)&CpuVendorString[1];
}

View File

@ -25,11 +25,11 @@
#include <kernel/boot.h>
int KeCPUCount = 1;
Processor_t _KeCPUTable[NCPUS] = {0};
CpuCore_t _KeCPUTable[NCPUS] = {0};
volatile BootInfo_t BtBootTab = {0};
volatile bool KeIsPanicking = 0;
volatile Processor_t *KeCurCPU = &_KeCPUTable[0];
volatile CpuCore_t *KeCurCPU = &_KeCPUTable[0];