basic runner
This commit is contained in:
parent
2d5e8d24eb
commit
27698842da
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
# target = "./json_targets/x86_64-ableos.json"
|
target = "./json_targets/x86_64-ableos.json"
|
||||||
target = "x86_64-unknown-uefi"
|
# target = "x86_64-unknown-uefi"
|
||||||
|
|
||||||
[unstable]
|
[unstable]
|
||||||
build-std = ["core", "compiler_builtins", "alloc"]
|
build-std = ["core", "compiler_builtins", "alloc"]
|
||||||
|
|
12
ableos/Cargo.lock
generated
12
ableos/Cargo.lock
generated
|
@ -48,6 +48,7 @@ dependencies = [
|
||||||
"spin",
|
"spin",
|
||||||
"uart_16550",
|
"uart_16550",
|
||||||
"uefi",
|
"uefi",
|
||||||
|
"uefi-services",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"vga",
|
"vga",
|
||||||
"volatile 0.2.7",
|
"volatile 0.2.7",
|
||||||
|
@ -653,6 +654,17 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "uefi-services"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7840bddc6477dc443cc5652ca9683de9f10bd173691151c3160d734521bef3bd"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"log",
|
||||||
|
"uefi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
version = "0.1.9"
|
version = "0.1.9"
|
||||||
|
|
|
@ -51,8 +51,8 @@ pretty-hex = "0.2.1"
|
||||||
unicode-width = "0.1.7"
|
unicode-width = "0.1.7"
|
||||||
picorand = "*"
|
picorand = "*"
|
||||||
# watson = "0.4"
|
# watson = "0.4"
|
||||||
uefi = { version="*", features = ["exts"] }
|
uefi = { version="*",default-features = false, features = ["exts"] }
|
||||||
|
uefi-services = "0.11.0"
|
||||||
|
|
||||||
[dependencies.rdrand]
|
[dependencies.rdrand]
|
||||||
version = "0.8.1"
|
version = "0.8.1"
|
||||||
|
|
|
@ -17,10 +17,10 @@ static ALLOCATOR: Dummy = Dummy;
|
||||||
*/
|
*/
|
||||||
use linked_list_allocator::LockedHeap;
|
use linked_list_allocator::LockedHeap;
|
||||||
|
|
||||||
#[global_allocator]
|
// #[global_allocator]
|
||||||
pub static ALLOCATOR: LockedHeap = LockedHeap::empty();
|
pub static ALLOCATOR: LockedHeap = LockedHeap::empty();
|
||||||
|
|
||||||
#[alloc_error_handler]
|
// #[alloc_error_handler]
|
||||||
fn alloc_error_handler(layout: alloc::alloc::Layout) -> ! {
|
fn alloc_error_handler(layout: alloc::alloc::Layout) -> ! {
|
||||||
panic!("allocation error: {:?}", layout)
|
panic!("allocation error: {:?}", layout)
|
||||||
}
|
}
|
||||||
|
|
BIN
ableos/src/arch/uefi_86/firmware/OVMF-pure-efi.fd
Normal file
BIN
ableos/src/arch/uefi_86/firmware/OVMF-pure-efi.fd
Normal file
Binary file not shown.
|
@ -1,5 +1,7 @@
|
||||||
#![allow(clippy::empty_loop)]
|
#![allow(clippy::empty_loop)]
|
||||||
|
|
||||||
|
use x86_64::instructions::random::RdRand;
|
||||||
|
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
arch::{init, sloop},
|
arch::{init, sloop},
|
||||||
|
@ -36,7 +38,7 @@ lazy_static! {
|
||||||
/// The main entry point of the kernel
|
/// The main entry point of the kernel
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn kernel_main() -> ! {
|
pub fn kernel_main() -> ! {
|
||||||
init::init();
|
/* init::init();
|
||||||
log::set_max_level(BOOT_CONF.log_level());
|
log::set_max_level(BOOT_CONF.log_level());
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -74,7 +76,7 @@ pub fn kernel_main() -> ! {
|
||||||
}
|
}
|
||||||
|
|
||||||
start_facepalm();
|
start_facepalm();
|
||||||
|
*/
|
||||||
sloop()
|
sloop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,3 +107,27 @@ pub fn log_version_data() {
|
||||||
master().unwrap().brand_string().unwrap()
|
master().unwrap().brand_string().unwrap()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn generate_process_pass() -> u128 {
|
||||||
|
use rdrand::RdRand;
|
||||||
|
let gen = RdRand::new().unwrap();
|
||||||
|
let ret = (gen.try_next_u64().unwrap() as u128) << 64 | (gen.try_next_u64().unwrap() as u128);
|
||||||
|
ret
|
||||||
|
}
|
||||||
|
|
||||||
|
// #![no_main]
|
||||||
|
// #![no_std]
|
||||||
|
|
||||||
|
use uefi::prelude::*;
|
||||||
|
use uefi::ResultExt;
|
||||||
|
|
||||||
|
#[entry]
|
||||||
|
fn main(_handle: Handle, mut system_table: SystemTable<Boot>) -> Status {
|
||||||
|
uefi_services::init(&mut system_table).unwrap_success();
|
||||||
|
log_version_data();
|
||||||
|
|
||||||
|
kernel_main();
|
||||||
|
|
||||||
|
loop {}
|
||||||
|
// Status::SUCCESS
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
naked_functions,
|
naked_functions,
|
||||||
slice_pattern
|
slice_pattern
|
||||||
)]
|
)]
|
||||||
|
#![feature(abi_efiapi)]
|
||||||
|
|
||||||
/// Contains architecture specific code for aarch64.
|
/// Contains architecture specific code for aarch64.
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
|
|
|
@ -9,7 +9,7 @@ use {crate::arch::sloop, core::panic::PanicInfo};
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
/// This function is unsafe because it does not guarantee that the panic is handled.
|
/// This function is unsafe because it does not guarantee that the panic is handled.
|
||||||
#[panic_handler]
|
// #[panic_handler]
|
||||||
fn panic(info: &PanicInfo) -> ! {
|
fn panic(info: &PanicInfo) -> ! {
|
||||||
error!("{}", info);
|
error!("{}", info);
|
||||||
// help me use facepalm::start_facepalm;
|
// help me use facepalm::start_facepalm;
|
||||||
|
|
|
@ -23,6 +23,7 @@ enum MachineType {
|
||||||
X86,
|
X86,
|
||||||
RISCV,
|
RISCV,
|
||||||
ARM,
|
ARM,
|
||||||
|
Uefi86,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
|
@ -55,7 +56,8 @@ fn main() -> anyhow::Result<()> {
|
||||||
).run()?;
|
).run()?;
|
||||||
}
|
}
|
||||||
MachineType::RISCV => {
|
MachineType::RISCV => {
|
||||||
xshell::cmd!("cargo build --release --target=riscv64gc-unknown-none-elf").run()?;
|
xshell::cmd!("cargo build --release --target=riscv64gc-unknown-none-elf")
|
||||||
|
.run()?;
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
xshell::cmd!(
|
xshell::cmd!(
|
||||||
"qemu-system-riscv64
|
"qemu-system-riscv64
|
||||||
|
@ -67,6 +69,11 @@ fn main() -> anyhow::Result<()> {
|
||||||
-kernel target/riscv64gc-unknown-none-elf/release/ableos"
|
-kernel target/riscv64gc-unknown-none-elf/release/ableos"
|
||||||
).run()?;
|
).run()?;
|
||||||
}
|
}
|
||||||
|
MachineType::Uefi86 => {
|
||||||
|
xshell::cmd!("cargo build --release --target=x86_64-unknown-uefi").run()?;
|
||||||
|
|
||||||
|
xshell::cmd!("uefi-run -b src/arch/uefi_86/firmware/OVMF-pure-efi.fd target/x86_64-unknown-uefi/release/ableos.efi").run()?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,11 +85,15 @@ fn main() -> anyhow::Result<()> {
|
||||||
xshell::cmd!("cargo doc --open").run()?;
|
xshell::cmd!("cargo doc --open").run()?;
|
||||||
}
|
}
|
||||||
MachineType::ARM => {
|
MachineType::ARM => {
|
||||||
xshell::cmd!("cargo doc --open --target=json_targets/aarch64-ableos.json").run()?;
|
xshell::cmd!("cargo doc --open --target=json_targets/aarch64-ableos.json")
|
||||||
|
.run()?;
|
||||||
}
|
}
|
||||||
MachineType::RISCV => {
|
MachineType::RISCV => {
|
||||||
xshell::cmd!("cargo doc --open --target=riscv64gc-unknown-none-elf").run()?;
|
xshell::cmd!("cargo doc --open --target=riscv64gc-unknown-none-elf").run()?;
|
||||||
}
|
}
|
||||||
|
MachineType::Uefi86 => {
|
||||||
|
xshell::cmd!("cargo doc --open --target=x86_64-unknown-uefi").run()?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue