More proper way for stack allocation

This commit is contained in:
Adrien Bourmault 2020-02-03 13:43:40 +01:00
parent 9f52833adb
commit 06c62b78a5
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
BtDoSanityChecks(mbMagic);
// ACPI
IoTestAcpi();
// Memory
MmInitMemoryMap();
MmInitHeap();
MmInitGdt();
MmInitPaging();
// Interrupts
KeSetupIDT();
KeEnableIRQs();
// Memory (2)
MmInitHeap();
MmInitPaging();
// Interrupt handlers
MmActivatePageHandler();
KeEnableRTC();
@ -86,6 +81,9 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
KeGetCpuInfos();
IoEnableKeyb();
// ACPI
IoTestAcpi();
// Scheduler
PsInitSched();
@ -95,5 +93,4 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
//KeCrashSystem();
// Exit !
PoShutdown();
}

View File

@ -58,11 +58,16 @@ void MmInitGdt(void)
tssDesc.veryHighBase = ((ulong)&tss >> 32) & 0xFFFFFFFF;
tssDesc.lowLimit = sizeof(tss);
tss.ist1 = (ulong)0x00007BFF; // ISR RESCUE STACK, GARANTIED FREE FOR USE BY OSDEV.ORG
tss.ist2 = (ulong)0x00043F00; // ISR STACK, GARANTIED FREE FOR USE BY OSDEV.ORG
tss.ist3 = (ulong)0x0007FFFF; // ISR STACK, GARANTIED FREE FOR USE BY OSDEV.ORG
tss.ist1 = (ulong)memalign(4*KB, 4*KB) + 4*KB; // ISR RESCUE STACK
tss.ist2 = (ulong)memalign(4*KB, 4*KB) + 4*KB; // ISR STACK
tss.ist3 = (ulong)memalign(4*KB, 4*KB) + 4*KB; // ISR STACK
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));
/* DebugLog("TSS\n" */