/* Initialize HAL */
int _cdecl HAL_Initialize()
{
    GDT_Initialize();
    IDT_Initialize(0x08);
    InitializePIC();

    /* In InitializePIC I remap PIT to IRQ 0x20 */
    pit_initialize(0x20, 0x08);
    pit_start_counter0(1000, PIT_CONTROLWORD_OPERATINGMODE_RATEGEN_MASK);

    EnableInterrupts();

    return 0;
}
Exemple #2
0
void Kernel(UINT32 pMBootMagic,
            PVOID pMBoot)
{
	COMPortLogger_Initialize();
	COMPortLogger_WriteLine("See? It works!");

	VGAText_Clear(VGATEXT_ATTRIBUTES(VGATEXT_ATTRIBUTE_LIGHT_WHITE, VGATEXT_ATTRIBUTE_DARK_BLACK));
	if (!MBoot_Initialize(pMBootMagic, pMBoot)) Panic("PANIC: Bootloader did not pass valid multiboot data");

    FileSystem_Initialize();

    printf("Booting SEMOS...\n");

	GDT_Initialize();
	IDT_Initialize();
	PIC_Initialize();
	PIT_Initialize(1000);
	RTC_Initialize();

	time_t startupTime = time(NULL);
	printf("Startup @ %s\n", ctime(&startupTime));

	SystemPartition_Initialize();

    printf("CLR Runtime Initializing\n");
	logLevel = 0;

    JIT_Execute_Init();
    printf("CLR JIT Initialized\n");
	MetaData_Init();
    printf("CLR MetaData Initialized\n");
	Type_Init();
    printf("CLR Types Initialized\n");
	Heap_Init();
    printf("CLR Heap Initialized\n");
	Finalizer_Init();
    printf("CLR Finalizer Initialized\n");

	tCLIFile *cliFile = CLIFile_Load("/SYSTEM/KERNEL.EXE");
    if (cliFile) printf("Loaded Kernel.exe\n");
	INT32 retValue = CLIFile_Execute(cliFile, 0, NULL);
    printf("Executed Kernel.exe: %d\n", retValue);
    if (retValue) { }
    while (TRUE);
}