Merge branch 'master' into paging

This commit is contained in:
Able 2021-11-23 05:53:10 -06:00 committed by GitHub
commit e42b424b1a
14 changed files with 109 additions and 93 deletions

View file

@ -6,8 +6,10 @@ build-std-features = ["compiler-builtins-mem"]
build-std = ["core", "compiler_builtins", "alloc"]
[target.'cfg(target_arch = "x86_64")']
# --quiet suppresses warning messages from the bootimage crate
runner = "bootimage runner --quiet"
[target.riscv64gc-unknown-none-elf]
rustflags = "-C link-arg=-T../ableos/src/arch/riscv/virt.lds"

View file

@ -15,12 +15,15 @@ run-args=["-serial", "stdio"]
[dependencies]
spin = "0.5.2"
# linked_list_allocator = "0.9.0"
[dependencies.lazy_static]
features = ["spin_no_std"]
version = "1.0"
# [dependencies.rhai]
# version = "*"
# features = ["no_std"]
# alloc required
# [dependencies.wasmi]
# version = "*"

View file

@ -1,2 +1,3 @@
pub mod graphics;
pub mod nrf52;
pub mod serial;

View file

@ -1,3 +1,4 @@
/// Prints to the host through the serial interface.
#[macro_export]
macro_rules! serial_print {
($($arg:tt)*) => {};

View file

@ -4,7 +4,6 @@ use core::ptr;
pub mod drivers;
pub mod init;
pub mod serial;
use crate::arch::drivers::nrf52::{Level, Pins};
use core::ptr::write_volatile;
global_asm!(include_str!("boot.s"));

View file

@ -33,6 +33,7 @@ use lazy_static::lazy_static;
lazy_static! {
pub static ref SERIAL: Mutex<Serial123> = {
let serial_port = Serial123 {
/// UART port for the serial bus
uart_data: 0x10000000,
};
Mutex::new(serial_port)

View file

@ -31,3 +31,10 @@ Memory: {}
return x;
}
*/
pub const KERNEL_VERSION: &str = env!("CARGO_PKG_VERSION");
#[cfg(debug_assertions)]
/// A constant to check if the kernel is in debug mode
pub const RELEASE_TYPE: &str = "debug";
#[cfg(not(debug_assertions))]
/// A constant to check if the kernel is in release mode
pub const RELEASE_TYPE: &str = "release";

View file

@ -9,10 +9,16 @@ use crate::{
driver_traits::{graphics::Graphics, serial::Serial},
relib::math::rand::{linearshift::LinearShiftRegister, prand::PRand, RAND_HANDLE, RNG},
serial_print, serial_println,
experiments::systeminfo::{KERNEL_VERSION, RELEASE_TYPE},
keyboard::DecodedKey,
};
use bootloader::{entry_point, BootInfo};
use lazy_static::lazy_static;
use x86_64::{VirtAddr, structures::paging::Page};
#[no_mangle]
#[allow(unconditional_recursion)]
pub extern "C" fn stack_overflow() -> u8 {
@ -21,8 +27,6 @@ pub extern "C" fn stack_overflow() -> u8 {
69 // NOTE: Any specific reason for this number asside from memes?
}
use crate::keyboard::DecodedKey;
lazy_static! {
pub static ref KEY_BUFFER: [DecodedKey; 256] = [DecodedKey::RawKey(123); 256];
pub static ref KEY_BUFFER_POINTER: u8 = 0;
@ -41,10 +45,11 @@ pub fn kernel_main(boot_info: &'static BootInfo) -> ! {
/* If AES is present then AES init rng as well
// Maybe via a cfg
AES::init_rng();
*/
*/
#[cfg(not(target_arch = "riscv64"))]
println!("init");
println!("{} v{}", RELEASE_TYPE, KERNEL_VERSION);
{
use crate::experiments::mail::MailBoxes;

View file

@ -1,48 +1,39 @@
//! hi
#![no_std]
// #![deny(warnings)]
#![feature(asm)]
#![feature(global_asm)]
#![feature(abi_x86_interrupt)]
#![feature(core_intrinsics, lang_items, llvm_asm)]
// #![feature(alloc_error_handler)] // at the top of the file
#![reexport_test_harness_main = "test_main"]
#![feature(custom_test_frameworks)]
#![test_runner(crate::arch::test_runner)]
#![feature(naked_functions)]
#[cfg(target_arch = "arm")]
#[path = "arch/aarch32/mod.rs"]
mod arch;
#![feature(
abi_x86_interrupt,
asm,
core_intrinsics,
global_asm,
lang_items,
llvm_asm,
naked_functions
)]
#[cfg(target_arch = "aarch64")]
#[path = "arch/aarch64/mod.rs"]
mod arch;
pub mod arch;
#[cfg(target_arch = "x86_64")]
#[path = "arch/x86_64/mod.rs"]
mod arch;
pub mod arch;
#[cfg(target_arch = "riscv64")]
#[path = "arch/riscv/mod.rs"]
mod arch;
pub mod arch;
#[macro_use]
pub mod print;
use arch::drivers::serial;
mod driver_traits;
mod experiments;
#[cfg(not(target_arch = "mips"))]
// pub mod allocator;
mod kmain;
#[cfg(not(target_arch = "mips"))]
mod panic;
pub use experiments::server;
pub mod driver_traits;
pub mod experiments;
pub mod keyboard;
pub mod kmain;
pub mod panic;
pub mod relib;
pub const KERNEL_VERSION: &str = env!("CARGO_PKG_VERSION");
#[cfg(debug_assertions)]
/// A constant to check if the kernel is in debug mode
pub const RELEASE_TYPE: &str = "debug";
#[cfg(not(debug_assertions))]
/// A constant to check if the kernel is in release mode
pub const RELEASE_TYPE: &str = "release";
extern crate alloc;
use experiments::server;

View file

@ -9,20 +9,12 @@ impl Stdout {
}
}
impl core::fmt::Write for Stdout {
#[cfg(target_arch = "arm")]
fn write_str(&mut self, s: &str) -> Result<(), Error> {
use crate::arch::write;
write(s);
Ok(())
}
#[cfg(target_arch = "aarch64")]
fn write_str(&mut self, s: &str) -> Result<(), Error> {
// Don't actually print anything yet lmao
Ok(())
}
#[cfg(target_arch = "x86_64")]
fn write_str(&mut self, s: &str) -> Result<(), Error> {
use crate::kprint;
@ -34,12 +26,6 @@ impl core::fmt::Write for Stdout {
fn write_str(&mut self, s: &str) -> Result<(), Error> {
Ok(())
}
#[cfg(target_arch = "mips")]
fn write_str(&mut self, s: &str) -> Result<(), Error> {
use psp::dprint;
dprint!("{}", s);
Ok(())
}
}
#[macro_export]
macro_rules! print {

View file

@ -2,7 +2,6 @@
pub mod linearshift;
pub mod prand;
pub mod wichmanhillrand; // FIXEME: Reimplement
use crate::serial_println;
use lazy_static::lazy_static;
use linearshift::LinearShiftRegister;
use prand::PRand;

0
ableos/src/serial.rs Normal file
View file

0
ableos/src/wasm/mod.rs Normal file
View file

View file

@ -11,6 +11,11 @@ enum Command {
#[clap(long, short, arg_enum)]
machine: Option<MachineType>,
},
Doc {
#[clap(long, short, arg_enum)]
machine: Option<MachineType>,
},
}
#[derive(clap::ArgEnum, Debug, Clone)]
@ -34,7 +39,6 @@ fn main() -> anyhow::Result<()> {
};
match machine.unwrap_or(MachineType::X86) {
MachineType::X86 => {
// Used for the x86-64 variant only
xshell::cmd!("cargo run --release").run()?;
}
MachineType::ARM => {
@ -67,6 +71,23 @@ fn main() -> anyhow::Result<()> {
}
}
}
Command::Doc { machine } => {
let _dir = xshell::pushd("./ableos");
match machine.unwrap_or(MachineType::X86) {
MachineType::X86 => {
xshell::cmd!("cargo doc --open").run()?;
}
MachineType::ARM => {
xshell::cmd!("cargo doc --open --target=json_targets/aarch64-ableos.json")
.run()?;
}
MachineType::RISCV => {
xshell::cmd!("cargo doc --open --target=riscv64gc-unknown-none-elf").run()?;
}
}
}
}
Ok(())