kernel/mmap: Fix some parameters
This commit is contained in:
parent
b447c1a261
commit
b5d146b492
@ -46,7 +46,7 @@ Result<u64> sys_mmap(Registers*, SyscallArgs args)
|
||||
else
|
||||
{
|
||||
if ((params.prot & PROT_WRITE) && !(description->flags & O_WRONLY)) return err(EACCES);
|
||||
shmid = TRY(description->inode->query_shared_memory(params.offset, params.len));
|
||||
shmid = TRY(description->inode->query_shared_memory(params.offset, params.len / ARCH_PAGE_SIZE));
|
||||
}
|
||||
shmem = g_shared_memory_map.try_get_ref(shmid);
|
||||
shmem->refs++;
|
||||
@ -72,10 +72,10 @@ Result<u64> sys_mmap(Registers*, SyscallArgs args)
|
||||
if (params.prot == PROT_NONE) mmu_flags = MMU::NoExecute;
|
||||
|
||||
#ifdef MMAP_DEBUG
|
||||
kdbgln("mmap: mapping memory at %#lx, size=%zu", address, len);
|
||||
kdbgln("mmap: mapping memory at %#lx, size=%zu", address, params.len);
|
||||
#endif
|
||||
|
||||
if (shmem) { TRY(shmem->map(address, mmu_flags, params.offset, get_blocks_from_size(params.len, ARCH_PAGE_SIZE))); }
|
||||
if (shmem) { TRY(shmem->map(address, mmu_flags, params.offset, params.len / ARCH_PAGE_SIZE)); }
|
||||
else
|
||||
{
|
||||
TRY(MemoryManager::alloc_at_zeroed(address, get_blocks_from_size(params.len, ARCH_PAGE_SIZE), mmu_flags));
|
||||
|
Loading…
Reference in New Issue
Block a user