forked from lolo859/vystem
Vystem 0.2
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
## Introduction
|
||||
|
||||
The memory subsystem is responsible for handling tasks like physical pages allocations, virtual memory management, initial memory map analysis, pages mapping and unmapping and kernel heap management.
|
||||
The memory subsystem is responsible for handling tasks like physical pages allocations, virtual memory management, initial memory map analysis, pages mapping and unmapping and kernel heap management. Please note that, unless used with `sh_malloc` or `sh_free`, no object or function described in this subsystem is thread safe.
|
||||
|
||||
## Summary
|
||||
|
||||
@@ -14,3 +14,12 @@ The memory subsystem is responsible for handling tasks like physical pages alloc
|
||||
6) [Radix trees subsystem](radix.md)
|
||||
7) [Pez plane manager](pez.md)
|
||||
8) [Kernel heap manager](heap.md)
|
||||
|
||||
## Memory subsystem
|
||||
|
||||
The memory subsystem is defined into `shelter/lib/include/memory/memory.h` and implemented into `shelter/lib/include/memory/memory.c`.
|
||||
|
||||
The entire memory subsystem is initialized with the `sh_memory_init_subsystem()` function. This function produces a `sh_memory_MEMORY_SERVICES` struct, which is stored in the main file and contains all the elements necessary for the memory subsystem initialization.
|
||||
|
||||
The memory subsystem also provides some higher level functions:
|
||||
- `sh_memory_identity_map(sh_page_PHYSICAL_ADDRESS phys_start,sh_uint64 page_count,sh_uint64 flags)`: identity map a range of physical pages into the page table of the booting kernel. It is not thread safe.
|
||||
|
||||
@@ -85,6 +85,9 @@ This role of memory allocations is lost once Pez is initialized.
|
||||
The Page subsystem provide the following functions regarding memory statistics:
|
||||
- `sh_uint64 sh_page_get_physical_memory_amount_pages()`: return amount of physical memory installed in pages
|
||||
- `sh_uint64 sh_page_get_physical_memory_amount_bytes()`: return amount of physical memory installed in bytes
|
||||
- `sh_uint64 sh_page_get_installed_memory_bytes()`: return the amount of physical memory in pages counted as free when parsing the memory map
|
||||
- `SH_STATUS sh_page_get_memory_stats(sh_page_MEM_STATS *mem_stats)`: provide a extensive amount of statistics on physical memory.
|
||||
|
||||
For a more human-readable output, the function `sh_log_mem_stats` can be used.
|
||||
For a more human-readable output, the function `sh_log_mem_stats` can be used for debugging purposes. It doesn't rely on Pez.
|
||||
|
||||
When Pez is ready, please uses instead the DevS memory subsystem endpoint, it's faster and refined.
|
||||
|
||||
@@ -6,6 +6,6 @@ The memory subsystem provide a simple ring buffer API, mainly used by the log AP
|
||||
|
||||
## Overview
|
||||
|
||||
The main structure for a ring buffer is `sh_ring_RING_BUFFER_HEADER`. The function provided by the API are volontary very simple for the moment:
|
||||
The main structure for a ring buffer is `sh_ring_RING_BUFFER_HEADER`. The function provided by the API are volontarily very simple for the moment:
|
||||
- `SH_STATUS sh_ring_write_byte(sh_ring_RING_BUFFER_HEADER *ring_buffer,sh_uint8 byte)`: write a byte inside provided ring buffer
|
||||
- `SH_STATUS sh_ring_write_string(sh_ring_RING_BUFFER_HEADER *ring_buffer,char *string)`: write a null-terminated string inside provided ring buffer
|
||||
|
||||
Reference in New Issue
Block a user