Giter VIP home page Giter VIP logo

rustsbi's Issues

Software Delegate IllegalInstruction Exception to Supervisor Mode

Now RustSBI just panic if the illegal instruction is not related to platform/privilege spec compatibility. It causes that when an illegal instruction occurs in application(U Mode), the kernel(S Mode) cannot catch and handle it since RustSBI does not delegate the exception to the kernel but just panic.

In my opinion, we can delegate(software) the exception to kernel in RustSBI by setting scause/stval etc. and jumping to the address which stvec points to, although there are plenty of details to be considered...

Why is the symbol not found?

= note: rust-lld: error: /root/rustsbi/target/riscv64gc-unknown-none-elf/debug/deps/libriscv-d89f58cca82b1706.rlib(riscv.o): cannot link object files with different floating-point ABI
rust-lld: error: undefined symbol: _max_hart_id
>>> referenced by main.rs:76 (platform/k210/src/main.rs:76)
>>> /root/rustsbi/target/riscv64gc-unknown-none-elf/debug/deps/rustsbi_k210-fa3b824066eafffd.1hd3n18pcrelb196.rcgu.o:(_start)
>>> referenced by main.rs:76 (platform/k210/src/main.rs:76)
>>> /root/rustsbi/target/riscv64gc-unknown-none-elf/debug/deps/rustsbi_k210-fa3b824066eafffd.1hd3n18pcrelb196.rcgu.o:(_start)

      rust-lld: error: undefined symbol: _stack_start
      >>> referenced by main.rs:76 (platform/k210/src/main.rs:76)
      >>>               /root/rustsbi/target/riscv64gc-unknown-none-elf/debug/deps/rustsbi_k210-fa3b824066eafffd.1hd3n18pcrelb196.rcgu.o:(_start)
      
      rust-lld: error: undefined symbol: _hart_stack_size
      >>> referenced by main.rs:76 (platform/k210/src/main.rs:76)
      >>>               /root/rustsbi/target/riscv64gc-unknown-none-elf/debug/deps/rustsbi_k210-fa3b824066eafffd.1hd3n18pcrelb196.rcgu.o:(_start)
      >>> referenced by main.rs:76 (platform/k210/src/main.rs:76)
      >>>               /root/rustsbi/target/riscv64gc-unknown-none-elf/debug/deps/rustsbi_k210-fa3b824066eafffd.1hd3n18pcrelb196.rcgu.o:(_start)
      
      rust-lld: error: undefined symbol: _sbss
      >>> referenced by main.rs:118 (platform/k210/src/main.rs:118)
      >>>               /root/rustsbi/target/riscv64gc-unknown-none-elf/debug/deps/rustsbi_k210-fa3b824066eafffd.1hd3n18pcrelb196.rcgu.o:(_start)
      
      rust-lld: error: undefined symbol: _ebss
      >>> referenced by main.rs:118 (platform/k210/src/main.rs:118)
      >>>               /root/rustsbi/target/riscv64gc-unknown-none-elf/debug/deps/rustsbi_k210-fa3b824066eafffd.1hd3n18pcrelb196.rcgu.o:(_start)
      
      rust-lld: error: undefined symbol: _sdata
      >>> referenced by main.rs:119 (platform/k210/src/main.rs:119)
      >>>               /root/rustsbi/target/riscv64gc-unknown-none-elf/debug/deps/rustsbi_k210-fa3b824066eafffd.1hd3n18pcrelb196.rcgu.o:(_start)
      
      rust-lld: error: undefined symbol: _sidata
      >>> referenced by main.rs:119 (platform/k210/src/main.rs:119)
      >>>               /root/rustsbi/target/riscv64gc-unknown-none-elf/debug/deps/rustsbi_k210-fa3b824066eafffd.1hd3n18pcrelb196.rcgu.o:(_start)

为什么会找不到这些符号
target = riscv64gc-unknown-none-elf

能否限定 RustSBI 的实现通过 &‘static dyn 传入模块的实现对象?

