diff options
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 4 | ||||
-rw-r--r-- | LICENSE | 21 | ||||
-rw-r--r-- | README.md | 15 | ||||
-rw-r--r-- | src/main.rs | 2 |
5 files changed, 40 insertions, 4 deletions
@@ -3,5 +3,5 @@ version = 3 [[package]] -name = "user-sw" +name = "rv64i-linux-user-no-std" version = "0.1.0" @@ -1,8 +1,8 @@ [package] -name = "user-sw" +name = "rv64i-linux-user-no-std" version = "0.1.0" authors = ["Johannes Stoelp"] edition = "2021" -license = "<TODO>" +license = "MIT" [dependencies] @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Johannes Stoelp + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a63e125 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# riscv64i `#[no_std]` Linux user space example + +This repository serves as reference to my later self as starting point for +`#[no_std]` rust code and to document some cargo configurations. + +It builds a riscv64i Linux user space binary which invokes some syscalls +according to the Linux [syscall(2) +ABI](https://man7.org/linux/man-pages/man2/syscall.2.html) for riscv. + +When running `cargo run` the binary will be executed using the QEMU riscv user +space emulator as configured in [.cargo/config](.cargo/config). + +## Requirements +To run this example the QEMU riscv64 user space emulator (`qemu-riscv64`) is +required. diff --git a/src/main.rs b/src/main.rs index 9b48fd7..7ece64b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ #![no_std] #![no_main] -use user_sw::{eprintln, println, sys}; +use rv64i_linux_user_no_std::{eprintln, println, sys}; fn main() { println!("Hello {} from rust main().", 1337); |