MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / SysMapFB

Function SysMapFB

Kernel/src/arch/x86_64/syscalls.cpp:481–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479}
480
481long SysMapFB(regs64_t *r){
482 video_mode_t vMode = Video::GetVideoMode();
483
484 uint64_t pageCount = (vMode.height * vMode.pitch + 0xFFF) >> 12;
485 uintptr_t fbVirt = (uintptr_t)Memory::Allocate4KPages(pageCount, Scheduler::GetCurrentProcess()->addressSpace);
486 Memory::MapVirtualMemory4K((uintptr_t)HAL::videoMode.physicalAddress,fbVirt,pageCount,Scheduler::GetCurrentProcess()->addressSpace);
487
488 mem_region_t memR;
489 memR.base = fbVirt;
490 memR.pageCount = pageCount;
491 Scheduler::GetCurrentProcess()->sharedMemory.add_back(memR);
492
493 fb_info_t fbInfo;
494 fbInfo.width = vMode.width;
495 fbInfo.height = vMode.height;
496 fbInfo.bpp = vMode.bpp;
497 fbInfo.pitch = vMode.pitch;
498
499 if(HAL::debugMode) fbInfo.height = vMode.height / 3 * 2;
500
501 *((uintptr_t*)SC_ARG0(r)) = fbVirt;
502 *((fb_info_t*)SC_ARG1(r)) = fbInfo;
503
504 return 0;
505}
506
507long SysAlloc(regs64_t* r){
508 uint64_t pageCount = SC_ARG0(r);

Callers

nothing calls this directly

Calls 5

GetVideoModeFunction · 0.85
Allocate4KPagesFunction · 0.85
GetCurrentProcessFunction · 0.85
MapVirtualMemory4KFunction · 0.85
add_backMethod · 0.45

Tested by

no test coverage detected