vmm: dealwithrequest returns an errno rather than a bool

This commit is contained in:
Matheus
2022-12-13 23:43:26 -03:00
parent 881acb984d
commit ce474c670b
2 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ typedef struct {
void vmm_init();
void vmm_destroy(vmm_context* ctx);
void* vmm_tophysical(void* addr);
bool vmm_dealwithrequest(void* addr, long error, bool user);
int vmm_dealwithrequest(void* addr, long error, bool user);
bool vmm_setused(void* addr, size_t pagec, size_t mmuflags);
bool vmm_unmap(void* addr, size_t pagec);
bool vmm_map(void* paddr, void* vaddr, size_t pagec, size_t mmuflags);
+8 -8
View File
@@ -638,27 +638,27 @@ bool vmm_allocnowat(void* addr, size_t mmuflags, size_t size){
// called by the page fault handler
bool vmm_dealwithrequest(void* addr, long error, bool user){
int vmm_dealwithrequest(void* addr, long error, bool user){
if(user && addr > USER_SPACE_END)
return false;
return EFAULT;
int* lock;
vmm_mapping** start = NULL;
getcontextinfo(addr, &lock, &start);
if(!start) return false;
if(!start) return EFAULT;
spinlock_acquire(lock);
bool status;
int status;
vmm_mapping* map = findmappingfromaddr(*start, addr);
void* paddr;
if((!map) || map->type == VMM_TYPE_FREE){
status = false;
status = EFAULT;
goto done;
}
@@ -675,7 +675,7 @@ bool vmm_dealwithrequest(void* addr, long error, bool user){
if(goodmmuflags != (map->mmuflags & goodmmuflags)){
status = false;
status = EFAULT;
goto done;
}
@@ -697,7 +697,7 @@ bool vmm_dealwithrequest(void* addr, long error, bool user){
if(addr == NULL || arch_mmu_map(cls->context->context, paddr, addr, map->mmuflags) == false){
status = false;
status = ENOMEM;
goto done;
}
@@ -709,7 +709,7 @@ bool vmm_dealwithrequest(void* addr, long error, bool user){
vfs_read(&err, map->data, addr, PAGE_SIZE, map->offset + offset, NULL);
}
status = true;
status = 0;
done: