21 lines
737 B
C
21 lines
737 B
C
// SPDX-License-Identifier: MPL-2.0
|
|
#ifndef SH_LIB_PBA_H
|
|
#define SH_LIB_PBA_H
|
|
#include "std/type.h"
|
|
#include "std/status.h"
|
|
#include "memory/page.h"
|
|
#include "memory/pez/pez.h"
|
|
// Page block allocator
|
|
typedef struct {
|
|
sh_page_VIRTUAL_ADDRESS start_va;
|
|
sh_uint64 total_pages;
|
|
sh_uint64 block_pages;
|
|
sh_uint64 block_count;
|
|
sh_uint64 max_blocks;
|
|
} sh_pba_PAGE_BLOCK_ALLOCATOR;
|
|
// Initialize a page block allocator
|
|
SH_STATUS sh_pba_init(sh_pba_PAGE_BLOCK_ALLOCATOR *pba,sh_page_VIRTUAL_ADDRESS start_va,sh_uint64 area_pages_amount,sh_uint64 block_pages);
|
|
// Allocate a block and return corresponding pointer
|
|
SH_STATUS sh_pba_alloc(sh_pba_PAGE_BLOCK_ALLOCATOR *pba,sh_page_PAGE_TABLE_POOL *ptp,sh_page_VIRTUAL_ADDRESS *ptr);
|
|
#endif
|