-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4cc262e
commit 57aaec0
Showing
35 changed files
with
455 additions
and
1,183 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
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,27 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
//! This module provides functions to work efficiently with environment variables. | ||
|
||
fn get_rustc_version() -> anyhow::Result<String> { | ||
Ok(String::from_utf8( | ||
std::process::Command::new("rustc") | ||
.arg("--version") | ||
.output()? | ||
.stdout, | ||
)?.trim().to_string()) | ||
} | ||
|
||
#[must_use] | ||
pub fn get_all_environment_variables() -> anyhow::Result<std::collections::HashMap<&'static str, String>> { | ||
let mut environment = std::collections::HashMap::new(); | ||
environment.insert("RUSTC_VERSION", get_rustc_version()?); | ||
environment.insert( | ||
"COMPILATION_DATE_AND_TIME", | ||
chrono::offset::Local::now().format("%+").to_string(), | ||
); | ||
environment.insert("KERNEL_VERSION", "unknown".to_string()); | ||
// environment.insert("LOG_LEVEL", log::max_level().to_string()); | ||
environment.insert("LOG_LEVEL", "trace".to_string()); | ||
|
||
Ok(environment) | ||
} |
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
|
||
pub mod arguments; | ||
mod command; | ||
mod environment; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
// ? GLOBAL CRATE ATTRIBUTES AND DOCUMENTATION | ||
// ? --------------------------------------------------------------------- | ||
|
||
// This crate does not and cannot use the standard library. | ||
#![no_std] | ||
// As this is no ordinary program, we have a special entry-point, | ||
// which is not the `main()` function. | ||
#![no_main] | ||
// Clippy lint target one. Enables all lints that are on by | ||
// default (correctness, suspicious, style, complexity, perf) . | ||
#![deny(clippy::all)] | ||
// Clippy lint target two. Enables lints which are rather strict | ||
// or have occasional false positives. | ||
#![deny(clippy::nursery)] | ||
// Clippy lint target three. Enables new lints that are still | ||
// under development | ||
#![deny(clippy::pedantic)] | ||
// Clippy lint target four. Enable lints for the cargo manifest | ||
// file, a.k.a. Cargo.toml. | ||
#![deny(clippy::cargo)] | ||
#![allow(clippy::multiple_crate_versions)] | ||
// Lint target for code documentation. This lint enforces code | ||
// documentation on every code item. | ||
#![deny(missing_docs)] | ||
#![deny(clippy::missing_docs_in_private_items)] | ||
// Lint target for code documentation. When running `rustdoc`, | ||
// show an error when using broken links. | ||
#![deny(rustdoc::broken_intra_doc_links)] | ||
|
||
//! # The `unCORE` Operating System Kernel Library | ||
//! | ||
//! This is `unCORE`, an operating system kernel completely written in pure, idiomatic and | ||
//! clean Rust. This "crate" provides the library and actual modules for the kernel. | ||
|
||
// ? UNSTABLE FEATURES | ||
// ? --------------------------------------------------------------------- | ||
|
||
#![feature(panic_info_message)] | ||
|
||
// ? MODULES and GLOBAL / CRATE-LEVEL FUNCTIONS | ||
// ? --------------------------------------------------------------------- | ||
|
||
// extern crate alloc; | ||
|
||
/// ### The Core Library | ||
/// | ||
/// This module has been created to give the kernel source code a | ||
/// well-defined structure and layout. The `library` module is used as | ||
/// the child of the `src/lib.rs` "crate", not of `src/main.rs`. This | ||
/// is important, and we are not allowed to mix them up. | ||
mod library; | ||
|
||
pub use library::{ | ||
arch, | ||
log, | ||
}; | ||
|
||
pub use crate::panic_on_error as __must_not_fail; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 6 additions & 1 deletion
7
code/uncore/src/arch/risc_v/drivers/mod.rs → ...re/src/library/arch/risc_v/drivers/mod.rs
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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
//! TODO | ||
|
||
pub mod uart; | ||
|
||
pub fn init() { | ||
/// TODO | ||
pub fn init() -> Result<(), &'static str> { | ||
let mut my_uart = uart::Uart::new(0x1_000_0000); | ||
my_uart.init(); | ||
|
||
Ok(()) | ||
} |
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
Oops, something went wrong.