![]() |
FrostWing
A lightweight raw-control operating system.
|
Custom memory manipulation functions. More...


Go to the source code of this file.
Classes | |
| struct | memory_context |
Functions | |
| void * | memcpy (void *dest, const void *src, size_t n) |
| Copies a block of memory from a source location to a destination location. | |
| void * | memset (void *s, int c, size_t n) |
| Sets a block of memory to a specified value. | |
| void * | memmove (void *dest, const void *src, size_t n) |
| Copies a block of memory from a source location to a destination location, possibly overlapping. | |
| int | memcmp (const void *s1, const void *s2, size_t n) |
| Compares two blocks of memory. | |
| void | memory_dump (const void *start, const void *end) |
| Dump memory content from start to end. | |
| void * | allocate_memory_at_address (int64 phys_addr, size_t size) |
| Allocates memory at an specific address. | |
| void | display_memory_formatted (struct memory_context *memory) |
| Display the formatted memory context. | |
| void | analyze_memory_map (struct memory_context *memory, volatile struct limine_memmap_request memory_map_request) |
| Reads the Limine memory map and saves to an usable context. | |
| uint64_t | getCR2 () |
| Returns the CR2 register. | |
Custom memory manipulation functions.
This header file defines custom memory manipulation functions that are equivalent to the standard C library functions memcpy, memset, memmove, and memcmp.
Definition in file memory.h.
| void * allocate_memory_at_address | ( | int64 | phys_addr, |
| size_t | size ) |
Allocates memory at an specific address.
| phys_addr | Physical address to allocate memory. |
| size | Size of the memory to allocate. |
| void analyze_memory_map | ( | struct memory_context * | memory, |
| volatile struct limine_memmap_request | memory_map_request ) |
Reads the Limine memory map and saves to an usable context.
| memory | The memory context. |
| memory_map_request | Limine Memory Mam Request. |
| void display_memory_formatted | ( | struct memory_context * | memory | ) |
Display the formatted memory context.
| memory | The memory context to display. |
| uint64_t getCR2 | ( | ) |
Returns the CR2 register.
| int memcmp | ( | const void * | s1, |
| const void * | s2, | ||
| size_t | n ) |
Compares two blocks of memory.
This function compares the first 'n' bytes of memory in 's1' and 's2'.
| s1 | Pointer to the first memory location. |
| s2 | Pointer to the second memory location. |
| n | Number of bytes to compare. |
| void * memcpy | ( | void * | dest, |
| const void * | src, | ||
| size_t | n ) |
Copies a block of memory from a source location to a destination location.
This function copies 'n' bytes of memory from 'src' to 'dest'. The source and destination memory areas should not overlap.
| dest | Pointer to the destination memory location. |
| src | Pointer to the source memory location. |
| n | Number of bytes to copy. |
| void * memmove | ( | void * | dest, |
| const void * | src, | ||
| size_t | n ) |
Copies a block of memory from a source location to a destination location, possibly overlapping.
This function copies 'n' bytes of memory from 'src' to 'dest'. The source and destination memory areas may overlap. In such cases, it ensures the correct copy by choosing the appropriate copy direction.
| dest | Pointer to the destination memory location. |
| src | Pointer to the source memory location. |
| n | Number of bytes to copy. |
| void memory_dump | ( | const void * | start, |
| const void * | end ) |
Dump memory content from start to end.
This function iterates through the memory addresses from start to end and prints the address and corresponding value in hexadecimal format.
| start | Pointer to the start address of the memory to be dumped. |
| end | Pointer to the end address of the memory to be dumped. |
| void * memset | ( | void * | s, |
| int | c, | ||
| size_t | n ) |
Sets a block of memory to a specified value.
This function sets the first 'n' bytes of the memory block at 's' to the value 'c'.
| s | Pointer to the memory location. |
| c | Value to set (as an integer). |
| n | Number of bytes to set. |