1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00

printing mem stuff

This commit is contained in:
Adrien Bourmault 2019-03-30 14:58:12 +01:00
parent 5c931641ad
commit 7c0fe01f6a
4 changed files with 46 additions and 8 deletions

View File

@ -187,6 +187,9 @@ extern volatile Processor_t cpuTable[NCPUS];
static inline void _##pref##Set##name(type __val) \ static inline void _##pref##Set##name(type __val) \
{ KeGetCurCPU().field = __val; } { KeGetCurCPU().field = __val; }
#define BARRIER() do{\
asm volatile("": : :"memory");__sync_synchronize();}while(0)
//------------------------------------------// //------------------------------------------//
// Needed by basically everyone // Needed by basically everyone

View File

@ -83,6 +83,11 @@ struct GdtPtr_t
// //
void MmInitMemoryMap(void); void MmInitMemoryMap(void);
//
// Initializes the memory map structure
//
void MmPrintMemoryMap(void);
// //
// Returns the size of the first available memory zone // Returns the size of the first available memory zone
// from the start address pointer // from the start address pointer

View File

@ -113,9 +113,6 @@ void BtInitBootInfo(multiboot_info_t *mbi)
extern void pstest(void); extern void pstest(void);
extern error_t IoInitVGABuffer(void); extern error_t IoInitVGABuffer(void);
#define BARRIER() do{\
asm volatile("": : :"memory");__sync_synchronize();}while(0)
// //
// Entry point of the Kaleid kernel // Entry point of the Kaleid kernel
// //
@ -127,7 +124,6 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic)
// Initialize the BootInfo_t structure // Initialize the BootInfo_t structure
BtInitBootInfo(mbInfo); BtInitBootInfo(mbInfo);
// Get ready to print things // Get ready to print things
IoInitVGABuffer(); IoInitVGABuffer();
@ -151,11 +147,15 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic)
MmInitHeap(); MmInitHeap();
PsInitSched();
BARRIER(); BARRIER();
int i = 0; /* int i = 0; */
while(i < 517) { KernLog("%d\n", i++);} /* while(i < 517) { KernLog("%d\n", i++);} */
PsInitSched();
MmPrintMemoryMap();
// We're out // We're out
PsFiniSched(); PsFiniSched();

View File

@ -172,3 +172,33 @@ void *MmGetFirstAvailZone(void *start) {
return current; return current;
} }
void MmPrintMemoryMap(void) {
char *avStr = "";
for (int i=0; i < memoryMap.length; i++) {
switch (memoryMap.entry[i].type) {
case AVAILABLE_ZONE: avStr="Available";
break;
case RESERVED_ZONE: avStr="Reserved";
break;
case ACPI_ZONE: avStr="ACPI";
break;
case NVS_ZONE: avStr="NVS";
break;
case BADRAM_ZONE: avStr="Bad Ram";
break;
default:;
}
KernLog("Mem zone : %p\t%s\twith length:%dKio\n",
memoryMap.entry[i].addr,
avStr,
memoryMap.entry[i].length / KB
);
}
}