kernel: Take devices into account in SharedMemory::free()
This commit is contained in:
parent
bfcca3a220
commit
641b65da0f
@ -107,12 +107,16 @@ Result<void> SharedMemory::map(u64 virt, int flags, off_t _offset, usize count)
|
|||||||
|
|
||||||
void SharedMemory::free()
|
void SharedMemory::free()
|
||||||
{
|
{
|
||||||
if (inode && (prot & PROT_WRITE))
|
if ((inode || device) && (prot & PROT_WRITE))
|
||||||
{
|
{
|
||||||
for (u64 i = 0; i < frames.size(); i++)
|
for (u64 i = 0; i < frames.size(); i++)
|
||||||
{
|
{
|
||||||
inode->write((u8*)MMU::translate_physical_address(frames[i]), offset + (i * ARCH_PAGE_SIZE),
|
if (inode)
|
||||||
ARCH_PAGE_SIZE);
|
inode->write((u8*)MMU::translate_physical_address(frames[i]), offset + (i * ARCH_PAGE_SIZE),
|
||||||
|
ARCH_PAGE_SIZE);
|
||||||
|
if (device)
|
||||||
|
device->write((u8*)MMU::translate_physical_address(frames[i]), offset + (i * ARCH_PAGE_SIZE),
|
||||||
|
ARCH_PAGE_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user