lib/aos/paging3.c
errval_t paging_region_map(struct paging_region *pr, size_t req_size,
                           void **retbuf, size_t *ret_size)
{
    lvaddr_t end_addr = pr->base_addr + pr->region_size;
    size_t rem = end_addr - pr->current_addr;
    if (rem > req_size) {
        // ok
        *retbuf = (void*)pr->current_addr;
        *ret_size = req_size;
        pr->current_addr += req_size;
    } else if (rem > 0) {
        *retbuf = (void*)pr->current_addr;
        *ret_size = rem;
        pr->current_addr += rem;
        debug_printf("exhausted paging region, "
                "expect badness on next allocation\n");
    } else {
        return LIB_ERR_VSPACE_MMU_AWARE_NO_SPACE;
    }
    return SYS_ERR_OK;
}
/**
 * \brief return a pointer to a bit of the paging region `pr`.
 * This function gets used in some of the code that is responsible
 * for allocating Frame (and other) capabilities.
 */
\brief return a pointer to a bit of the paging region `pr`.
This function gets used in some of the code that is responsible
for allocating Frame (and other) capabilities.
\ brief return a pointer to a bit of the paging region ` pr ` . This function gets used in some of the code that is responsible for allocating Frame ( and other ) capabilities .
errval_t paging_region_map(struct paging_region *pr, size_t req_size,
                           void **retbuf, size_t *ret_size)
{
    lvaddr_t end_addr = pr->base_addr + pr->region_size;
    size_t rem = end_addr - pr->current_addr;
    if (rem > req_size) {
        *retbuf = (void*)pr->current_addr;
        *ret_size = req_size;
        pr->current_addr += req_size;
    } else if (rem > 0) {
        *retbuf = (void*)pr->current_addr;
        *ret_size = rem;
        pr->current_addr += rem;
        debug_printf("exhausted paging region, "
                "expect badness on next allocation\n");
    } else {
        return LIB_ERR_VSPACE_MMU_AWARE_NO_SPACE;
    }
    return SYS_ERR_OK;
}
errval_t paging_region_map ( struct paging_region * pr , size_t req_size , void * * retbuf , size_t * ret_size ) { lvaddr_t end_addr = pr -> base_addr + pr -> region_size ; size_t rem = end_addr - pr -> current_addr ; if ( rem > req_size ) { * retbuf = ( void * ) pr -> current_addr ; * ret_size = req_size ; pr -> current_addr += req_size ; } else if ( rem > 0 ) { * retbuf = ( void * ) pr -> current_addr ; * ret_size = rem ; pr -> current_addr += rem ; debug_printf ( " " " \n " ) ; } else { return LIB_ERR_VSPACE_MMU_AWARE_NO_SPACE ; } return SYS_ERR_OK ; }
\brief return a pointer to a bit of the paging region `pr`.
\ brief return a pointer to a bit of the paging region ` pr ` .
// ok