os/kernel/kernel.c

40 lines
910 B
C

#include "../cpu/cpu_init.h"
#include "../drivers/vga.h"
#include <grub/text_fb_info.h>
#include <stdlib.h>
#include "multiboot.h"
void kmain(multiboot_info_t* header) {
cpu_init();
text_fb_info info;
if (header->flags&MULTIBOOT_INFO_FRAMEBUFFER_INFO&&header->framebuffer_type==2) {
info.address=(char*)((header->framebuffer_addr&0xFFFFFFFF)+0xC0000000);
info.width=header->framebuffer_width;
info.height=header->framebuffer_height;
} else {
info.address=(char*)0xC00B8000;
info.width=80;
info.height=25;
}
vga_init(info);
vga_write_string("Hello\n");
asm volatile(" \
cli; \
mov $0x23, %ax; \
mov %ax, %ds; \
mov %ax, %es; \
mov %ax, %fs; \
mov %ax, %gs; \
\
mov %esp, %eax; \
pushl $0x23; \
pushl %eax; \
pushf; \
pushl $0x1B; \
push $1f; \
iret; \
1: \
");
vga_write_string("UMODE!");
}