ptos: pool: Add pool allocator groundwork
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
@@ -21,11 +21,20 @@
|
||||
#define POOL_LEVEL_GRAN(X) \
|
||||
(1 << ((X) + POOL_MIN_LOG2))
|
||||
|
||||
/*
|
||||
* Valid types that can be assigned to an allocated region
|
||||
*
|
||||
* @POOL_NON_PAGED: This type is not paged to disk
|
||||
*/
|
||||
typedef enum {
|
||||
POOL_NON_PAGED
|
||||
} POOL_TYPE;
|
||||
|
||||
/*
|
||||
* A pool page represents a single allocatable
|
||||
* unit within a pool segment.
|
||||
*
|
||||
* @Bitmap: Bitmap within pool page
|
||||
* @Bitmap: Bitmap within pool page [0=free, 1=allocated]
|
||||
* @Next: Next page within list
|
||||
*/
|
||||
typedef struct _POOL_PAGE {
|
||||
@@ -37,11 +46,11 @@ typedef struct _POOL_PAGE {
|
||||
* A pool segment represents a list of pages at a specific
|
||||
* granularity.
|
||||
*
|
||||
* @LastPage: Last page in segment
|
||||
* @FirstPage: Last page in segment
|
||||
* @PageCount: Number of pages in this segment
|
||||
*/
|
||||
typedef struct {
|
||||
POOL_PAGE *LastPage;
|
||||
POOL_PAGE *FirstPage;
|
||||
USIZE PageCount;
|
||||
} POOL_SEGMENT;
|
||||
|
||||
@@ -62,4 +71,19 @@ typedef struct {
|
||||
*/
|
||||
VOID ExPoolRegionInit(POOL_REGION *Region);
|
||||
|
||||
/*
|
||||
* Allocate a memory pool of a specific type and assign a tag
|
||||
* to it for verifying frees among other debugging needs.
|
||||
*
|
||||
* @Type: Pool type to assign
|
||||
* @ByteCount: Number of bytes to allocate
|
||||
* @Tag: Tag to assign to allocated memory
|
||||
*
|
||||
* Returns NULL upon failure.
|
||||
*/
|
||||
VOID *ExAllocatePoolWithTag(
|
||||
POOL_TYPE Type, USIZE ByteCount,
|
||||
ULONG Tag
|
||||
);
|
||||
|
||||
#endif /* !_EX_POOL_H_ */
|
||||
|
||||
Reference in New Issue
Block a user