PatchworkOS
Loading...
Searching...
No Matches
space.h File Reference
#include <kernel/cpu/stack_pointer.h>
#include <kernel/fs/path.h>
#include <kernel/mem/paging_types.h>
#include <kernel/sched/wait.h>
#include <kernel/sync/lock.h>
#include <boot/boot_info.h>
#include <sys/bitmap.h>
#include <sys/list.h>
#include <sys/proc.h>

Go to the source code of this file.

Data Structures

struct  space_callback_t
 
struct  space_pinned_page_t
 Pinned page structure. More...
 
struct  space_t
 Virtual address space structure. More...
 
struct  space_mapping_t
 Helper structure for managing address space mappings. More...
 

Macros

#define SPACE_TLB_SHOOTDOWN_TIMEOUT   (CLOCKS_PER_SEC)
 The maximum time to wait for the acknowledgements from other CPU's before panicking.
 

Typedefs

typedef void(* space_callback_func_t) (void *private)
 Space callback function.
 

Enumerations

enum  space_flags_t {
  SPACE_NONE = 0 ,
  SPACE_USE_PMM_BITMAP = 1 << 0 ,
  SPACE_MAP_KERNEL_BINARY = 1 << 1 ,
  SPACE_MAP_KERNEL_HEAP = 1 << 2 ,
  SPACE_MAP_IDENTITY = 1 << 3
}
 Flags for space initialization. More...
 

Functions

uint64_t space_init (space_t *space, uintptr_t startAddress, uintptr_t endAddress, space_flags_t flags)
 Initializes a virtual address space.
 
void space_deinit (space_t *space)
 Deinitializes a virtual address space.
 
void space_load (space_t *space)
 Loads a virtual address space.
 
uint64_t space_pin (space_t *space, const void *address, uint64_t length, stack_pointer_t *userStack)
 Pins pages within a region of the address space.
 
uint64_t space_pin_terminated (space_t *space, const void *address, const void *terminator, uint8_t objectSize, uint64_t maxCount, stack_pointer_t *userStack)
 Pins a region of memory terminated by a terminator value.
 
void space_unpin (space_t *space, const void *address, uint64_t length)
 Unpins pages in a region previously pinned with space_pin() or space_pin_string().
 
uint64_t space_check_access (space_t *space, const void *addr, uint64_t length)
 Checks if a virtual memory region is within the allowed address range of the space.
 
uint64_t space_mapping_start (space_t *space, space_mapping_t *mapping, void *virtAddr, void *physAddr, uint64_t length, pml_flags_t flags)
 Prepare for changes to the address space mappings.
 
pml_callback_id_t space_alloc_callback (space_t *space, uint64_t pageAmount, space_callback_func_t func, void *private)
 Allocate a callback.
 
void space_free_callback (space_t *space, pml_callback_id_t callbackId)
 Free a callback.
 
void space_tlb_shootdown (space_t *space, void *virtAddr, uint64_t pageAmount)
 Performs a TLB shootdown for a region of the address space, and wait for acknowledgements.
 
void * space_mapping_end (space_t *space, space_mapping_t *mapping, errno_t err)
 Performs cleanup after changes to the address space mappings.
 
bool space_is_mapped (space_t *space, const void *virtAddr, uint64_t length)
 Checks if a virtual memory region is fully mapped.