01_bareminimum: Use panic-abort crate instead of own handler

pull/4/head
Andre Richter 6 years ago
parent bf47dade3d
commit cb216785b3

@ -1,4 +1,14 @@
[[package]]
name = "kernel8"
version = "0.1.0"
dependencies = [
"panic-abort 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "panic-abort"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum panic-abort 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "75553c30311427a2d9f24a646fc8cedb00e1da1c6bd1608d71d634184c60392e"

@ -4,3 +4,4 @@ version = "0.1.0"
authors = ["Andre Richter <andre.o.richter@gmail.com>"]
[dependencies]
panic-abort = "0.1.1"

@ -26,9 +26,12 @@ much as possible, we are already setting up a Rust crate. This allows us to use
We define the crate to not use the standard library (`#![no_std]`), indicate
that it does not have a main function via `#![no_main]`, and also define a stub
for the `panic_fmt()` handler, which is a requirement for `no_std` crates.
for the `panic_fmt()` handler, which is a requirement for `no_std` crates. We do
this by pulling in the [panic-abort][pa] crate.
In th end, we (mis)use `main.rs` as a wrapper to process our assembly file via
[pa]: https://crates.io/crates/panic-abort
In summary, we (mis)use `main.rs` as a wrapper to process our assembly file via
`rustc`. The assembly file iself is included with the [global_asm!()][gasm]
macro.

@ -24,17 +24,8 @@
#![no_std]
#![no_main]
#![feature(lang_items)]
#![feature(global_asm)]
#[lang = "panic_fmt"]
unsafe extern "C" fn panic_fmt(
_args: core::fmt::Arguments,
_file: &'static str,
_line: u32,
_col: u32,
) -> ! {
loop {}
}
extern crate panic_abort;
global_asm!(include_str!("boot_cores.S"));

Loading…
Cancel
Save