Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void* vmm_alloc_in_range(uint32_t low, uint32_t high, uint32_t* retpaddr, uint32_t cont) {
- void* vaddr = 0;
- uint32_t i = 0;
- uint32_t c = 0;
- for(i = (low & 0xFFFFF000); i < high; i += 0x1000) {
- if((active_pagetables[i >> 12] & (PT_ALLOCATABLE | PT_PRESENT)) == PT_ALLOCATABLE) {
- if(c == 0) vaddr = (void*) i;
- c++;
- if(c >= cont)
- break;
- }
- else
- {
- c = 0;
- }
- }
- uint32_t off = 0;
- while(c--) {
- vmm_alloc_addr(vaddr + off * 0x1000, off == 0 ? retpaddr : 0);
- off++;
- }
- return vaddr;
- }
Advertisement
Add Comment
Please, Sign In to add comment