tabs/kernel/kernel.c

35 lines
974 B
C
Raw Normal View History

2019-12-28 12:47:10 +00:00
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "terminal.c"
2019-12-28 12:47:10 +00:00
/* Check if the compiler thinks you are targeting the wrong operating system. */
#if defined(__linux__)
#error "You are not using a cross-compiler, you will most certainly run into trouble"
#endif
/* This tutorial will only work for the 32-bit ix86 targets. */
#if !defined(__i386__)
#error "This tutorial needs to be compiled with a ix86-elf compiler"
#endif
2019-12-30 13:45:55 +00:00
2019-12-28 12:47:10 +00:00
void kernel_main(void)
{
/* Initialize terminal interface */
terminal_initialize();
2019-12-30 15:02:43 +00:00
terminal_putchar('H');
terminal_putchar('e');
terminal_putchar('l');
terminal_putchar('l');
terminal_putchar('o');
2019-12-28 12:47:10 +00:00
/* Newline support is left as an exercise. */
2019-12-28 20:05:22 +00:00
terminal_setcolor(vga_entry_color(VGA_COLOR_GREEN, VGA_COLOR_BLACK));
2019-12-30 15:02:43 +00:00
terminal_writestring(" kernel");
2019-12-28 20:05:22 +00:00
terminal_setcolor(vga_entry_color(VGA_COLOR_LIGHT_GREY, VGA_COLOR_BLACK));
terminal_writestring(" World!\n");
2019-12-30 13:45:55 +00:00
terminal_writestring("Newlines!");
2019-12-28 12:47:10 +00:00
}