现在各个模块的 init 都使用一般的泛型,并且传入转移所有权的实现对象。然而这样的对象由于无法在库编译时确定尺寸,实际上无法存储,只能放在堆上,这要求 SBI 的实现必须提供堆,这对于某些嵌入式设备似乎不够友好。

既然目前 RustSBI 已经以全局的方式提供服务,基本上已经在事实上要求实现对象是静态的。能否直接要求实现传入 &'static dyn 来初始化各模块?RustSBI 本体不再负责保存这些对象,只是通过指针访问它们。

这样还有个好处是设置对象可以是原子操作更新指针,更快更安全。

安装问题

下载安装包之后,得到两个文件, rustsbi-qemu, rustsbi-qemu.bin, 然后该怎么按照rustsbi呢

More build guidance in README.md

For someone who isn't using Rust for cross compilation on a daily basis, I found the README a bit lacking in how to build this. I tried

$ rustup target add riscv64gc-unknown-linux-gnu
$ cargo build --target riscv64gc-unknown-linux-gnu

but that crashed out with:

    Updating crates.io index
   Compiling memchr v2.4.1
   Compiling regex-syntax v0.6.25
   Compiling lazy_static v1.4.0
   Compiling nb v1.0.0
   Compiling bare-metal v1.0.0
   Compiling bit_field v0.10.1
   Compiling void v1.0.2
   Compiling nb v0.1.3
   Compiling embedded-hal v0.2.6
   Compiling aho-corasick v0.7.18
   Compiling regex v1.5.4
   Compiling riscv-target v0.1.2
   Compiling riscv v0.7.0
error: failed to run custom build command for `riscv v0.7.0`

Caused by:
  process didn't exit successfully: `/home/tommy/projects/chipsalliance/workloads/rustsbi/target/debug/build/riscv-c23973cdc9c82cbb/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /home/tommy/.cargo.x86_64-linux/registry/src/github.com-1ecc6299db9ec823/riscv-0.7.0/build.rs:22:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

How to work on riscv32?

I am using qemu-system-riscv32 to load rustsbi, and nothing to show.

If possible, please help provide documentation about how to build for riscv32.

Page fault delegation

话说根据boot之后sbi输出的medeleg来看,是不是Page fault没有进行委托QAQ

rustsbi qemu panic due to invalid instruction

加载 rustsbi 时panic,qemu 5.2.50,我的机器是一台m1 mac,但是据反馈,intel的mac也有此问题,但其降到5.2.0就OK了,m1 的 mac qemu 降到5.2.0暂时无法运行,我这边没法尝试。

我觉得还是和qemu 5.2.50有关。

➜  os git:(main)  qemu-system-riscv64 \
                -machine virt \
                -nographic \
                -bios ../bootloader/rustsbi-qemu.bin
[rustsbi] RustSBI version 0.1.1
.______       __    __      _______.___________.  _______..______   __
|   _  \     |  |  |  |    /       |           | /       ||   _  \ |  |
|  |_)  |    |  |  |  |   |   (----`---|  |----`|   (----`|  |_)  ||  |
|      /     |  |  |  |    \   \       |  |      \   \    |   _  < |  |
|  |\  \----.|  `--'  |.----)   |      |  |  .----)   |   |  |_)  ||  |
| _| `._____| \______/ |_______/       |__|  |_______/    |______/ |__|

[rustsbi] Platform: QEMU (Version 0.1.0)
[rustsbi] misa: RV64ACDFIMSU
[rustsbi] mideleg: 0x222
[rustsbi] medeleg: 0xb1ab
[rustsbi-dtb] Hart count: cluster0 with 1 cores
[rustsbi] Kernel entry: 0x80200000
[rustsbi-panic] hart 0 panicked at 'invalid instruction, mepc: 0000000080003eba, instruction: 0000000030200073', platform\qemu\src\main.rs:458:17
[rustsbi-panic] system shutdown scheduled due to RustSBI panic

RustSBI的浮点指令支持

我在用fmv.w.x指令时,发现被RustSBI视为非法指令
请问RustSBI没有提供浮点指令的支持吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.