feat: third commit
This commit is contained in:
parent
968517646b
commit
0e056e62d1
20
lupos/target/debug/deps/rustversion-cf597c339519c569.d
Normal file
20
lupos/target/debug/deps/rustversion-cf597c339519c569.d
Normal file
@ -0,0 +1,20 @@
|
||||
/home/kuro/vs-workspace/LupOS/lupos/target/debug/deps/rustversion-cf597c339519c569.d: /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/lib.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/attr.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/bound.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/constfn.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/date.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/error.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/expand.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/expr.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/iter.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/release.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/time.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/token.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/version.rs /home/kuro/vs-workspace/LupOS/lupos/target/debug/build/rustversion-80895c343822e980/out/version.expr
|
||||
|
||||
/home/kuro/vs-workspace/LupOS/lupos/target/debug/deps/librustversion-cf597c339519c569.so: /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/lib.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/attr.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/bound.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/constfn.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/date.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/error.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/expand.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/expr.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/iter.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/release.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/time.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/token.rs /home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/version.rs /home/kuro/vs-workspace/LupOS/lupos/target/debug/build/rustversion-80895c343822e980/out/version.expr
|
||||
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/lib.rs:
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/attr.rs:
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/bound.rs:
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/constfn.rs:
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/date.rs:
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/error.rs:
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/expand.rs:
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/expr.rs:
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/iter.rs:
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/release.rs:
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/time.rs:
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/token.rs:
|
||||
/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/rustversion-1.0.17/src/version.rs:
|
||||
/home/kuro/vs-workspace/LupOS/lupos/target/debug/build/rustversion-80895c343822e980/out/version.expr:
|
||||
|
||||
# env-dep:OUT_DIR=/home/kuro/vs-workspace/LupOS/lupos/target/debug/build/rustversion-80895c343822e980/out
|
3
lupos/target/x86_64-lupos/CACHEDIR.TAG
Normal file
3
lupos/target/x86_64-lupos/CACHEDIR.TAG
Normal file
@ -0,0 +1,3 @@
|
||||
Signature: 8a477f597d28d172789f06886806bc55
|
||||
# This file is a cache directory tag created by cargo.
|
||||
# For information about cache directory tags see https://bford.info/cachedir/
|
0
lupos/target/x86_64-lupos/debug/.cargo-lock
Normal file
0
lupos/target/x86_64-lupos/debug/.cargo-lock
Normal file
@ -0,0 +1 @@
|
||||
This file has an mtime of when this was started.
|
@ -0,0 +1 @@
|
||||
This file has an mtime of when this was started.
|
@ -0,0 +1,3 @@
|
||||
{"$message_type":"diagnostic","message":"can't find crate for `core`","code":{"code":"E0463","explanation":"A crate was declared but cannot be found.\n\nErroneous code example:\n\n```compile_fail,E0463\nextern crate foo; // error: can't find crate\n```\n\nYou need to link your code to the relevant crate in order to be able to use it\n(through Cargo or the `-L` option of rustc, for example).\n\n## Common causes\n\n- The crate is not present at all. If using Cargo, add it to `[dependencies]`\n in Cargo.toml.\n- The crate is present, but under a different name. If using Cargo, look for\n `package = ` under `[dependencies]` in Cargo.toml.\n\n## Common causes for missing `std` or `core`\n\n- You are cross-compiling for a target which doesn't have `std` prepackaged.\n Consider one of the following:\n + Adding a pre-compiled version of std with `rustup target add`\n + Building std from source with `cargo build -Z build-std`\n + Using `#![no_std]` at the crate root, so you won't need `std` in the first\n place.\n- You are developing the compiler itself and haven't built libstd from source.\n You can usually build it with `x.py build library/std`. More information\n about x.py is available in the [rustc-dev-guide].\n\n[rustc-dev-guide]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#building-the-compiler\n"},"level":"error","spans":[{"file_name":"/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bitflags-2.5.0/src/lib.rs","byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1,"is_primary":true,"text":[],"label":"can't find crate","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the `x86_64-lupos` target may not be installed","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider downloading the target with `rustup target add x86_64-lupos`","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror[E0463]\u001b[0m\u001b[0m\u001b[1m: can't find crate for `core`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: the `x86_64-lupos` target may not be installed\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mhelp\u001b[0m\u001b[0m: consider downloading the target with `rustup target add x86_64-lupos`\u001b[0m\n\n"}
|
||||
{"$message_type":"diagnostic","message":"aborting due to 1 previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: aborting due to 1 previous error\u001b[0m\n\n"}
|
||||
{"$message_type":"diagnostic","message":"For more information about this error, try `rustc --explain E0463`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1mFor more information about this error, try `rustc --explain E0463`.\u001b[0m\n"}
|
@ -0,0 +1 @@
|
||||
724a9f581fd733e6
|
@ -0,0 +1 @@
|
||||
{"rustc":11410426090777951712,"features":"","declared_features":"","target":0,"profile":0,"path":0,"deps":[[4796557380116975802,"build_script_build",false,4012139224968854081]],"local":[{"Precalculated":"0.4.12"}],"rustflags":[],"config":0,"compile_kind":0}
|
@ -0,0 +1 @@
|
||||
This file has an mtime of when this was started.
|
@ -0,0 +1,3 @@
|
||||
{"$message_type":"diagnostic","message":"can't find crate for `core`","code":{"code":"E0463","explanation":"A crate was declared but cannot be found.\n\nErroneous code example:\n\n```compile_fail,E0463\nextern crate foo; // error: can't find crate\n```\n\nYou need to link your code to the relevant crate in order to be able to use it\n(through Cargo or the `-L` option of rustc, for example).\n\n## Common causes\n\n- The crate is not present at all. If using Cargo, add it to `[dependencies]`\n in Cargo.toml.\n- The crate is present, but under a different name. If using Cargo, look for\n `package = ` under `[dependencies]` in Cargo.toml.\n\n## Common causes for missing `std` or `core`\n\n- You are cross-compiling for a target which doesn't have `std` prepackaged.\n Consider one of the following:\n + Adding a pre-compiled version of std with `rustup target add`\n + Building std from source with `cargo build -Z build-std`\n + Using `#![no_std]` at the crate root, so you won't need `std` in the first\n place.\n- You are developing the compiler itself and haven't built libstd from source.\n You can usually build it with `x.py build library/std`. More information\n about x.py is available in the [rustc-dev-guide].\n\n[rustc-dev-guide]: https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html#building-the-compiler\n"},"level":"error","spans":[{"file_name":"/home/kuro/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/scopeguard-1.2.0/src/lib.rs","byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1,"is_primary":true,"text":[],"label":"can't find crate","suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the `x86_64-lupos` target may not be installed","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"consider downloading the target with `rustup target add x86_64-lupos`","code":null,"level":"help","spans":[],"children":[],"rendered":null}],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror[E0463]\u001b[0m\u001b[0m\u001b[1m: can't find crate for `core`\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mnote\u001b[0m\u001b[0m: the `x86_64-lupos` target may not be installed\u001b[0m\n\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m= \u001b[0m\u001b[0m\u001b[1mhelp\u001b[0m\u001b[0m: consider downloading the target with `rustup target add x86_64-lupos`\u001b[0m\n\n"}
|
||||
{"$message_type":"diagnostic","message":"aborting due to 1 previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: aborting due to 1 previous error\u001b[0m\n\n"}
|
||||
{"$message_type":"diagnostic","message":"For more information about this error, try `rustc --explain E0463`.","code":null,"level":"failure-note","spans":[],"children":[],"rendered":"\u001b[0m\u001b[1mFor more information about this error, try `rustc --explain E0463`.\u001b[0m\n"}
|
@ -0,0 +1 @@
|
||||
This file has an mtime of when this was started.
|
@ -0,0 +1 @@
|
||||
This file has an mtime of when this was started.
|
@ -0,0 +1 @@
|
||||
cargo:rustc-cfg=has_const_fn_trait_bound
|
@ -0,0 +1 @@
|
||||
/home/kuro/vs-workspace/LupOS/lupos/target/x86_64-lupos/debug/build/lock_api-2de7117dbaa0347d/out
|
@ -0,0 +1,9 @@
|
||||
error: error loading target specification: could not find specification for target "x86_64-lupos"
|
||||
|
|
||||
= help: run `rustc --print target-list` for a list of built-in targets
|
||||
|
||||
error: error loading target specification: could not find specification for target "x86_64-lupos"
|
||||
|
|
||||
= help: run `rustc --print target-list` for a list of built-in targets
|
||||
|
||||
warning: autocfg could not probe for `std`
|
28
lupos/tests/basic_boot.rs
Normal file
28
lupos/tests/basic_boot.rs
Normal file
@ -0,0 +1,28 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
#![feature(custom_test_frameworks)]
|
||||
#![test_runner(lupos::test_runner)]
|
||||
#![reexport_test_harness_main = "test_main"]
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
use lupos::println;
|
||||
|
||||
#[test_case]
|
||||
fn test_println() {
|
||||
println!("test_println output");
|
||||
}
|
||||
#[no_mangle] // don't mangle the name of this function
|
||||
pub extern "C" fn _start() -> ! {
|
||||
test_main();
|
||||
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn test_runner(_tests: &[&dyn Fn()]) {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(info: &PanicInfo) -> ! {
|
||||
lupos::test_panic_handler(info)
|
||||
}
|
70
lupos/tests/heap_allocation.rs
Normal file
70
lupos/tests/heap_allocation.rs
Normal file
@ -0,0 +1,70 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
#![feature(custom_test_frameworks)]
|
||||
#![test_runner(lupos::test_runner)]
|
||||
#![reexport_test_harness_main = "test_main"]
|
||||
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::{boxed::Box, vec::Vec};
|
||||
use lupos::allocator::HEAP_SIZE;
|
||||
use bootloader::{entry_point, BootInfo};
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
entry_point!(main);
|
||||
|
||||
fn main(boot_info: &'static BootInfo) -> ! {
|
||||
use lupos::allocator;
|
||||
use lupos::memory::{self, BootInfoFrameAllocator};
|
||||
use x86_64::VirtAddr;
|
||||
|
||||
lupos::init();
|
||||
let phys_mem_offset = VirtAddr::new(boot_info.physical_memory_offset);
|
||||
let mut mapper = unsafe { memory::init(phys_mem_offset) };
|
||||
let mut frame_allocator = unsafe { BootInfoFrameAllocator::init(&boot_info.memory_map) };
|
||||
allocator::init_heap(&mut mapper, &mut frame_allocator).expect("heap initialization failed");
|
||||
|
||||
test_main();
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[test_case]
|
||||
fn simple_allocation() {
|
||||
let heap_value_1 = Box::new(41);
|
||||
let heap_value_2 = Box::new(13);
|
||||
assert_eq!(*heap_value_1, 41);
|
||||
assert_eq!(*heap_value_2, 13);
|
||||
}
|
||||
|
||||
#[test_case]
|
||||
fn large_vec() {
|
||||
let n = 1000;
|
||||
let mut vec = Vec::new();
|
||||
for i in 0..n {
|
||||
vec.push(i);
|
||||
}
|
||||
assert_eq!(vec.iter().sum::<u64>(), (n - 1) * n / 2);
|
||||
}
|
||||
|
||||
#[test_case]
|
||||
fn many_boxes() {
|
||||
for i in 0..HEAP_SIZE {
|
||||
let x = Box::new(i);
|
||||
assert_eq!(*x, i);
|
||||
}
|
||||
}
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(info: &PanicInfo) -> ! {
|
||||
lupos::test_panic_handler(info)
|
||||
}
|
||||
|
||||
#[test_case]
|
||||
fn many_boxes_long_lived() {
|
||||
let long_lived = Box::new(1); // new
|
||||
for i in 0..HEAP_SIZE {
|
||||
let x = Box::new(i);
|
||||
assert_eq!(*x, i);
|
||||
}
|
||||
assert_eq!(*long_lived, 1); // new
|
||||
}
|
29
lupos/tests/should_panic.rs
Normal file
29
lupos/tests/should_panic.rs
Normal file
@ -0,0 +1,29 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
#![feature(custom_test_frameworks)]
|
||||
#![test_runner(test_runner)]
|
||||
#![reexport_test_harness_main = "test_main"]
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
use lupos::{QemuExitCode, exit_qemu, serial_println};
|
||||
use lupos::serial_print;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn _start() -> ! {
|
||||
should_fail();
|
||||
serial_println!("[test did not panic]");
|
||||
exit_qemu(QemuExitCode::Failed);
|
||||
loop{}
|
||||
}
|
||||
|
||||
fn should_fail() {
|
||||
serial_print!("should_panic::should_fail...\t");
|
||||
assert_eq!(0, 1);
|
||||
}
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(_info: &PanicInfo) -> ! {
|
||||
serial_println!("[ok]");
|
||||
exit_qemu(QemuExitCode::Success);
|
||||
loop {}
|
||||
}
|
63
lupos/tests/stack_overflow.rs
Normal file
63
lupos/tests/stack_overflow.rs
Normal file
@ -0,0 +1,63 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
#![feature(abi_x86_interrupt)]
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
use lupos::serial_print;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn _start() -> ! {
|
||||
serial_print!("stack_overflow::stack_overflow...\t");
|
||||
|
||||
lupos::gdt::init();
|
||||
init_test_idt();
|
||||
|
||||
// trigger a stack overflow
|
||||
stack_overflow();
|
||||
|
||||
panic!("Execution continued after stack overflow");
|
||||
}
|
||||
|
||||
#[allow(unconditional_recursion)]
|
||||
fn stack_overflow() {
|
||||
stack_overflow(); // for each recursion, the return address is pushed
|
||||
volatile::Volatile::new(0).read(); // prevent tail recursion optimizations
|
||||
}
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(info: &PanicInfo) -> ! {
|
||||
lupos::test_panic_handler(info)
|
||||
}
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use x86_64::structures::idt::InterruptDescriptorTable;
|
||||
|
||||
lazy_static! {
|
||||
static ref TEST_IDT: InterruptDescriptorTable = {
|
||||
let mut idt = InterruptDescriptorTable::new();
|
||||
unsafe {
|
||||
idt.double_fault
|
||||
.set_handler_fn(test_double_fault_handler)
|
||||
.set_stack_index(lupos::gdt::DOUBLE_FAULT_IST_INDEX);
|
||||
}
|
||||
|
||||
idt
|
||||
};
|
||||
}
|
||||
|
||||
pub fn init_test_idt() {
|
||||
TEST_IDT.load();
|
||||
}
|
||||
|
||||
use lupos::{exit_qemu, QemuExitCode, serial_println};
|
||||
use x86_64::structures::idt::InterruptStackFrame;
|
||||
|
||||
extern "x86-interrupt" fn test_double_fault_handler(
|
||||
_stack_frame: InterruptStackFrame,
|
||||
_error_code: u64,
|
||||
) -> ! {
|
||||
serial_println!("[ok]");
|
||||
exit_qemu(QemuExitCode::Success);
|
||||
loop {}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user