From 0d2e4a0cd4905d70ba1adf42ff2047be94f610b6 Mon Sep 17 00:00:00 2001 From: memN0ps <89628341+memN0ps@users.noreply.github.com> Date: Fri, 12 Jul 2024 03:50:59 +1200 Subject: [PATCH] Stack and heap changed - stack min size: `(size_of::() / 0x1000) + 0x1000` - heap might be able to go lower than 0x4000000 but it is core dependant. Took 36 minutes --- hypervisor/src/global_const.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hypervisor/src/global_const.rs b/hypervisor/src/global_const.rs index b605198..3cddc48 100644 --- a/hypervisor/src/global_const.rs +++ b/hypervisor/src/global_const.rs @@ -1,5 +1,15 @@ -// const DEFAULT_LOGICAL_PROCESSORS: usize = 32; -pub const STACK_PAGES_PER_PROCESSOR: usize = 0x2000; +use {crate::intel::vm::Vm, core::mem::size_of}; -// 0x40000000 / 32 = 0x1000000 (1GB) -pub const TOTAL_HEAP_SIZE: usize = 0x20000000; +/// Number of stack pages per logical processor. +/// Includes size of `Vm` in pages plus 0x1000 (4096) pages for padding. +/// - Size of `Vm`: 1027 pages (0x403 pages). +/// - Padding: 4096 pages (0x1000 pages). +/// - Total: 1027 + 4096 pages = 5123 pages (0x1403 pages). +/// - Total size in bytes: 5123 * 4096 = 20,971,520 bytes (20 MB). +pub const STACK_PAGES_PER_PROCESSOR: usize = (size_of::() / 0x1000) + 0x1000; + +/// Total heap size (64 MB) shared across all logical processors. +/// - Total size in bytes: 64 * 1024 * 1024 = 67,108,864 bytes (64 MB). +/// - Total size in hexadecimal: 0x4000000 bytes. +/// Increase this value if additional heap memory is needed or if more hooks are required. +pub const TOTAL_HEAP_SIZE: usize = 0x4000000;