properly zero memory on demand paging and mmap

This commit is contained in:
Matheus
2022-08-20 00:01:54 -03:00
parent c9762db4cc
commit 1ed7aafa46
2 changed files with 8 additions and 6 deletions
+2
View File
@@ -580,6 +580,8 @@ bool vmm_dealwithrequest(void* addr, long error, bool user){
status = true;
memset(addr, 0, PAGE_SIZE);
done:
spinlock_release(lock);
+6 -6
View File
@@ -84,14 +84,14 @@ syscallret syscall_mmap(void* hint, size_t len, int prot, int flags, int fd, off
if(ret == NULL && (flags & MAP_FIXED) == 0)
ret = vmm_allocfrom(USER_ALLOC_START, mmuflags, plen);
if(!ret){
if(!ret)
retv.errno = ENOMEM;
if(flags & MAP_ANON)
memset(ret, 0, plen);
}
else
else{
retv.ret = ret;
if(hint && (flags & MAP_ANON))
memset(ret, 0, plen*PAGE_SIZE);
}
return retv;
}