| 468 | } |
| 469 | |
| 470 | U32 DevFB::map(KThread* thread, U32 address, U32 len, S32 prot, S32 flags, U64 off) { |
| 471 | if ((flags & K_MAP_FIXED) && address!=fb_fix_screeninfo.smem_start) { |
| 472 | kpanic("Mapping /dev/fb at fixed address not supported"); |
| 473 | } |
| 474 | U32 pageStart = fb_fix_screeninfo.smem_start >> K_PAGE_SHIFT; |
| 475 | U32 pageCount = (len+K_PAGE_SIZE-1)>>K_PAGE_SHIFT; |
| 476 | |
| 477 | KMemory* memory = thread->memory; |
| 478 | KMemoryData* mem = getMemData(memory); |
| 479 | |
| 480 | if (len<fb_fix_screeninfo.smem_len) { |
| 481 | pageCount=fb_fix_screeninfo.smem_len >> K_PAGE_SHIFT; |
| 482 | } |
| 483 | if (!screenPixels) { |
| 484 | screenPixels = new U8[1280 * 1024 * 4]; |
| 485 | } |
| 486 | for (U32 i=0;i<pageCount;i++) { |
| 487 | MMU& mmu = mem->mmu[i + pageStart]; |
| 488 | if (mmu.getPageType() != PageType::None) { |
| 489 | kpanic("Something else got mapped into the framebuffer address"); |
| 490 | } |
| 491 | RamPage ram = ramPageAllocNative(screenPixels + (i << K_PAGE_SHIFT)); |
| 492 | mmu.setPage(memory, i + pageStart, PageType::Ram, ram); |
| 493 | mmu.setFlags(flags); |
| 494 | ramPageRelease(ram); // setPage retains |
| 495 | } |
| 496 | return fb_fix_screeninfo.smem_start; |
| 497 | } |
| 498 | |
| 499 | bool DevFB::canMap() { |
| 500 | return true; |
nothing calls this directly
no test coverage detected