aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/kernel.c
blob: c103476f7b353e49aae015656346d1bde78ba068 (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
#include "exceptions.h"
#include "gdt.h"
#include "isr.h"
#include "paging.h"
#include "print.h"
#if defined(__linux__)
#error "Not using cross compiler!"
#endif

// Only works for 32 bit ix86 target
#if !defined(__i386__)
#error "Must use ix86-elf compiler"
#endif

void motd() { printf("Welcome to gftos!\n=================\n"); }
extern Page_Table pgtable[1024];
extern Page_Directory page_dir[1024];
extern GDT_t table;

void kernel_main(void) {
    PIC_init(0x20, 0xA0);
    IRQ_mask(0);

    print_set_color(PRINT_COLOR_PINK, PRINT_COLOR_DARK_GRAY);
    print_clear();
    motd();
    printf("Page Directory: %x\n", (Page_Directory *)page_dir[1023]);
    printf("Page Table: %x\n", (Page_Table *)pgtable);
    printf("GDT: %x\n", table);
    for (;;) {
        update_cursor();
        asm("hlt");
    }

    // for (int r = 0; r < 24; r++) {
    //     for (int c = 0; c < 80; c += 3) {
    //         int color = (r + c) % 15 + 1;
    //         print_set_color(color, PRINT_COLOR_BLACK);
    //         printf(":3");
    //     }
    //     printf("%n");
    // }
    // print_set_color(PRINT_COLOR_YELLOW, PRINT_COLOR_BLACK);
    // printf("printf\n\tint: %d\n\tstring: %s\n\tchar: %c\n\tpercent: "
    //        "%%\n\tnothing: %n",
    //        99, "World! ", 't');

    // printf("\n0x%d\n", *((int *)(0x0010)));
}