From b13f7e6755fdf54d0072f6eef68ba303ab8cad41 Mon Sep 17 00:00:00 2001 From: Curle Date: Wed, 11 Sep 2019 03:58:53 +0100 Subject: [PATCH] Add debugging to the bootstrap, reformat some function names --- kernel/bootstrap.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/kernel/bootstrap.c b/kernel/bootstrap.c index 8431684..900a403 100644 --- a/kernel/bootstrap.c +++ b/kernel/bootstrap.c @@ -43,12 +43,12 @@ __attribute__((aligned(4096))) static size_t FirstPageTable[512] = {0}; */ //Play sound using built in speaker - static void play_sound(uint32_t nFrequence) { + static void playPCSpeaker(uint32_t frequency) { uint32_t Div; uint8_t tmp; //Set the PIT to the desired frequency - Div = 1193180 / nFrequence; + Div = 1193180 / frequency; WritePort(0x0043, 0xb6, 1); WritePort(0x0042, (uint8_t) (Div), 1); WritePort(0x0042, (uint8_t) (Div >> 8), 1); @@ -61,22 +61,22 @@ __attribute__((aligned(4096))) static size_t FirstPageTable[512] = {0}; } //make it shutup - static void nosound() { + static void stopPCSpeaker() { uint8_t tmp = ReadPort(0x0061, 1) & 0xFC; WritePort(0x0061, tmp, 1); } //Make a beep - void beep() { - play_sound(1000); - timer_wait(10); - nosound(); + void beepPCSpeaker() { + playPCSpeaker(1000); + awaitTicks(10); + stopPCSpeaker(); //set_PIT_2(old_frequency); } -void timer_wait(int ticks){ +void awaitTicks(int ticks) { uint64_t FinalTick = time + ticks; int i = 0; @@ -94,9 +94,19 @@ void PrepareSystem(FILELOADER_PARAMS* FLOP) { SetupPrinting(FLOP->GPU_Info->GPUs[0]); + ClearScreen(Print_Info.defaultGPU); + printf("1"); + SetupPrinting(FLOP->GPU_Info->GPUs[1]); + ClearScreen(Print_Info.defaultGPU); + printf("2"); /* All print functions are now available. */ printf("ready!"); + serialInit(); + serialPrintf("Kernel has been given control of the computer.\nStarting bootstrap init.\n"); + + FLOP->RTServices->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, L""); + InstallGDT(); InstallIDT();