Post 1 - Freestanding Rust Binary
This commit is contained in:
14
blog_os/Cargo.toml
Normal file
14
blog_os/Cargo.toml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[package]
|
||||||
|
name = "blog_os"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
|
||||||
|
[profile.dev]
|
||||||
|
panic = "abort"
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
panic = "abort"
|
||||||
17
blog_os/src/main.rs
Normal file
17
blog_os/src/main.rs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#![no_std] // don't link the Rust standard library
|
||||||
|
#![no_main] // disable all Rust-level entry points
|
||||||
|
|
||||||
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
|
#[no_mangle] // don't mangle the name of this function
|
||||||
|
pub extern "C" fn _start() -> ! {
|
||||||
|
// this function is the entry point, since the linker looks for a function
|
||||||
|
// named `_start` by default
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// This function is called on panic.
|
||||||
|
#[panic_handler]
|
||||||
|
fn panic(_info: &PanicInfo) -> ! {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user