src/kernel/mm/pmm/pmm.c
/**
 * @note alloc physic pages
 * @param page_count
 * @return physic addr when success
 *         NULL when fail
 */
@note alloc physic pages
@param page_count
@return physic addr when success
NULL when fail
@note alloc physic pages @param page_count @return physic addr when success NULL when fail
void * pmm_alloc(size_t page_count){
    void * ret;
    size_t bitmap_ret;
    int order;
    base_t level = intrLock_lock(&pmm_lock);
    order = _pages_2_alloc_pages_order(page_count);
    if (order < 0) {
        ret = NULL;
        goto out;
    }
    else {
        addr_t addr = buddy_alloc(&buddy_pool, order);
        if (addr == BUDDY_ALLOC_ERROR) {
            ret = NULL;
            goto out;
        }
        else {
            ret = addr;
            memset(ret, 0, page_count * PAGE_SIZE);
            goto out;
        }
    }
    out:
    intrLock_unlock(&pmm_lock,level);
    return ret;
}
void * pmm_alloc ( size_t page_count ) { void * ret ; size_t bitmap_ret ; int order ; base_t level = intrLock_lock ( & pmm_lock ) ; order = _pages_2_alloc_pages_order ( page_count ) ; if ( order < 0 ) { ret = NULL ; goto out ; } else { addr_t addr = buddy_alloc ( & buddy_pool , order ) ; if ( addr == BUDDY_ALLOC_ERROR ) { ret = NULL ; goto out ; } else { ret = addr ; memset ( ret , 0 , page_count * PAGE_SIZE ) ; goto out ; } } out : intrLock_unlock ( & pmm_lock , level ) ; return ret ; }
@note alloc physic pages
 @param page_count
 @return physic addr when success
         NULL when fail
@note alloc physic pages @param page_count @return physic addr when success NULL when fail
//fail