aboutsummaryrefslogtreecommitdiff
path: root/src/kernel.c
blob: ffa8814f389379dbeed6ef86a7b5ff4a4769da82 (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
#include "mem.h"

#include <gdt.h>
#include <idt.h>
#include <stdio.h>

#include "devices/pic.h"
#include "devices/uart_16550.h"
#include "devices/vga.h"

void kmain() {
  pic_init();

  gdt_install();
  idt_install();

  if (uart_init(COM1) != 0) printf("UART self-test failed.\r\n");

  printf("hello %s world\n", "kernel");
  printf("we are number %d\n", 1);
  printf("a negative %d as hex %x\n", -1, -1);
  printf("hex 255=0x%x\n", 255);

  vga_init(vmm_map(0xb8000, 0xc03ff000));

  alloc4M();
  char *c = (char *)0xc0700000;
  if (*c == 0) printf("c is 0\r\n");

  asm volatile("int $0x80");

  while (1)
    ;
}