PatchworkOS  dbbdc99
A non-POSIX operating system.
Loading...
Searching...
No Matches
stack_pointer.h File Reference
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for stack_pointer.h:
This graph shows which files directly or indirectly include this file:

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.
 

Typedefs

typedef struct thread thread_t
 

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.
 
void stack_pointer_poke (uint64_t offset)
 Poke the stack to ensure that a page fault will occur at the given offset.
 

Typedef Documentation

◆ thread_t

typedef struct thread thread_t

Definition at line 6 of file stack_pointer.h.