First commit, Vystem v0.1
This commit is contained in:
93
shelter/lib/include/memory/vmem_layout.h
Normal file
93
shelter/lib/include/memory/vmem_layout.h
Normal file
@@ -0,0 +1,93 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
#ifndef SH_LIB_VMEM_LAYOUT_H
|
||||
#define SH_LIB_VMEM_LAYOUT_H
|
||||
// HOW TO USE THIS FILE
|
||||
// This file contain the VA, size in bytes and sometimes the end of virtual memory regions
|
||||
// that we are sure that the kernel will search into at boot time or allocate things at these
|
||||
// places.
|
||||
// This file is autocheck by an automated script to ensure there is no overlapping.
|
||||
// Any macro ending with _VA will create a new virtual region for the script. It will look for the
|
||||
// size of this virtual region in another macro that start with the same prefix and end with
|
||||
// _SIZE_BYTES.
|
||||
// If a macro ending with _VA doesn't have a corresponding macro ending with _SIZE_BYTES, the
|
||||
// script will trigger an error and the kernel compilation will fail.
|
||||
// If a macro ending with _SIZE_BYTES doesn't have a corresponding macro ending with _VA, the
|
||||
// script will ignore it.
|
||||
// The start of each virtual region must be aligned to 4096 bytes and the size must be provided
|
||||
// in bytes.
|
||||
// Any overlapping virtual region will trigger a compilation error.
|
||||
// Consider using this file as the source of trust for everything related to static virtual
|
||||
// regions.
|
||||
// Any macro that doesn't end with _VA or _SIZE_BYTES or that doesn't correspong to the behaviour
|
||||
// described above will be ignored.
|
||||
// TEMPORARY STRUCTURE
|
||||
// The base for the memory map
|
||||
#define SH_VMEM_LAYOUT_BOOT_CONFIG_VA 0x00180000
|
||||
// The size for the memory map
|
||||
#define SH_VMEM_LAYOUT_BOOT_CONFIG_SIZE_BYTES 4096
|
||||
// The base for the memory map
|
||||
#define SH_VMEM_LAYOUT_MEMORY_MAP_VA 0x00190000
|
||||
// The size for the memory map
|
||||
#define SH_VMEM_LAYOUT_MEMORY_MAP_SIZE_BYTES 16*4096
|
||||
// KERNEL HEAP
|
||||
// The base for big allocations region
|
||||
#define SH_VMEM_LAYOUT_HEAP_BIG_VA 16LL*1024LL*1024LL*1024LL*1024LL
|
||||
// The end for big allocations regions
|
||||
#define SH_VMEM_LAYOUT_HEAP_BIG_SIZE_BYTES (0xFFFFFFFELL)*4096LL
|
||||
// The base for all generic slabs allocators for the heap, spaced by 12 TB each
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_0_VA 0x0000200000000000
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_1_VA 0x00002C0000000000
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_2_VA 0x0000380000000000
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_3_VA 0x0000440000000000
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_4_VA 0x0000500000000000
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_5_VA 0x00005C0000000000
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_6_VA 0x0000680000000000
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_7_VA 0x0000740000000000
|
||||
// The size for all generic slabs_allocators for the heap
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_0_SIZE_BYTES 0xBFFFFFFFLL*4096LL
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_1_SIZE_BYTES 0xBFFFFFFFLL*4096LL
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_2_SIZE_BYTES 0xBFFFFFFFLL*4096LL
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_3_SIZE_BYTES 0xBFFFFFFFLL*4096LL
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_4_SIZE_BYTES 0xBFFFFFFFLL*4096LL
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_5_SIZE_BYTES 0xBFFFFFFFLL*4096LL
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_6_SIZE_BYTES 0xBFFFFFFFLL*4096LL
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_LEVEL_7_SIZE_BYTES 0xBFFFFFFFLL*4096LL
|
||||
// The spacing in bytes for each slab allocator base
|
||||
#define SH_VMEM_LAYOUT_HEAP_SLAB_SPACING 0xC0000000000
|
||||
// KERNEL AND STACKS AREA
|
||||
// The base for the kernel image area
|
||||
#define SH_VMEM_LAYOUT_KERNEL_IMAGE_AREA_VA 0xFFFF800000000000ULL
|
||||
// The size for the kernel image area
|
||||
#define SH_VMEM_LAYOUT_KERNEL_IMAGE_AREA_SIZE_BYTES 0xFFFF900000000000ULL-1-0xFFFF800000000000ULL
|
||||
// The base for the stack area
|
||||
#define SH_VMEM_LAYOUT_STACK_AREA_VA 0xFFFFF00000000000ULL
|
||||
// The size for the kernel image area
|
||||
#define SH_VMEM_LAYOUT_STACK_AREA_SIZE_BYTES 0xFFFFFF8000000000ULL-0xFFFFF00000000000ULL
|
||||
// KERNEL ALLOCATION SPACE
|
||||
// The base for the kernel allocation space
|
||||
#define SH_VMEM_LAYOUT_KERNEL_ALLOC_SPACE_VA 0xFFFF900000000000ULL
|
||||
// The size for the kernel allocation space
|
||||
#define SH_VMEM_LAYOUT_KERNEL_ALLOC_SPACE_SIZE_BYTES 0xFFFFEFFFFFFFFFFFULL-0xFFFF900000000000ULL
|
||||
// The end for the kernel allocation space
|
||||
#define SH_VMEM_LAYOUT_KERNEL_ALLOC_SPACE_VA_END 0xFFFFEFFFFFFFFFFFULL
|
||||
// SLABS VIRTUAl REGIONS
|
||||
// The base for the slabs for physical regions objects
|
||||
#define SH_VMEM_LAYOUT_SLAB_REG_PHYS_VA 0xFFFFFF8000000000ULL+0x4000ULL
|
||||
// The total size for the slabs for physical regions objects
|
||||
#define SH_VMEM_LAYOUT_SLAB_REG_PHYS_SIZE_BYTES 192*1024*1024ULL
|
||||
// The base for the slabs for virtual regions objects
|
||||
#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
|
||||
#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
|
||||
// The total size for the PBA for the slabs for radix nodes
|
||||
#define SH_VMEM_LAYOUT_SLAB_RADIX_NODE_SIZE_BYTES 64ULL*1024ULL*1024ULL*1024ULL
|
||||
// LOGGING RING BUFFER
|
||||
// The base for the logging ring buffer
|
||||
#define SH_VMEM_LAYOUT_LOGGING_RING_BUFFER_VA 0xFFFFFFFFF0000000ULL
|
||||
// The max size for the logging ring buffer
|
||||
#define SH_VMEM_LAYOUT_LOGGING_RING_BUFFER_SIZE_BYTES 0xFFFF*4096
|
||||
#endif
|
||||
Reference in New Issue
Block a user