forked from Bananymous/banan-os
Kernel: Allow cloning of mmapped framebuffer regions
This commit is contained in:
parent
0f1c740fe8
commit
6cd5763361
|
@ -233,8 +233,14 @@ namespace Kernel
|
||||||
|
|
||||||
virtual BAN::ErrorOr<BAN::UniqPtr<MemoryRegion>> clone(PageTable& new_page_table) override
|
virtual BAN::ErrorOr<BAN::UniqPtr<MemoryRegion>> clone(PageTable& new_page_table) override
|
||||||
{
|
{
|
||||||
(void)new_page_table;
|
auto* region_ptr = new FramebufferMemoryRegion(new_page_table, m_size, m_type, m_flags, m_framebuffer);
|
||||||
return BAN::Error::from_errno(ENOTSUP);
|
if (region_ptr == nullptr)
|
||||||
|
return BAN::Error::from_errno(ENOMEM);
|
||||||
|
auto region = BAN::UniqPtr<FramebufferMemoryRegion>::adopt(region_ptr);
|
||||||
|
|
||||||
|
TRY(region->initialize({ m_vaddr, m_vaddr + BAN::Math::div_round_up(m_size, PAGE_SIZE) * PAGE_SIZE }));
|
||||||
|
|
||||||
|
return BAN::UniqPtr<MemoryRegion>(BAN::move(region));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue