diff options
author | Marvin Borner | 2021-03-19 23:09:54 +0100 |
---|---|---|
committer | Marvin Borner | 2021-03-19 23:09:54 +0100 |
commit | c97a50ba7baa70b40431594f410ca18e14af3b76 (patch) | |
tree | 12366515d6989dcfc79ec3250558e381e29fb4eb /kernel/features | |
parent | 63ed037fdbb04a4855531f5ce980d8517752f640 (diff) |
Some things
Diffstat (limited to 'kernel/features')
-rw-r--r-- | kernel/features/mm.c | 2 | ||||
-rw-r--r-- | kernel/features/proc.c | 7 | ||||
-rw-r--r-- | kernel/features/syscall.c | 1 |
3 files changed, 7 insertions, 3 deletions
diff --git a/kernel/features/mm.c b/kernel/features/mm.c index af5e070..01e21e7 100644 --- a/kernel/features/mm.c +++ b/kernel/features/mm.c @@ -34,6 +34,8 @@ extern void paging_invalidate_tlb(void); void page_fault_handler(struct regs *r) { + print("--- PAGE FAULT! ---\n"); + // Check error code const char *type = (r->err_code & 1) ? "present" : "non-present"; const char *operation = (r->err_code & 2) ? "write" : "read"; diff --git a/kernel/features/proc.c b/kernel/features/proc.c index 5c38fff..aa595ff 100644 --- a/kernel/features/proc.c +++ b/kernel/features/proc.c @@ -59,7 +59,7 @@ void scheduler(struct regs *regs) } memory_switch_dir(((struct proc *)current->data)->page_dir); - memcpy(regs, &((struct proc *)current->data)->regs, sizeof(struct regs)); + memcpy(regs, &((struct proc *)current->data)->regs, sizeof(*regs)); if (regs->cs != GDT_USER_CODE_OFFSET) { regs->gs = GDT_USER_DATA_OFFSET; @@ -145,9 +145,10 @@ void proc_exit(struct proc *proc, int status) printf("Process %s exited with status %d (%s)\n", proc->name, status, status == 0 ? "success" : "error"); + virtual_destroy_dir(proc->page_dir); proc_clear_quantum(); // TODO: Add quantum to each process struct? - sti(); - hlt(); + + // The caller has to yield itself } void proc_yield(struct regs *r) diff --git a/kernel/features/syscall.c b/kernel/features/syscall.c index 2796372..2334947 100644 --- a/kernel/features/syscall.c +++ b/kernel/features/syscall.c @@ -82,6 +82,7 @@ static void syscall_handler(struct regs *r) } case SYS_EXIT: { proc_exit(proc_current(), (int)r->ebx); + proc_yield(r); break; } case SYS_BOOT: { // TODO: Move |