diff --git a/README.md b/README.md index d97dd0c..fa971a0 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,10 @@ The basics that I'm targeting are: ### Basic utility of what we call a "kernel" -- Fix terminal driver (backspace issues, scrolling) OR add Flanterm or equivalent - Implement tasks, and task switching + context switching and spinlock acquire/release - Load an executable - Filesystem (TAR for read-only initfs, then maybe read-write using FAT12/16/32 or easier fs) w/ VFS layer -- Getting to userspace (syscalls) +- Getting to userspace (ring 3 switching, syscall interface) - Porting musl libc or equivalent ### Scalability/maintenance/expansion features @@ -32,7 +31,6 @@ The basics that I'm targeting are: - SOME error handling in functions - Unit tests - Good error codes (like Linux kernel: ENOMEM, ENOENT, ...) -- Make the panic function work within itself without dependencies + error message (and still get cpu context?) ### Optional features diff --git a/docs/STYLE.md b/docs/STYLE.md index aa5e220..6321955 100644 --- a/docs/STYLE.md +++ b/docs/STYLE.md @@ -8,7 +8,7 @@ Indentations should be 4 characters long. ## Line length -Lines should not be more than 100 characters long. +Lines should not be more than 100 characters long. Exceptions is made for printing strings. ## Variables diff --git a/src/debug/stacktrace.c b/src/debug/stacktrace.c index 1f9c27c..430bf94 100644 --- a/src/debug/stacktrace.c +++ b/src/debug/stacktrace.c @@ -46,7 +46,7 @@ void debug_stack_trace(unsigned int max_frames) rbp = next_rbp; } if (init.terminal) { - printf("*** end stack trace ***[0m"); + printf("*** end stack trace ***\x1b[0m"); } DEBUG("*** end stack trace ***"); } diff --git a/src/kernel.h b/src/kernel.h index 0b276cc..f15e53e 100644 --- a/src/kernel.h +++ b/src/kernel.h @@ -36,13 +36,13 @@ extern volatile uint64_t ticks; // printf("debug: [%s]: " log "\n", __FILE__, ##__VA_ARGS__); void panic(struct cpu_status_t* ctx, const char* str); -void hcf(); -void idle(); +void hcf(void); +void idle(void); /* debug */ void debug_stack_trace(unsigned int max_frames); const char* debug_find_symbol(uintptr_t rip, uintptr_t* offset); -void boot_mem_display(); +void boot_mem_display(void); #define assert(check) do { if(!(check)) hcf(); } while(0) diff --git a/src/kmain.c b/src/kmain.c index d75831b..0f527e4 100644 --- a/src/kmain.c +++ b/src/kmain.c @@ -124,5 +124,6 @@ void kmain() scheduler_init(); kputs(PEPPEROS_SPLASH); + idle(); } diff --git a/src/sched/scheduler.c b/src/sched/scheduler.c index eedd3bc..381b601 100644 --- a/src/sched/scheduler.c +++ b/src/sched/scheduler.c @@ -43,6 +43,11 @@ struct cpu_status_t* scheduler_schedule(struct cpu_status_t* context) current_process = idle_proc; } + if (current_process == idle_proc && current_process->next == NULL) + { + return idle_proc->context; + } + current_process->context = context; //current_process->status = READY;