kernel: Allow mapping the framebuffer even if its size is not page-aligned
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-09-20 22:41:48 +02:00
parent b4a9ea3857
commit 14f0c93175
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -4,6 +4,7 @@
#include "video/Framebuffer.h"
#include <bits/ioctl-defs.h>
#include <luna/CString.h>
#include <luna/Alignment.h>
Result<void> FramebufferDevice::create()
{
@ -27,7 +28,7 @@ Result<usize> FramebufferDevice::write(const u8* buf, usize offset, usize length
Result<u64> FramebufferDevice::query_shared_memory(off_t offset, usize count)
{
if (offset + (count * ARCH_PAGE_SIZE) > Framebuffer::size()) return err(EINVAL);
if (offset + (count * ARCH_PAGE_SIZE) > align_up<ARCH_PAGE_SIZE>((u64)Framebuffer::size())) return err(EINVAL);
if (!m_shmid.has_value())
{