Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create memory module #690

Merged
merged 11 commits into from
Oct 20, 2024
Merged
223 changes: 0 additions & 223 deletions src/sys/allocator.rs

This file was deleted.

2 changes: 1 addition & 1 deletion src/sys/fs/block_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl BlockDeviceIO for MemBlockDevice {
}

pub fn mount_mem() {
let mem = sys::allocator::memory_size() / 2; // Half the allocatable memory
let mem = sys::mem::memory_free() / 2;
let len = mem / super::BLOCK_SIZE; // TODO: take a size argument
let dev = MemBlockDevice::new(len);
*BLOCK_DEVICE.lock() = Some(BlockDevice::Mem(dev));
Expand Down
4 changes: 2 additions & 2 deletions src/sys/idt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ extern "x86-interrupt" fn page_fault_handler(
};

if error_code.contains(PageFaultErrorCode::CAUSED_BY_WRITE) {
if sys::allocator::alloc_pages(&mut mapper, addr, 1).is_err() {
if sys::mem::alloc_pages(&mut mapper, addr, 1).is_err() {
printk!(
"{}Error:{} Could not allocate page at {:#X}\n",
csi_color, csi_reset, addr
Expand All @@ -154,7 +154,7 @@ extern "x86-interrupt" fn page_fault_handler(
// longer a simple clone of the kernel page table. Currently a process
// is executed from its kernel address that is shared with the process.
let start = (addr / 4096) * 4096;
if sys::allocator::alloc_pages(&mut mapper, start, 4096).is_ok() {
if sys::mem::alloc_pages(&mut mapper, start, 4096).is_ok() {
if sys::process::is_userspace(start) {
let code_addr = sys::process::code_addr();
let src = (code_addr + start) as *mut u8;
Expand Down
120 changes: 0 additions & 120 deletions src/sys/mem.rs

This file was deleted.

Loading
Loading