Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Commit

Permalink
Stack and heap changed
Browse files Browse the repository at this point in the history
- stack min size: `(size_of::<Vm>() / 0x1000) + 0x1000`
- heap might be able to go lower than 0x4000000 but it is core dependant.

Took 36 minutes
  • Loading branch information
memN0ps committed Jul 11, 2024
1 parent 6122c67 commit 0d2e4a0
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions hypervisor/src/global_const.rs
Original file line number Diff line number Diff line change
@@ -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::<Vm>() / 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;

0 comments on commit 0d2e4a0

Please sign in to comment.