49 lines
1.2 KiB
C
49 lines
1.2 KiB
C
// File: kernel.c
|
|
// SoraOS Kernel - Main entry point
|
|
|
|
// INFO:
|
|
// 0xA0000 for EGA/VGA graphics modes (64 KB)
|
|
// 0xB0000 for monochrome text mode (32 KB)
|
|
// 0xB8000 for color text mode and CGA-compatible graphics modes (32 KB)
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "stdio.h"
|
|
|
|
typedef struct {
|
|
char user_name[32];
|
|
char user_hostname[32];
|
|
|
|
unsigned int user_id;
|
|
} user;
|
|
|
|
void kmain(void) {
|
|
user current_user = {.user_name = "admin", .user_hostname = "soraos", .user_id = 0};
|
|
|
|
__clear_screen();
|
|
|
|
printf("SoraOS Kernel Initialized\n");
|
|
printf("\tWelcome to SoraOS\n");
|
|
printf("\tKernel Version %s\n", __KERNEL_VERSION);
|
|
printf("\tCompiled on: %s at %s\n\n", __DATE__, __TIME__);
|
|
|
|
// TODO: CLI IDEA
|
|
int _count = printf("%s@%s:>", current_user.user_name, current_user.user_hostname);
|
|
scursor(_count, text_pos.line);
|
|
|
|
// TODO: Enable user input handling
|
|
char input_buffer[256] = {0};
|
|
gets(input_buffer, sizeof(input_buffer));
|
|
|
|
printf("Input buffer contents in hex:\n");
|
|
for (int i = 0; input_buffer[i] != '\0'; i++) {
|
|
printf("[%x]", (unsigned char)input_buffer[i]);
|
|
}
|
|
printf("\nYou entered: %s\n", input_buffer);
|
|
|
|
// Infinite loop
|
|
while (1) {
|
|
__asm__ volatile("hlt");
|
|
}
|
|
}
|