Add a physical memory manager
This commit is contained in:
parent
6a46d263cf
commit
7043ccd6b9
10 changed files with 567 additions and 7 deletions
|
@ -5,6 +5,7 @@ const MemProfile = mem.MemProfile;
|
|||
const gdt = @import("gdt_mock.zig");
|
||||
const idt = @import("idt_mock.zig");
|
||||
const multiboot = @import("../../../src/kernel/multiboot.zig");
|
||||
const paging = @import("paging_mock.zig");
|
||||
|
||||
const mock_framework = @import("mock_framework.zig");
|
||||
pub const initTest = mock_framework.initTest;
|
||||
|
@ -35,6 +36,8 @@ pub const InterruptContext = struct {
|
|||
ss: u32,
|
||||
};
|
||||
|
||||
pub const MEMORY_BLOCK_SIZE = paging.PAGE_SIZE_4KB;
|
||||
|
||||
pub fn outb(port: u16, data: u8) void {
|
||||
return mock_framework.performAction("outb", void, .{ port, data });
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ pub const MemProfile = struct {
|
|||
physaddr_start: [*]u8,
|
||||
mem_kb: u32,
|
||||
fixed_alloc_size: u32,
|
||||
mem_map: []multiboot.multiboot_memory_map_t,
|
||||
};
|
||||
|
||||
// The virtual/physical start/end of the kernel code
|
||||
|
@ -28,5 +29,6 @@ pub fn init(mb_info: *multiboot.multiboot_info_t) MemProfile {
|
|||
// Total memory available including the initial 1MiB that grub doesn't include
|
||||
.mem_kb = mb_info.mem_upper + mb_info.mem_lower + 1024,
|
||||
.fixed_alloc_size = FIXED_ALLOC_SIZE,
|
||||
.mem_map = undefined,
|
||||
};
|
||||
}
|
||||
|
|
1
test/mock/kernel/paging_mock.zig
Normal file
1
test/mock/kernel/paging_mock.zig
Normal file
|
@ -0,0 +1 @@
|
|||
pub const PAGE_SIZE_4KB = 4096;
|
Loading…
Add table
Add a link
Reference in a new issue