This commit is contained in:
Adrien Bourmault 2019-04-01 12:02:17 +02:00
parent 6384d6e533
commit dca1dd3168
2 changed files with 24 additions and 18 deletions

View File

@ -110,16 +110,31 @@ void BtInitBootInfo(multiboot_info_t *mbi)
} }
} }
void BtInitSanity(uint mbMagic){
uint tmp;
KernLog("%c%c%c OS/K\n \n", 219, 219, 219);
if (!(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC))
KeStartPanic("[Init] Magic number %x is incorrect\n", mbMagic);
tmp = (BtGetBootInfo(btldr).kernelEndAddr
- BtGetBootInfo(btldr).kernelAddr) / KB;
DebugLog("[Init] Kernel successfully loaded at %p with %x magic\n"
" and it uses %d Kio\n\n",
BtGetBootInfo(btldr).kernelAddr,
mbMagic,tmp);
}
extern void pstest(void); extern void pstest(void);
extern error_t IoInitVGABuffer(void); extern error_t IoInitVGABuffer(void);
// //
// Entry point of the Kaleid kernel // Entry point of the Kaleid kernel
// //
noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic) noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic)
{ {
int tmp;
// We're not ready to deal with interrupts // We're not ready to deal with interrupts
KeDisableIRQs(); KeDisableIRQs();
@ -129,25 +144,16 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic)
// Get ready to print things // Get ready to print things
IoInitVGABuffer(); IoInitVGABuffer();
// Hello world // Sanity checks and hello world
KernLog("%c%c%c OS/K\n \n", 219, 219, 219); BtInitSanity(mbMagic);
KalAlwaysAssert(mbMagic == MULTIBOOT_BOOTLOADER_MAGIC);
tmp = (BtGetBootInfo(btldr).kernelEndAddr
- BtGetBootInfo(btldr).kernelAddr) / KB;
KernLog("[Init] Kernel successfully loaded at %p with %x magic\n"
" and it uses %d Kio\n\n",
BtGetBootInfo(btldr).kernelAddr,
mbMagic,tmp);
//Memory mapping //Memory mapping
MmInitMemoryMap(); MmInitMemoryMap();
MmInitHeap(); MmInitHeap();
int i = 0; //int i = 0;
while(i < 512) { KernLog("%d\n", i++);} //while(i < 512) { KernLog("%d\n", i++);}
PsInitSched(); PsInitSched();

View File

@ -176,7 +176,7 @@ void *MmGetFirstAvailZone(void *start) {
void MmPrintMemoryMap(void) { void MmPrintMemoryMap(void) {
char *avStr = ""; char *avStr = "";
for (int i=0; i < memoryMap.length; i++) { for (uint i=0; i < memoryMap.length; i++) {
switch (memoryMap.entry[i].type) { switch (memoryMap.entry[i].type) {
case AVAILABLE_ZONE: avStr="Available"; case AVAILABLE_ZONE: avStr="Available";