More proper way for stack allocation

This commit is contained in:
Adrien Bourmault 2020-02-03 13:43:40 +01:00
parent 8af9b5fdb4
commit cad56896cd
2 changed files with 13 additions and 11 deletions

View File

@ -64,21 +64,16 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
// Sanity checks // Sanity checks
BtDoSanityChecks(mbMagic); BtDoSanityChecks(mbMagic);
// ACPI
IoTestAcpi();
// Memory // Memory
MmInitMemoryMap(); MmInitMemoryMap();
MmInitHeap();
MmInitGdt(); MmInitGdt();
MmInitPaging();
// Interrupts // Interrupts
KeSetupIDT(); KeSetupIDT();
KeEnableIRQs(); KeEnableIRQs();
// Memory (2)
MmInitHeap();
MmInitPaging();
// Interrupt handlers // Interrupt handlers
MmActivatePageHandler(); MmActivatePageHandler();
KeEnableRTC(); KeEnableRTC();
@ -86,6 +81,9 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
KeGetCpuInfos(); KeGetCpuInfos();
IoEnableKeyb(); IoEnableKeyb();
// ACPI
IoTestAcpi();
// Scheduler // Scheduler
PsInitSched(); PsInitSched();
@ -95,5 +93,4 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
//KeCrashSystem(); //KeCrashSystem();
// Exit ! // Exit !
PoShutdown(); PoShutdown();
} }

View File

@ -58,11 +58,16 @@ void MmInitGdt(void)
tssDesc.veryHighBase = ((ulong)&tss >> 32) & 0xFFFFFFFF; tssDesc.veryHighBase = ((ulong)&tss >> 32) & 0xFFFFFFFF;
tssDesc.lowLimit = sizeof(tss); tssDesc.lowLimit = sizeof(tss);
tss.ist1 = (ulong)0x00007BFF; // ISR RESCUE STACK, GARANTIED FREE FOR USE BY OSDEV.ORG tss.ist1 = (ulong)memalign(4*KB, 4*KB) + 4*KB; // ISR RESCUE STACK
tss.ist2 = (ulong)0x00043F00; // ISR STACK, GARANTIED FREE FOR USE BY OSDEV.ORG tss.ist2 = (ulong)memalign(4*KB, 4*KB) + 4*KB; // ISR STACK
tss.ist3 = (ulong)0x0007FFFF; // ISR STACK, GARANTIED FREE FOR USE BY OSDEV.ORG tss.ist3 = (ulong)memalign(4*KB, 4*KB) + 4*KB; // ISR STACK
tss.iomap_base = sizeof(tss); tss.iomap_base = sizeof(tss);
/* KernLog("\tISR Stacks initialized : Rescue %p, Normal %p, %p\n", */
/* tss.ist1, */
/* tss.ist2, */
/* tss.ist3); */
memmove(&gdt[2], &tssDesc, sizeof(TssDescriptor_t)); memmove(&gdt[2], &tssDesc, sizeof(TssDescriptor_t));
/* DebugLog("TSS\n" */ /* DebugLog("TSS\n" */