blob: 7665cb0a2bd1e3c081c99909e4075a28c40ced41 (
plain) (
blame)
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
|
#include <multiboot.h>
#include <config.h>
#include <dbglog.h>
#include <sys.h>
#include <gdt.h>
#include <idt.h>
void breakpoint_handler(registers_t *regs) {
dbg_printf("Breakpoint! (int3)\n");
BOCHS_BREAKPOINT;
}
void kmain(struct multiboot_info_t *mbd, int32_t mb_magic) {
dbglog_setup();
dbg_printf("Hello, kernel World!\n");
dbg_printf("This is %s, version %s.\n", OS_NAME, OS_VERSION);
ASSERT(mb_magic == MULTIBOOT_BOOTLOADER_MAGIC);
gdt_init(); dbg_printf("GDT set up.\n");
idt_init(); dbg_printf("IDT set up.\n");
idt_set_ex_handler(EX_BREAKPOINT, breakpoint_handler);
asm volatile("int $0x3");
size_t total_ram = ((mbd->mem_upper + mbd->mem_lower) * 1024);
dbg_printf("Total ram: %d Kb\n", total_ram / 1024);
// paging_init(totalRam);
PANIC("Reached kmain end! Falling off the edge.");
}
/* vim: set ts=4 sw=4 tw=0 noet :*/
|