ソースを参照

Update documents for publish

luojia65 4 年 前
コミット
5e1bcfb933
3 ファイル変更18 行追加2 行削除
  1. 1 1
      rustsbi/Cargo.toml
  2. 15 0
      rustsbi/src/lib.rs
  3. 2 1
      rustsbi/src/privileged.rs

+ 1 - 1
rustsbi/Cargo.toml

@@ -1,7 +1,7 @@
 [package]
 name = "rustsbi"
 description = "Minimal RISC-V's SBI implementation library in Rust"
-version = "0.1.0"
+version = "0.0.1"
 authors = ["luojia65 <[email protected]>"]
 repository = "https://github.com/luojia65/rustsbi"
 license = "MIT OR MulanPSL-2.0"

+ 15 - 0
rustsbi/src/lib.rs

@@ -1,3 +1,18 @@
+//! A minimal RISC-V's SBI implementation in Rust.
+//!
+//! This library adapts to embedded Rust's `embedded-hal` crate to provide basical SBI features. 
+//! When building for own platform, implement traits in this library and pass them to the functions
+//! begin with `init`. After that, you may call `rustsbi::ecall` in your own exception handler
+//! which would dispatch parameters from supervisor to the traits to execute SBI functions.
+//!
+//! The library also implements useful functions which may help with platform specific binaries.
+//! The `enter_privileged` maybe used to enter the operating system after the initialization 
+//! process is finished. The `LOGO` should be printed if necessary when the binary is initializing.
+//! 
+//! Note that this crate is a library which contains common building blocks in SBI implementation.
+//! It is not intended to be used directly; users should build own platforms with this library.
+//! RustSBI provides implementations on common platforms in separate platform crates.
+
 #![no_std]
 #![feature(asm)]
 

+ 2 - 1
rustsbi/src/privileged.rs

@@ -2,7 +2,8 @@
 ///
 /// Before calling this function, you must write target start address into `mepc` register,
 /// and write target privilege into `mstatus` register.
-/// Call on all harts after the initialization process is finished.
+/// Platform binarys should call this function on all harts to enter lower privilege levels
+/// after the initialization process is finished.
 ///
 /// After this function is called, the stack pointer register `sp` is swapped with `mscratch`,
 /// and a `mret` is called to return to `mepc` address with target privilege.