diff options
author | aqua <aqua@iserlohn-fortress.net> | 2024-03-08 17:24:49 +0200 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2024-03-08 22:00:07 +0200 |
commit | 20b97ea7c0dbbdc13800e12ff5c86c00c4a342ec (patch) | |
tree | 473281e5fc8b256827ce1a678573444e1aa5f669 /kernel/kernel.c | |
parent | Generate src/conf.h (diff) | |
download | kernel-20b97ea7c0dbbdc13800e12ff5c86c00c4a342ec.tar.xz |
Bazel build
Diffstat (limited to 'kernel/kernel.c')
-rw-r--r-- | kernel/kernel.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c new file mode 100644 index 0000000..98269c1 --- /dev/null +++ b/kernel/kernel.c @@ -0,0 +1,57 @@ +/* *** glitch kernel *** + * spdx-license-identifier: ISC + * description: kernel entry point + * */ + +#include "conf.h" +#include "mem.h" +#include <keyboard.h> +#include <mouse.h> +#include <pic.h> +#include <ps2_controller.h> +#include <stdio.h> +#include <sys/cpuid.h> +#include <uart.h> +#include <vga.h> + +FILE *stdin; +FILE *stdout; +FILE *stderr; + +void +kmain(void) +{ + stderr = uart_init(COM1); + vmm_map(0xb8000, 0xc03ff000); + stdout = vga_init((void *)0xc03ff000); + + printf("glitch [version " VERSION "] [" CC "]\n"); + fprintf(stderr, "glitch [version " VERSION "] [" CC "]\n"); + { + struct CPUVersion v; + + char vendor[13] = {'\0'}; + unsigned int eax; + __get_cpuid(0, &eax, (unsigned int *)vendor, (unsigned int *)(vendor + 8), (unsigned int *)(vendor + 4)); + __get_cpuid(1, (unsigned int *)&v, &eax, &eax, &eax); + printf("cpuid: %s family %u model %u stepping %u\n", vendor, family(v), model(v), v.stepping); + fprintf(stderr, "cpuid: %s family %u model %u stepping %u\n", vendor, family(v), model(v), v.stepping); + } + + pic_init(); + + ps2_ctrl_init(); + ps2_keyboard_init(); + mouse_init(); + + pic_enable(); + fprintf(stderr, "interrupts enabled\n"); + + /* + alloc4M(); + char *c = (char *)0xc0700000; + if (*c == 0) printf("c is 0\r\n"); + */ + + while (1) {} +} |