Vystem 0.2
This commit is contained in:
26
shelter/lib/include/memory/memory.h
Normal file
26
shelter/lib/include/memory/memory.h
Normal file
@@ -0,0 +1,26 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
#ifndef SH_LIB_MEMORY_H
|
||||
#define SH_LIB_MEMORY_H
|
||||
#include "std/type.h"
|
||||
#include "std/status.h"
|
||||
#include "kernel/conf.h"
|
||||
#include "memory/page.h"
|
||||
#include "memory/slab.h"
|
||||
#include "memory/heap.h"
|
||||
// Memory subsystem services structure
|
||||
typedef struct {
|
||||
sh_page_PAGE_TABLE_POOL kernel_ptp;
|
||||
sh_slab_reg_phys_SLAB_ALLOCATOR slab_reg_phys;
|
||||
sh_slab_reg_virt_SLAB_ALLOCATOR slab_reg_virt;
|
||||
struct sh_slab_radix_node_SLAB_ALLOCATOR slab_radix_node;
|
||||
sh_pez_PHYSICAL_PLANE physical_plane;
|
||||
sh_pez_VIRTUAL_PLANE virtual_plane_kernel_heap;
|
||||
sh_heap_KERNEL_HEAP kernel_heap;
|
||||
} sh_memory_MEMORY_SERVICES;
|
||||
// Initialize memory subsystem
|
||||
SH_STATUS sh_memory_init_subsystem(sh_conf_BOOT_CONFIG *boot_config,sh_memory_MEMORY_SERVICES *services);
|
||||
// Identity map a physical memory area
|
||||
SH_STATUS sh_memory_identity_map(sh_page_PHYSICAL_ADDRESS phys_start,sh_uint64 page_count,sh_uint64 flags);
|
||||
// Parse a memory DevS query
|
||||
SH_STATUS sh_memory_devs_query(char *sub_path,sh_devs_RESULT *result);
|
||||
#endif
|
||||
@@ -156,4 +156,6 @@ SH_STATUS sh_page_analyse_memory_map(sh_page_PAGE_TABLE_POOL *ptp);
|
||||
sh_page_VIRTUAL_ADDRESS sh_page_get_physical_bitmap_ptr();
|
||||
// Get physical memory statistics
|
||||
SH_STATUS sh_page_get_memory_stats(sh_page_MEM_STATS *mem_stats);
|
||||
// Return total installed memory in bytes
|
||||
sh_uint64 sh_page_get_installed_memory_bytes();
|
||||
#endif
|
||||
|
||||
@@ -15,4 +15,6 @@ typedef struct {
|
||||
SH_STATUS sh_ring_write_byte(sh_ring_RING_BUFFER_HEADER *ring_buffer,sh_uint8 byte);
|
||||
// Write a null terminated string into the provided ring buffer
|
||||
SH_STATUS sh_ring_write_string(sh_ring_RING_BUFFER_HEADER *ring_buffer,char *string);
|
||||
// Read bytes_count from the provided ring buffer, and put it into output. Return SH_STATUS_TOO_MUCH_DATA if bytes_count>buf.buffer_size_bytes, setting the entire buffer to 0x00
|
||||
SH_STATUS sh_ring_read_bytes(sh_ring_RING_BUFFER_HEADER *ring_buffer,sh_uint32 bytes_count,void *output);
|
||||
#endif
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
#define SH_VMEM_LAYOUT_SLAB_REG_VIRT_VA 0xFFFFFF800C600000ULL
|
||||
// The total size for the slabs for virtual regions objects
|
||||
#define SH_VMEM_LAYOUT_SLAB_REG_VIRT_SIZE_BYTES (1ULL<<29)*12ULL
|
||||
// The alignement for SH_VMEM_LAYOUT_SLAB_RADIX_NODE_VA
|
||||
// The alignment for SH_VMEM_LAYOUT_SLAB_RADIX_NODE_VA
|
||||
#define SH_VMEM_LAYOUT_PBA_RADIX_NODE_BLOCK_ALIGN (32ULL*4096ULL)
|
||||
// The base for the PBA for the slabs for radix nodes
|
||||
#define SH_VMEM_LAYOUT_SLAB_RADIX_NODE_VA ((SH_VMEM_LAYOUT_SLAB_REG_VIRT_VA+SH_VMEM_LAYOUT_SLAB_REG_VIRT_SIZE_BYTES+SH_VMEM_LAYOUT_PBA_RADIX_NODE_BLOCK_ALIGN)/SH_VMEM_LAYOUT_PBA_RADIX_NODE_BLOCK_ALIGN)*SH_VMEM_LAYOUT_PBA_RADIX_NODE_BLOCK_ALIGN
|
||||
|
||||
Reference in New Issue
Block a user