The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
region.h File Reference
#include "common/stdint.h"
#include "kernel/memory/phys.h"

Go to the source code of this file.

Data Structures

struct  region_entry_t
 a single reserved memory region with byte-granularity boundaries. More...

Macros

#define REGION_TABLE_MAX   16
 maximum number of reserved memory regions the table can hold.

Functions

void region_reserve (phys_addr_t start, phys_addr_t end, const char *label)
 reserve a memory region by recording it in the global table.
bool region_is_reserved (phys_addr_t address)
 check whether a single address falls inside any reserved region.
bool region_overlaps (phys_addr_t start, phys_addr_t end)
 check whether a range overlaps any reserved region.
uint32_t region_count (void)
 return the number of currently reserved regions.
void region_print_all (void)
 print all reserved regions to the console.

Macro Definition Documentation

◆ REGION_TABLE_MAX

#define REGION_TABLE_MAX   16

maximum number of reserved memory regions the table can hold.

Function Documentation

◆ region_reserve()

void region_reserve ( phys_addr_t start,
phys_addr_t end,
const char * label )

reserve a memory region by recording it in the global table.

panics if the table is full.

Parameters
startfirst byte of the region (inclusive).
endfirst byte past the region (exclusive).
labelhuman-readable name for debug output.

◆ region_is_reserved()

bool region_is_reserved ( phys_addr_t address)

check whether a single address falls inside any reserved region.

Parameters
addressthe physical address to test.
Returns
true if the address is reserved, false otherwise.

◆ region_overlaps()

bool region_overlaps ( phys_addr_t start,
phys_addr_t end )

check whether a range overlaps any reserved region.

Parameters
startfirst byte of the range (inclusive).
endfirst byte past the range (exclusive).
Returns
true if any overlap exists, false otherwise.

◆ region_count()

uint32_t region_count ( void )

return the number of currently reserved regions.

◆ region_print_all()

void region_print_all ( void )

print all reserved regions to the console.