src/kernel/mm/vmm/vmm.c
/**
 * @note alloc virtual pages from vmm pool , but not alloc physic pages.
 * @param vmm_pool
 * @param vaddr
 * @param page_count
 * @return
 */
@note alloc virtual pages from vmm pool , but not alloc physic pages.
@note alloc virtual pages from vmm pool but not alloc physic pages .
addr_t valloc_raw_no_lock(vmm_t * vmm_pool, addr_t vaddr , size_t page_count) {
    addr_t ret;
    bitmap_t * vmm_bitmap = &vmm_pool->bitmap;
    size_t bitmap_bit_num;
    if (vaddr != ADDR_NOT_ASSIGNED) {
        bitmap_bit_num = bitmap_alloc_target(vmm_bitmap,
                                             (vaddr-vmm_pool->vmm_start)/PAGE_SIZE,
                                             page_count
        );
    }
    else {
        bitmap_bit_num = bitmap_alloc(vmm_bitmap, page_count);
    }
    if (bitmap_bit_num == BITMAP_ALLOC_ERROR) {
        ret = NULL;
        goto out;
    }
    else {
        ret = PAGE_ALIGN(vaddr);
    }
    out:
    return ret;
}
addr_t valloc_raw_no_lock ( vmm_t * vmm_pool , addr_t vaddr , size_t page_count ) { addr_t ret ; bitmap_t * vmm_bitmap = & vmm_pool -> bitmap ; size_t bitmap_bit_num ; if ( vaddr != ADDR_NOT_ASSIGNED ) { bitmap_bit_num = bitmap_alloc_target ( vmm_bitmap , ( vaddr - vmm_pool -> vmm_start ) / PAGE_SIZE , page_count ) ; } else { bitmap_bit_num = bitmap_alloc ( vmm_bitmap , page_count ) ; } if ( bitmap_bit_num == BITMAP_ALLOC_ERROR ) { ret = NULL ; goto out ; } else { ret = PAGE_ALIGN ( vaddr ) ; } out : return ret ; }
@note alloc virtual pages from vmm pool , but not alloc physic pages.
@note alloc virtual pages from vmm pool but not alloc physic pages .