2019-07-08 12:56:36 +02:00
|
|
|
/**************************************
|
|
|
|
* iceOS Kernel *
|
|
|
|
* Developed by Marco 'icebit' Cetica *
|
|
|
|
* (c) 2019 *
|
|
|
|
* Released under GPLv3 *
|
|
|
|
* https://github.com/ice-bit/iceOS *
|
|
|
|
***************************************/
|
2019-07-03 18:12:57 +02:00
|
|
|
#include "drivers/tty.h"
|
2019-07-04 12:49:53 +02:00
|
|
|
#include "drivers/gdt.h"
|
2019-07-05 18:25:58 +02:00
|
|
|
#include "drivers/idt.h"
|
2019-07-06 01:09:10 +02:00
|
|
|
#include "drivers/timer.h"
|
2019-07-08 18:43:45 +02:00
|
|
|
#include "drivers/keyboard.h"
|
2019-09-24 18:32:38 +02:00
|
|
|
#include "drivers/paging.h"
|
|
|
|
#include "drivers/kheap.h"
|
2019-07-08 18:43:45 +02:00
|
|
|
#include "shell/shell.h"
|
2019-07-08 20:36:53 +02:00
|
|
|
#include "libc/stdio.h"
|
2019-07-03 18:12:57 +02:00
|
|
|
|
2019-09-24 18:32:38 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2019-07-03 18:12:57 +02:00
|
|
|
void kernel_main() {
|
2019-07-08 20:36:53 +02:00
|
|
|
printf_color("\n[STATUS]", LIGHT_GREEN, BLACK);
|
|
|
|
printf_color(" - Loading kernel, wait please...", WHITE, BLACK);
|
|
|
|
|
2019-07-04 12:49:53 +02:00
|
|
|
gdt_setup(); // Setup Global Descriptor Table
|
2019-07-08 20:36:53 +02:00
|
|
|
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
|
|
|
|
printf_color(" - Loaded GDT", WHITE, BLACK);
|
|
|
|
|
2019-07-05 18:25:58 +02:00
|
|
|
idt_setup(); // Setup Interrupt Descriptor Table
|
2019-07-08 20:36:53 +02:00
|
|
|
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
|
|
|
|
printf_color(" - Loaded IDT", WHITE, BLACK);
|
|
|
|
|
|
|
|
init_timer(1); // Initialize PIT driver
|
|
|
|
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
|
|
|
|
printf_color(" - Loaded PIT", WHITE, BLACK);
|
2019-07-03 18:12:57 +02:00
|
|
|
|
2019-07-08 20:36:53 +02:00
|
|
|
init_keyboard(); // Initialize keyboard driver
|
|
|
|
printf_color("\n[INFO]", LIGHT_CYAN, BLACK);
|
|
|
|
printf_color(" - Loaded PS/2 driver", WHITE, BLACK);
|
|
|
|
|
2019-09-24 18:32:38 +02:00
|
|
|
printf_color("\n[TEST]", LIGHT_BROWN, BLACK); // Testing heap
|
|
|
|
printf_color(" - Allocating heap blocks..\n", LIGHT_BROWN, BLACK);
|
|
|
|
|
|
|
|
uint32_t x = kmalloc(8), y = kmalloc(16), z = kmalloc(32);
|
|
|
|
printf("x: %x, y: %x, z: %x", x, y, z);
|
|
|
|
|
|
|
|
printf_color("\n[TEST]", LIGHT_BROWN, BLACK); // Testing heap
|
|
|
|
printf_color(" - Freeing heap blocks..\n", LIGHT_BROWN, BLACK);
|
|
|
|
kfree((void*)x), kfree((void*)y), kfree((void*)z);
|
|
|
|
|
|
|
|
printf_color("\n[STATUS]", LIGHT_GREEN, BLACK);
|
|
|
|
printf_color(" - Heap worked successfullt!", WHITE, BLACK);
|
|
|
|
|
2019-07-08 18:43:45 +02:00
|
|
|
iceos_ascii_logo();
|
2019-07-06 00:32:41 +02:00
|
|
|
init_prompt(); // Initialize frame buffer
|
2019-07-03 18:12:57 +02:00
|
|
|
}
|