diff --git a/core/process.c b/core/process.c index 90acb13..12232c7 100644 --- a/core/process.c +++ b/core/process.c @@ -4,12 +4,13 @@ #include "klibc.h" #include "list.h" #include "mmuContext.h" +#include "uaddrspace.h" struct process { char name[PROCESS_NAME_MAX_LENGTH]; int ref; int pid; - struct mmu_context *context; + struct uAddrSpace *addrSpace; struct thread *thList; struct process *prev, *next; @@ -35,10 +36,9 @@ struct process *processCreate(char *name) if (new == NULL) return NULL; - new->context = mmuContextCreate(); - if (new->context == NULL) { + new->addrSpace = uAddrSpaceCreate(new); + if(new->addrSpace == NULL){ free(new); - return NULL; } @@ -103,6 +103,7 @@ int processRef(struct process *proc) int processUnref(struct process *proc) { uint32_t flags; + int ret; assert(proc->ref > 0); @@ -116,10 +117,10 @@ int processUnref(struct process *proc) list_delete(processList, proc); restore_IRQs(flags); - mmuContextUnref(proc->context); + ret = uAddrSpaceDelete(proc->addrSpace); free(proc); - return 0; + return ret; } int processAddThread(struct process *proc, struct thread *th) @@ -164,5 +165,5 @@ int processSetName(struct process *proc, char *name) struct mmu_context *processGetMMUContext(struct process *proc) { - return proc->context; + return uAddrSpaceGetMMUContext(proc->addrSpace); }