| 30 | } |
| 31 | |
| 32 | void* liballoc_alloc(size_t pages) { |
| 33 | void* addr = (void*)Memory::KernelAllocate4KPages(pages); |
| 34 | for (size_t i = 0; i < pages; i++) |
| 35 | { |
| 36 | uint64_t phys = Memory::AllocatePhysicalMemoryBlock(); |
| 37 | Memory::KernelMapVirtualMemory4K(phys, (uint64_t)addr + i * PAGE_SIZE_4K, 1); |
| 38 | } |
| 39 | |
| 40 | memset(addr, 0, pages * PAGE_SIZE_4K); |
| 41 | |
| 42 | return addr; |
| 43 | } |
| 44 | |
| 45 | int liballoc_free(void* addr, size_t pages) { |
| 46 | for(size_t i = 0; i < pages; i++){ |
no test coverage detected