-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bootinfo: Add architecture-independent memory entry
`E820Entry` is used in `boot::Info` trait, which is x86_64-dependent memory entry data structure. It's confusing if e820 is used in other architectures. This commit introduces an architecture-independent memory entry `bootinfo::MemoryEntry` and replaces `boot::Info` with `bootinfo::Info`. This change is suggested in [1]. [1] #205 (comment) Signed-off-by: Akira Moroo <retrage01@gmail.com>
- Loading branch information
Showing
8 changed files
with
155 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2022 Akira Moroo | ||
|
||
// Common data needed for all boot paths | ||
pub trait Info { | ||
// Name of for this boot protocol | ||
fn name(&self) -> &str; | ||
// Starting address of the Root System Descriptor Pointer | ||
fn rsdp_addr(&self) -> u64; | ||
// The kernel command line (not including null terminator) | ||
fn cmdline(&self) -> &[u8]; | ||
// Methods to access the Memory map | ||
fn num_entries(&self) -> usize; | ||
fn entry(&self, idx: usize) -> MemoryEntry; | ||
} | ||
|
||
pub struct MemoryEntry { | ||
pub addr: u64, | ||
pub size: u64, | ||
pub entry_type: EntryType, | ||
} | ||
|
||
#[derive(PartialEq)] | ||
pub enum EntryType { | ||
Ram, | ||
Reserved, | ||
AcpiReclaimable, | ||
AcpiNvs, | ||
Bad, | ||
VendorReserved, | ||
CorebootTable, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters