mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
vmm: dealwithrequest returns an errno rather than a bool
This commit is contained in:
@@ -57,7 +57,7 @@ typedef struct {
|
|||||||
void vmm_init();
|
void vmm_init();
|
||||||
void vmm_destroy(vmm_context* ctx);
|
void vmm_destroy(vmm_context* ctx);
|
||||||
void* vmm_tophysical(void* addr);
|
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_setused(void* addr, size_t pagec, size_t mmuflags);
|
||||||
bool vmm_unmap(void* addr, size_t pagec);
|
bool vmm_unmap(void* addr, size_t pagec);
|
||||||
bool vmm_map(void* paddr, void* vaddr, size_t pagec, size_t mmuflags);
|
bool vmm_map(void* paddr, void* vaddr, size_t pagec, size_t mmuflags);
|
||||||
|
|||||||
+8
-8
@@ -638,27 +638,27 @@ bool vmm_allocnowat(void* addr, size_t mmuflags, size_t size){
|
|||||||
|
|
||||||
// called by the page fault handler
|
// 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)
|
if(user && addr > USER_SPACE_END)
|
||||||
return false;
|
return EFAULT;
|
||||||
|
|
||||||
int* lock;
|
int* lock;
|
||||||
vmm_mapping** start = NULL;
|
vmm_mapping** start = NULL;
|
||||||
|
|
||||||
getcontextinfo(addr, &lock, &start);
|
getcontextinfo(addr, &lock, &start);
|
||||||
|
|
||||||
if(!start) return false;
|
if(!start) return EFAULT;
|
||||||
|
|
||||||
spinlock_acquire(lock);
|
spinlock_acquire(lock);
|
||||||
|
|
||||||
|
|
||||||
bool status;
|
int status;
|
||||||
vmm_mapping* map = findmappingfromaddr(*start, addr);
|
vmm_mapping* map = findmappingfromaddr(*start, addr);
|
||||||
void* paddr;
|
void* paddr;
|
||||||
|
|
||||||
if((!map) || map->type == VMM_TYPE_FREE){
|
if((!map) || map->type == VMM_TYPE_FREE){
|
||||||
status = false;
|
status = EFAULT;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -675,7 +675,7 @@ bool vmm_dealwithrequest(void* addr, long error, bool user){
|
|||||||
|
|
||||||
|
|
||||||
if(goodmmuflags != (map->mmuflags & goodmmuflags)){
|
if(goodmmuflags != (map->mmuflags & goodmmuflags)){
|
||||||
status = false;
|
status = EFAULT;
|
||||||
goto done;
|
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){
|
if(addr == NULL || arch_mmu_map(cls->context->context, paddr, addr, map->mmuflags) == false){
|
||||||
status = false;
|
status = ENOMEM;
|
||||||
goto done;
|
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);
|
vfs_read(&err, map->data, addr, PAGE_SIZE, map->offset + offset, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = true;
|
status = 0;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user