Use once crate to ensure that memory::init is only called once

master
Philipp Oppermann 7 years ago
parent 76550dcd95
commit f2bbe43099

@ -13,3 +13,4 @@ spin = "0.4.5"
multiboot2 = "0.1.0" multiboot2 = "0.1.0"
bitflags = "0.7.0" bitflags = "0.7.0"
x86_64 = "0.1.2" x86_64 = "0.1.2"
once = "0.3.3"

@ -18,6 +18,8 @@ extern crate multiboot2;
#[macro_use] #[macro_use]
extern crate bitflags; extern crate bitflags;
extern crate x86_64; extern crate x86_64;
#[macro_use]
extern crate once;
#[macro_use] #[macro_use]
mod vga_buffer; mod vga_buffer;

@ -11,6 +11,8 @@ pub const PAGE_SIZE: usize = 4096;
pub fn init(boot_info: &BootInformation) { pub fn init(boot_info: &BootInformation) {
assert_has_not_been_called!("memory::init must be called only once");
let memory_map_tag = boot_info.memory_map_tag().expect( let memory_map_tag = boot_info.memory_map_tag().expect(
"Memory map tag required"); "Memory map tag required");
let elf_sections_tag = boot_info.elf_sections_tag().expect( let elf_sections_tag = boot_info.elf_sections_tag().expect(

Loading…
Cancel
Save