Create a new AreaFrameAllocator and allocate maximum number of frames

master
Philipp Oppermann 8 years ago
parent edb2e693da
commit 9f1a69cafa

@ -15,6 +15,8 @@ mod memory;
#[no_mangle]
pub extern fn rust_main(multiboot_information_address: usize) {
use memory::FrameAllocator;
vga_buffer::clear_screen();
println!("Hello World{}", "!");
@ -44,6 +46,17 @@ pub extern fn rust_main(multiboot_information_address: usize) {
let multiboot_start = multiboot_information_address;
let multiboot_end = multiboot_start + (boot_info.total_size as usize);
let mut frame_allocator = memory::AreaFrameAllocator::new(
kernel_start as usize, kernel_end as usize, multiboot_start,
multiboot_end, memory_map_tag.memory_areas());
for i in 0.. {
if let None = frame_allocator.allocate_frame() {
println!("allocated {} frames", i);
break;
}
}
loop{}
}

@ -1,3 +1,5 @@
pub use self::area_frame_allocator::AreaFrameAllocator;
mod area_frame_allocator;
pub const PAGE_SIZE: usize = 4096;

Loading…
Cancel
Save