aboutsummaryrefslogtreecommitdiff
path: root/kernel/main.c
blob: 119cf15caeef46243bfffe22be1ab9723920a3a7 (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
#include <stdio.h>
#include "gdt.h"
#include "idt.h"
#include "isr.h"
#include "irq.h"
#include "ps2.h"
#include "timer.h"
#include "tty.h"

void main(struct multiboot_header *hdr, uint32_t magic)
{
    /* init the terminal first so we can get some output */
    tty_init();

    /* then the descriptor tables so we can do more useful stuff */
    gdt_init();
    idt_init();

    /* install all the interrupt stubs */
    isr_init();
    irq_init();

    /* initialize other drivers */
    timer_init();
    ps2_init();

    asm("sti");

    for(;;)
    {
        ps2_set_leds(0x01);
        ps2_set_leds(0x02);
        ps2_set_leds(0x04);
        ps2_set_leds(0x02);
    }

    printf("Boot finished.\n");
    while(1)
        ;
}