1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:58:11 +00:00

Kernel: Add "video" pledge for accessing framebuffer devices

WindowServer becomes the only user.
This commit is contained in:
Andreas Kling 2020-01-12 02:17:30 +01:00
parent bb6b9d9059
commit 017b34e1ad
5 changed files with 28 additions and 23 deletions

View file

@ -86,6 +86,7 @@ u32 BXVGADevice::find_framebuffer_address()
KResultOr<Region*> BXVGADevice::mmap(Process& process, FileDescription&, VirtualAddress preferred_vaddr, size_t offset, size_t size, int prot)
{
REQUIRE_PROMISE(video);
ASSERT(offset == 0);
ASSERT(size == framebuffer_size_in_bytes());
auto vmobject = AnonymousVMObject::create_for_physical_range(m_framebuffer_address, framebuffer_size_in_bytes());
@ -105,6 +106,7 @@ KResultOr<Region*> BXVGADevice::mmap(Process& process, FileDescription&, Virtual
int BXVGADevice::ioctl(FileDescription&, unsigned request, unsigned arg)
{
REQUIRE_PROMISE(video);
switch (request) {
case FB_IOCTL_GET_SIZE_IN_BYTES: {
auto* out = (size_t*)arg;