PatchworkOS
Loading...
Searching...
No Matches
stack_pointer.h File Reference
#include <kernel/mem/paging_types.h>
#include <kernel/sched/sched.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  stack_pointer_t
 Structure to define a stack in memory. More...
 

Macros

#define STACK_POINTER_GUARD_PAGES   1
 The amount of guard pages to use for stacks.
 

Functions

uint64_t stack_pointer_init (stack_pointer_t *stack, uintptr_t maxAddress, uint64_t maxPages)
 Initializes a stack pointer structure, does not allocate or map any memory.
 
uint64_t stack_pointer_init_buffer (stack_pointer_t *stack, void *buffer, uint64_t pages)
 Initializes a stack pointer structure using a provided buffer, does not allocate or map any memory.
 
void stack_pointer_deinit (stack_pointer_t *stack, thread_t *thread)
 Deinitializes a stack pointer structure and unmaps any mapped memory.
 
void stack_pointer_deinit_buffer (stack_pointer_t *stack)
 Deinitializes a stack pointer structure that was initialized using stack_pointer_init_buffer().
 
bool stack_pointer_is_in_stack (stack_pointer_t *stack, uintptr_t addr, uint64_t length)
 Check if an region is within the stack.
 
bool stack_pointer_overlaps_guard (stack_pointer_t *stack, uintptr_t addr, uint64_t length)
 Check if an region overlaps the guard.