Launch kb driver and tty during bootstrap
#include <kernel/interrupts/interrupts.h>
//kernel drivers
+#include <kernel/drivers/kb/kb.h>
#include <kernel/drivers/pit/pit.h>
#include <kernel/drivers/serial/serial.h>
#include <kernel/drivers/text_mode/text_mode.h>
@@ -77,7 +78,44 @@ static void awm_init() {
char* argv[] = {program_name, ptr, NULL};
elf_load_file(program_name, fp, argv);
- while (1) {}
+ panic("noreturn");
+}
+
+static void cat() {
+ const char* program_name = "cat";
+
+ FILE* fp = initrd_fopen(program_name, "rb");
+ char* argv[] = {program_name, "test-file.txt", NULL};
+ elf_load_file(program_name, fp, argv);
+ panic("noreturn");
+}
+
+static void window() {
+ const char* program_name = "window";
+
+ FILE* fp = initrd_fopen(program_name, "rb");
+ char* argv[] = {program_name, NULL};
+ elf_load_file(program_name, fp, argv);
+ panic("noreturn");
+}
+
+static void tty_init() {
+ const char* program_name = "tty";
+ FILE* fp = initrd_fopen(program_name, "rb");
+ char* argv[] = {program_name, NULL};
+ elf_load_file(program_name, fp, argv);
+ panic("noreturn");
+ uint8_t scancode = inb(0x60);
+}
+
+static void acker() {
+ while (true) {
+ //sleep(1000);
+ sleep(20);
+ char scancode = 'a';
+ amc_message_t* amc_msg = amc_message_construct__from_core(STDOUT, &scancode, 1);
+ amc_message_send("com.user.window", amc_msg);
+ }
}
uint32_t initial_esp = 0;
@@ -115,8 +153,14 @@ void kernel_main(struct multiboot_info* mboot_ptr, uint32_t initial_stack) {
// Now that multitasking / program loading is available,
// launch external services and drivers
- kb_init();
+ task_spawn(kb_init);
task_spawn(awm_init);
+ task_spawn(tty_init);
+
+ sleep(1000);
+ //task_spawn(cat);
+ //task_spawn(acker);
+ task_spawn(window);
// Bootstrapping complete - kill this process
printf("[t = %d] Bootstrap task [PID %d] will exit\n", time(), getpid());
