sched: fix page faulting on process switching

This is the first version of the kernel with fully isolated threads for
user and kernel tasks, where process 0 is only used for scheduling and
interrupt handling.

User process have a "buddy" kernel process that handles its tasks in the
kernel.

This system allows for easy blocking of threads without much need for
thought. Just `sswtch` in an infinite read loop, and your userspace
process will be blocked.

Signed-off-by: Michael Shaw <spencershawiscool@gmail.com>
This commit is contained in:
Michael Shaw 2025-02-11 21:11:49 -05:00
commit f92e88597d
8 changed files with 125 additions and 30 deletions

View file

@ -75,7 +75,8 @@ void panic()
{
kprintf(LOG_ERROR "KERNEL PANIC\n");
cli();
yield();
while (1)
yield();
}
char *kcmdline_get_symbol(const char *sym)

View file

@ -44,7 +44,7 @@ static void exception_page_fault(int err)
{
uint64_t cr2 = cr2_read();
kprintf(LOG_ERROR "Page fault at %xh, error code %xh\n", cr2, err);
kprintf(LOG_ERROR "Page fault at %Xh, error code %xh\n", cr2, err);
}
void exception(int vector, int error)