PatchworkOS
Loading...
Searching...
No Matches
pmm_stack.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
sys/proc.h
>
4
21
typedef
struct
page_buffer
22
{
26
struct
page_buffer*
prev
;
30
void
* pages[];
31
}
page_buffer_t
;
32
36
#define PMM_BUFFER_MAX ((PAGE_SIZE - sizeof(page_buffer_t)) / sizeof(void*))
37
41
typedef
struct
42
{
46
page_buffer_t
*
last
;
50
uint64_t
index
;
54
uint64_t
free
;
55
}
pmm_stack_t
;
56
62
void
pmm_stack_init
(
pmm_stack_t
*
stack
);
63
70
void
*
pmm_stack_alloc
(
pmm_stack_t
*
stack
);
71
78
void
pmm_stack_free
(
pmm_stack_t
*
stack
,
void
*
address
);
79
pmm_stack_alloc
void * pmm_stack_alloc(pmm_stack_t *stack)
Allocates a single page from the stack.
Definition
pmm_stack.c:12
pmm_stack_init
void pmm_stack_init(pmm_stack_t *stack)
Initializes a PMM stack.
Definition
pmm_stack.c:5
pmm_stack_free
void pmm_stack_free(pmm_stack_t *stack, void *address)
Frees a single page, returning it to the stack.
Definition
pmm_stack.c:36
address
static uintptr_t address
Definition
hpet.c:12
stack
static pmm_stack_t stack
Definition
pmm.c:36
proc.h
uint64_t
__UINT64_TYPE__ uint64_t
Definition
stdint.h:17
page_buffer_t
Structure for a page buffer in the PMM stack.
Definition
pmm_stack.h:22
page_buffer_t::prev
struct page_buffer * prev
Pointer to the previous page buffer in the stack.
Definition
pmm_stack.h:26
pmm_stack_t
PMM stack structure for managing higher physical memory.
Definition
pmm_stack.h:42
pmm_stack_t::free
uint64_t free
The number of free pages in the stack.
Definition
pmm_stack.h:54
pmm_stack_t::last
page_buffer_t * last
Pointer to the last page buffer in the stack.
Definition
pmm_stack.h:46
pmm_stack_t::index
uint64_t index
Current index within the pages array of the last page buffer.
Definition
pmm_stack.h:50
include
kernel
mem
pmm_stack.h
Generated by
1.9.8