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) \
{ KeGetCurCPU().field = __val; }
#define BARRIER() do{\
asm volatile("": : :"memory");__sync_synchronize();}while(0)
//------------------------------------------//
// Needed by basically everyone

View File

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

View File

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

View File

@ -172,3 +172,33 @@ void *MmGetFirstAvailZone(void *start) {
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
);
}
}