summaryrefslogtreecommitdiff
path: root/kernel/init/main.c
blob: 22fd14a3342ddaacd6730c2fd458dd7eb01d5945 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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);
}