Add missing MemoryMap and MemoryRegionType imports

This commit is contained in:
Philipp Oppermann
2019-05-13 12:30:13 +02:00
parent 1ebe869e0e
commit 6db5ad78ab

View File

@@ -852,6 +852,8 @@ In order to create new page tables, we need to create a proper frame allocator.
```rust ```rust
// in src/memory.rs // in src/memory.rs
use bootloader::bootinfo::MemoryMap;
/// A FrameAllocator that returns usable frames from the bootloader's memory map. /// A FrameAllocator that returns usable frames from the bootloader's memory map.
pub struct BootInfoFrameAllocator { pub struct BootInfoFrameAllocator {
memory_map: &'static MemoryMap, memory_map: &'static MemoryMap,
@@ -886,6 +888,8 @@ Before we implement the `FrameAllocator` trait, we add an auxiliary method that
```rust ```rust
// in src/memory.rs // in src/memory.rs
use bootloader::bootinfo::MemoryRegionType;
impl BootInfoFrameAllocator { impl BootInfoFrameAllocator {
/// Returns an iterator over the usable frames specified in the memory map. /// Returns an iterator over the usable frames specified in the memory map.
fn usable_frames(&self) -> impl Iterator<Item = PhysFrame> { fn usable_frames(&self) -> impl Iterator<Item = PhysFrame> {