Messed with some stuff
This commit is contained in:
parent
a9798a1ce8
commit
7bb8a99b56
6 changed files with 27 additions and 8 deletions
|
@ -4,7 +4,7 @@ CONT_WITH_DIFFERENT_VERSION=true
|
||||||
|
|
||||||
# Begin metadata
|
# Begin metadata
|
||||||
|
|
||||||
# Set VERSION=generate to attempt to autogenerate a version based on git information
|
# Set VERSION=generate(or unset) to attempt to autogenerate a version based on git information
|
||||||
VERSION=generate
|
VERSION=generate
|
||||||
# SUFFIX is unset
|
# SUFFIX is unset
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
//! actual architecture, of course):
|
//! actual architecture, of course):
|
||||||
//! #![cfg(any(target_arch = "arch"))]
|
//! #![cfg(any(target_arch = "arch"))]
|
||||||
|
|
||||||
|
// DO NOT have this in your actual code:
|
||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
/// Returns the most specific architecture available.
|
/// Returns the most specific architecture available.
|
||||||
pub const fn get_arch() -> super::Architecture {
|
pub const fn get_arch() -> super::Architecture {
|
||||||
super::Architecture::ExampleDummy
|
super::Architecture::ExampleDummy
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub enum PageDirectoryEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PageDirectoryEntry {
|
impl PageDirectoryEntry {
|
||||||
const fn create_fourmb(
|
pub const fn create_fourmb(
|
||||||
mut bits32to22: u16,
|
mut bits32to22: u16,
|
||||||
bits39to32: u8,
|
bits39to32: u8,
|
||||||
pat: bool,
|
pat: bool,
|
||||||
|
@ -64,7 +64,7 @@ impl PageDirectoryEntry {
|
||||||
Self::FourMb(out)
|
Self::FourMb(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
const fn create_other(
|
pub const fn create_other(
|
||||||
mut bits31to12: u32,
|
mut bits31to12: u32,
|
||||||
pat: bool,
|
pat: bool,
|
||||||
mut available: u8,
|
mut available: u8,
|
||||||
|
|
|
@ -22,7 +22,8 @@ fn indep_boot_entry(
|
||||||
) -> ! {
|
) -> ! {
|
||||||
assert_ne!(
|
assert_ne!(
|
||||||
crate::arch::get_arch(),
|
crate::arch::get_arch(),
|
||||||
crate::arch::Architecture::ExampleDummy
|
crate::arch::Architecture::ExampleDummy,
|
||||||
|
"Somehow the kernel successfully booted into IndepBootEntry with a dummy architecture"
|
||||||
);
|
);
|
||||||
crate::arch::output::sdebugsln("IndepBootEntry called");
|
crate::arch::output::sdebugsln("IndepBootEntry called");
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,18 @@ fn get_allocator() -> Option<&'static MemoryMapAlloc<'static>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The unsafe counterpart of [MemMapAlloc()]. Doesn't check if the allocator is initalized.
|
||||||
|
/// Internally, uses [MaybeUninit::assume_init_ref].
|
||||||
|
///
|
||||||
|
/// # Safety
|
||||||
|
///
|
||||||
|
/// Calling this instead of [MemMapAlloc] or when the allocator is uninitalized causes
|
||||||
|
/// undefined behavior; check [MaybeUninit::assume_init_ref] for safety guarantees.
|
||||||
|
pub unsafe fn get_allocator_unchecked() -> &'static MemoryMapAlloc<'static> {
|
||||||
|
#[allow(static_mut_refs)]
|
||||||
|
unsafe { ALLOCATOR.assume_init_ref() }
|
||||||
|
}
|
||||||
|
|
||||||
#[kernel_item(MemMapAllocInit)]
|
#[kernel_item(MemMapAllocInit)]
|
||||||
fn memory_map_alloc_init(memmap: crate::boot::MemoryMap) -> Result<(), crate::Error<'static>> {
|
fn memory_map_alloc_init(memmap: crate::boot::MemoryMap) -> Result<(), crate::Error<'static>> {
|
||||||
#[allow(static_mut_refs)]
|
#[allow(static_mut_refs)]
|
||||||
|
@ -107,19 +119,19 @@ pub struct MemoryMapAlloc<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Too many allocations have been created, pushing the size of [MemoryMapAlloc::allocations] over [MemoryMapAlloc::max_allocations_size].
|
/// Too many allocations have been created, pushing the size of [MemoryMapAlloc::allocations] over [MemoryMapAlloc::max_allocations_size].
|
||||||
const TOO_MANY_ALLOCATIONS: i16 = -2;
|
pub const TOO_MANY_ALLOCATIONS: i16 = -2;
|
||||||
|
|
||||||
/// There isn't enough space for 32 allocations(the minimum available).
|
/// There isn't enough space for 32 allocations(the minimum available).
|
||||||
pub const ALLOCATIONS_NOT_ENOUGH_SPACE: i16 = -3;
|
pub const ALLOCATIONS_NOT_ENOUGH_SPACE: i16 = -3;
|
||||||
|
|
||||||
/// The index provided to [MemoryMapAlloc::extend_allocation] is too big.
|
/// The index provided to [MemoryMapAlloc::extend_allocation] is too big.
|
||||||
const EXTEND_ALLOCATION_INVALID_INDEX: i16 = -4;
|
pub const EXTEND_ALLOCATION_INVALID_INDEX: i16 = -4;
|
||||||
|
|
||||||
/// The allocation provided to [MemoryMapAlloc::extend_allocation] is unused.
|
/// The allocation provided to [MemoryMapAlloc::extend_allocation] is unused.
|
||||||
const EXTEND_ALLOCATION_ALLOCATION_UNUSED: i16 = -5;
|
pub const EXTEND_ALLOCATION_ALLOCATION_UNUSED: i16 = -5;
|
||||||
|
|
||||||
/// The allocation provided to [MemoryMapAlloc::extend_allocation], if extended, would extend into another allocation.
|
/// The allocation provided to [MemoryMapAlloc::extend_allocation], if extended, would extend into another allocation.
|
||||||
const EXTEND_ALLOCATION_OTHER_ALLOCATION: i16 = -6;
|
pub const EXTEND_ALLOCATION_OTHER_ALLOCATION: i16 = -6;
|
||||||
|
|
||||||
impl<'a> Debug for MemoryMapAlloc<'a> {
|
impl<'a> Debug for MemoryMapAlloc<'a> {
|
||||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#![warn(rustdoc::missing_crate_level_docs)]
|
#![warn(rustdoc::missing_crate_level_docs)]
|
||||||
#![deny(rustdoc::invalid_html_tags)]
|
#![deny(rustdoc::invalid_html_tags)]
|
||||||
#![deny(rustdoc::invalid_rust_codeblocks)]
|
#![deny(rustdoc::invalid_rust_codeblocks)]
|
||||||
|
#![deny(unsafe_op_in_unsafe_fn)]
|
||||||
// tidy-alphabetical-start
|
// tidy-alphabetical-start
|
||||||
#![feature(ptr_metadata)]
|
#![feature(ptr_metadata)]
|
||||||
#![feature(const_trait_impl)]
|
#![feature(const_trait_impl)]
|
||||||
|
@ -48,10 +49,12 @@ pub use util::*;
|
||||||
#[allow(unused_imports)] // if there are no traits, then it gives a warning
|
#[allow(unused_imports)] // if there are no traits, then it gives a warning
|
||||||
pub use traits::*;
|
pub use traits::*;
|
||||||
|
|
||||||
|
/// Returns the version of aphrodite.
|
||||||
pub const fn version() -> &'static str {
|
pub const fn version() -> &'static str {
|
||||||
env!("VERSION")
|
env!("VERSION")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the version of the config for aphrodite.
|
||||||
pub const fn cfg_version() -> &'static str {
|
pub const fn cfg_version() -> &'static str {
|
||||||
env!("CFG_VERSION")
|
env!("CFG_VERSION")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue