aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-02-20 18:51:38 +0530
committerBobby <[email protected]>2026-02-20 18:51:38 +0530
commitc78f416d7de64a6ffb1b27faef62c9ca9b7c1322 (patch)
treea2008178105393b3256fae1e8d9aad5ea9520d2c
parent78c3c538e754ea43d5b52db0f64894cce78545ac (diff)
downloadakiba-c78f416d7de64a6ffb1b27faef62c9ca9b7c1322.tar.xz
akiba-c78f416d7de64a6ffb1b27faef62c9ca9b7c1322.zip
fix: Correct KERNEL_MAP_END value and update MAX_LOCATION_LENGTH documentation
-rw-r--r--mirai/common/constants/pmm.zig2
-rw-r--r--mirai/common/limits/attachment.zig6
-rw-r--r--mirai/kata/memory.zig10
3 files changed, 9 insertions, 9 deletions
diff --git a/mirai/common/constants/pmm.zig b/mirai/common/constants/pmm.zig
index 292d0f6..75cd032 100644
--- a/mirai/common/constants/pmm.zig
+++ b/mirai/common/constants/pmm.zig
@@ -4,7 +4,7 @@ pub const MEMORY_AVAILABLE: u32 = 1;
pub const FIRST_MB: u64 = 0x100000;
pub const KERNEL_BASE: u64 = 0x100000;
-pub const KERNEL_MAP_END: u64 = 0x1000000;
+pub const KERNEL_MAP_END: u64 = 0x10000000; // 256MB
pub const MMIO_FRAMEBUFFER_BASE: u64 = 0x80000000;
pub const MMIO_FRAMEBUFFER_SIZE: u64 = 0x10000000;
diff --git a/mirai/common/limits/attachment.zig b/mirai/common/limits/attachment.zig
index 815b08f..af6ce68 100644
--- a/mirai/common/limits/attachment.zig
+++ b/mirai/common/limits/attachment.zig
@@ -1,5 +1,5 @@
//! Attachment limits
-const fs_limits = @import("fs.zig");
-
-pub const MAX_LOCATION_LENGTH: usize = fs_limits.MAX_LOCATION_LENGTH;
+/// Storage buffer size for location in attachment struct
+/// Validation limit is fs_limits.MAX_LOCATION_LENGTH (4096)
+pub const MAX_LOCATION_LENGTH: usize = 256;
diff --git a/mirai/kata/memory.zig b/mirai/kata/memory.zig
index 652c859..1ec8ef0 100644
--- a/mirai/kata/memory.zig
+++ b/mirai/kata/memory.zig
@@ -95,10 +95,10 @@ pub fn setup(kata: *types.Kata, framebuffer_phys: u64, framebuffer_size: u64) !v
const first_page = pmm.alloc_page() orelse return error.OutOfMemory;
const kernel_stack_base = first_page;
- // Identity map first page
+ // Identity map first page in kata's page table
_ = try paging.map_page_in_table(kata.page_table, first_page, first_page, paging.PAGE_WRITABLE);
- // Zero the page
+ // Zero the page (via higher-half which kernel always has mapped)
var page_ptr: [*]volatile u8 = @ptrFromInt(first_page + HIGHER_HALF);
for (0..PAGE_SIZE) |j| {
page_ptr[j] = 0;
@@ -116,7 +116,7 @@ pub fn setup(kata: *types.Kata, framebuffer_phys: u64, framebuffer_size: u64) !v
break;
}
- // Identity map this page
+ // Identity map this page in kata's page table
_ = try paging.map_page_in_table(kata.page_table, page, page, paging.PAGE_WRITABLE);
// Zero the page
@@ -126,9 +126,9 @@ pub fn setup(kata: *types.Kata, framebuffer_phys: u64, framebuffer_size: u64) !v
}
}
- // Stack top is at the end of allocated contiguous pages
+ // Stack top uses IDENTITY address (not higher-half) since that's what we mapped
const actual_stack_size = i * PAGE_SIZE;
- kata.stack_top = kernel_stack_base + HIGHER_HALF + actual_stack_size;
+ kata.stack_top = kernel_stack_base + actual_stack_size;
if (framebuffer_phys != 0 and framebuffer_size > 0) {
const fb_pages = (framebuffer_size + PAGE_SIZE - 1) / PAGE_SIZE;