Event system
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
use core::slice::Iter;
|
||||
|
||||
use super::{Frame, FrameAllocator, MemInfo, MemoryAreaIter};
|
||||
use multiboot2::MemoryArea;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use core::{alloc::{GlobalAlloc, Layout}, ops::Deref};
|
||||
use core::alloc::{GlobalAlloc, Layout};
|
||||
|
||||
use multiboot2::{BootInformation, BootInformationHeader, MemoryArea, MemoryAreaType, MemoryMapTag, TagTrait};
|
||||
use multiboot2::{BootInformationHeader, MemoryArea, MemoryAreaType, MemoryMapTag, TagTrait};
|
||||
|
||||
pub mod area_frame_alloc;
|
||||
|
||||
@@ -8,8 +8,8 @@ pub mod area_frame_alloc;
|
||||
static GLOBAL_ALLOCATOR: DummyAlloc = DummyAlloc;
|
||||
pub struct DummyAlloc;
|
||||
unsafe impl GlobalAlloc for DummyAlloc {
|
||||
unsafe fn alloc(&self, layout: Layout) -> *mut u8 { 0 as *mut u8 }
|
||||
unsafe fn dealloc(&self, ptr: *mut u8, _: Layout) {}
|
||||
unsafe fn alloc(&self, _: Layout) -> *mut u8 { 0 as *mut u8 }
|
||||
unsafe fn dealloc(&self, _ptr: *mut u8, _: Layout) {}
|
||||
}
|
||||
|
||||
pub const PAGE_SIZE: usize = 4096;
|
||||
@@ -26,6 +26,7 @@ impl Frame {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub trait FrameAllocator {
|
||||
fn allocate_frame(&mut self) -> Option<Frame>;
|
||||
fn deallocate_frame(&mut self, frame: Frame);
|
||||
@@ -83,7 +84,7 @@ impl MemInfo {
|
||||
let boot_info = unsafe {
|
||||
multiboot2::BootInformation::load(mb_ptr as *const BootInformationHeader).unwrap()
|
||||
};
|
||||
let mmap_tag = boot_info.memory_map_tag().unwrap().clone();
|
||||
let mmap_tag = boot_info.memory_map_tag().unwrap();
|
||||
|
||||
// log::debug!("Memory areas:");
|
||||
// for area in mmap_tag.memory_areas() {
|
||||
|
||||
Reference in New Issue
Block a user