diff options
| author | Scott Gasch <[email protected]> | 2016-06-01 19:37:09 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2016-06-01 19:37:09 -0700 |
| commit | 0a41dae5f406d498b5c9ab1542cb5660e0d982f6 (patch) | |
| tree | 67ade9fe31cfd0458cc485e95550f7aaf14abdd1 /kernel/init/main.c | |
Diffstat (limited to 'kernel/init/main.c')
| -rw-r--r-- | kernel/init/main.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/kernel/init/main.c b/kernel/init/main.c new file mode 100644 index 0000000..22fd14a --- /dev/null +++ b/kernel/init/main.c @@ -0,0 +1,67 @@ +//+---------------------------------------------------------------------------- +// +// File: main.c +// +// Module: +// +// Synopsis: +// +// Created: sgasch 4 Jul 2003 +// +//+---------------------------------------------------------------------------- + +#include "kernel.h" +#include "hal.h" +#include "rtl.h" + +extern char __bss_start; +extern char end; + +void +ZeroBSS(void) +{ + BYTE *pBssStart, *pBssEnd; + + pBssStart = &__bss_start; + pBssEnd = &end; + + // Fill .bss section with zero + RtlSetMemory((void *)pBssStart, '\0', (pBssEnd - pBssStart)); +} + +void +_assert(CHAR *szFunction, CHAR *szFile, ULONG uLine) +{ + HalVideoSetCursorPosition(0, 0); + HalVideoPrint("ASSERTION in %s at %s line %u.\n", + szFunction, szFile, uLine); + while(1) + { + ; + } +} + +// +// Entry point of the kernel. Not called main because I don't care to +// listen to gcc's warnings about argc and argv anymore. +// +int +KernelEntry(BIOS_HARDWARE_BLOCK *phw) +{ + ZeroBSS(); + + HalVideoInitialize(phw); + HalInitializeInterrupts(); + + HalVideoPrint("Interrupts initialized.\n"); + + hang: + HalReadTimestampCounter(); + HalVideoPrint("Timestamp Counter: %u%u\n", + ((g_ullTimeStampCounter >> 32) & 0xffffffff), + (g_ullTimeStampCounter & 0xffffffff)); + goto hang; + + return(-1); +} + |
