Very simple threading and context switching.

This commit is contained in:
2018-01-05 17:07:22 +01:00
parent 63ae2a0b9d
commit 1e2f81a5d8
4 changed files with 132 additions and 0 deletions

View File

@@ -5,6 +5,19 @@
#include <multiboot.h>
#include <cpu.h>
#include <interrupts.h>
#include <thread.h>
void thread_function()
{
int tid = get_tid();
while(1)
{
debug("Thread %d\n", tid);
yield();
}
}
void kmain(uint64_t multiboot_magic, void *multiboot_data)
{
@@ -23,6 +36,11 @@ void kmain(uint64_t multiboot_magic, void *multiboot_data)
debug_ok("Boot \"Complete\"\n");
new_thread(thread_function);
new_thread(thread_function);
new_thread(thread_function);
yield();
PANIC("Reached end of kernel main function\n");
for(;;);
}