nostd_env
is an experimental environment to run a Rust no_std
program.
Current status:
- A Rust
no_std
program runs on QEMU in X86 Long Mode. - BIOS functions can be called from a Rust
no_std
program. - Rust
alloc
library (Vec
,Box
, etc.) is working on a first-fit memory allocator.
Everything is a work in progress, everything is subject to change.
-
lmboot0
- is a small boot loader to run a Rustno_std
program in X86 Long Mode. Because its size <= 0x171 bytes (369 bytes), it fits in a Master Boot Record (MBR). -
lmbios1
- provides a method to call a Real Mode function from Long Mode. That is, it switches CPU operating mode from Long Mode to Real Mode, calls a function in Real Mode, then switches back to Long Mode. As the name suggests, its main purpose is to call BIOS functions from Long Mode. -
Micro (mu) Library
- MuAlloc - An implementation of alloc::GlobalAlloc and alloc::Allocator
- MuHeap - A First-Fit Memory Allocator using Doubly Linked List
- MuMutex - A Mutual Exclusion Primitive using Spin Lock
To see the documents, run the following command.
% cargo doc --open
- Nightly Rust (cf. https://www.rust-lang.org)
% rustup toolchain install nightly
- cargo-binutils (cf. https://github.com/rust-embedded/cargo-binutils)
% cargo install cargo-binutils
% rustup component add llvm-tools-preview
One of the following commands may be required when building nostd_env
.
macos% rustup component add rust-src --toolchain nightly-x86_64-apple-darwin
win11> rustup component add rust-src --toolchain nightly-x86_64-pc-windows-msvc
linux$ rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
- qemu-system-x86_64 (cf. https://www.qemu.org)
On Linux and macOS: At the top directory, enter the following commands.
% cargo build
% ./run-qemu.sh
On Windows 11: At the top directory, enter the following commands.
> cargo build
> .\run-qemu.ps1
Then, make a branch and edit files as you like.
On other systems: (To be described..)