mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Ensure that memory::init is only called once
This commit is contained in:
@@ -7,6 +7,7 @@ authors = ["Philipp Oppermann <dev@phil-opp.com>"]
|
|||||||
crate-type = ["staticlib"]
|
crate-type = ["staticlib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
once = "0.2.1"
|
||||||
rlibc = "0.1.4"
|
rlibc = "0.1.4"
|
||||||
spin = "0.3.4"
|
spin = "0.3.4"
|
||||||
bump_allocator = {path="libs/bump_allocator"}
|
bump_allocator = {path="libs/bump_allocator"}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ extern crate multiboot2;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
extern crate x86;
|
extern crate x86;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate once;
|
||||||
|
|
||||||
extern crate bump_allocator;
|
extern crate bump_allocator;
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ mod paging;
|
|||||||
pub const PAGE_SIZE: usize = 4096;
|
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(
|
||||||
|
|||||||
Reference in New Issue
Block a user