diff --git a/Cargo.lock b/Cargo.lock index 4ecb93c..030016b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -91,12 +91,21 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "vexriscv" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bare-metal 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "xous-kernel" version = "0.1.0" dependencies = [ + "vexriscv 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "xous-kernel-riscv-rt 0.6.1", - "xous-riscv 0.5.4", ] [[package]] @@ -104,8 +113,8 @@ name = "xous-kernel-riscv-rt" version = "0.6.1" dependencies = [ "r0 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "vexriscv 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "xous-kernel-riscv-rt-macros 0.1.6", - "xous-riscv 0.5.4", ] [[package]] @@ -118,14 +127,6 @@ dependencies = [ "syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "xous-riscv" -version = "0.5.4" -dependencies = [ - "bare-metal 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [metadata] "checksum bare-metal 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a3caf393d93b2d453e80638d0674597020cef3382ada454faacd43d1a55a735a" "checksum bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed8765909f9009617974ab6b7d332625b320b33c326b1e9321382ef1999b5d56" @@ -140,3 +141,4 @@ dependencies = [ "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum vexriscv 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a8cca4a24ec0049cadb38a5a0767529d28f3ea7bb5e5233b8f6cc02a1d8f0a51" diff --git a/Cargo.toml b/Cargo.toml index 2b4e30d..17c60c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" description = "Core kernel for Xous, including task switching and memory management" [dependencies] -xous-riscv = { path = "xous-riscv" } +vexriscv = "0.0.2" xous-kernel-riscv-rt = { path = "xous-kernel-riscv-rt" } [profile.release] diff --git a/src/irq.rs b/src/irq.rs index 22afc91..de15296 100644 --- a/src/irq.rs +++ b/src/irq.rs @@ -1,6 +1,6 @@ use crate::definitions::XousError; use crate::filled_array; -use xous_riscv::register::{mstatus, vmim}; +use vexriscv::register::{mstatus, vmim}; static mut IRQ_HANDLERS: [Option; 32] = filled_array![None; 32]; diff --git a/src/lib.rs b/src/lib.rs deleted file mode 100644 index 0842b67..0000000 --- a/src/lib.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![no_std] - -extern crate xous_riscv; - -// use core::panic::PanicInfo; -// #[panic_handler] -// fn handle_panic(_arg: &PanicInfo) -> ! { -// loop {} -// } - -// Allow consumers of this library to make syscalls -// pub mod syscalls; diff --git a/src/main.rs b/src/main.rs index b794d05..a53a357 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ #![no_std] #![no_main] -extern crate xous_riscv; +extern crate vexriscv; mod definitions; mod irq; mod macros; @@ -13,7 +13,7 @@ pub use irq::sys_interrupt_claim; use core::panic::PanicInfo; use xous_kernel_riscv_rt::xous_kernel_entry; -use xous_riscv::register::{mcause, mstatus, mie, vmim, vmip}; +use vexriscv::register::{mcause, mstatus, mie, vmim, vmip}; use mem::MemoryManager; use processtable::ProcessTable; @@ -39,6 +39,7 @@ fn xous_main() -> ! { } let mut mm = MemoryManager::new(); let mut pt = ProcessTable::new(&mut mm); + sys_interrupt_claim(2, |_| { let uart_ptr = 0xE000_1800 as *mut usize; print_str(uart_ptr, "hello, world!\r\n"); @@ -59,7 +60,7 @@ fn xous_main() -> ! { print_str(uart_ptr, "greetings!\r\n"); loop { - unsafe { xous_riscv::asm::wfi() }; + unsafe { vexriscv::asm::wfi() }; } } diff --git a/src/mem.rs b/src/mem.rs index a9e9178..2ac849c 100644 --- a/src/mem.rs +++ b/src/mem.rs @@ -1,6 +1,6 @@ use crate::definitions::{XousError, XousPid, MemoryAddress}; use core::num::NonZeroUsize; -use xous_riscv::register::mstatus; +use vexriscv::register::mstatus; const FLASH_START: usize = 0x20000000; const FLASH_SIZE: usize = 16_777_216; diff --git a/xous-kernel-riscv-rt/Cargo.toml b/xous-kernel-riscv-rt/Cargo.toml index fc53327..f736d6f 100644 --- a/xous-kernel-riscv-rt/Cargo.toml +++ b/xous-kernel-riscv-rt/Cargo.toml @@ -10,9 +10,9 @@ license = "ISC" [dependencies] r0 = "0.2.2" -xous-riscv = { path = "../xous-riscv" } +vexriscv = "0.0.2" xous-kernel-riscv-rt-macros = { path = "macros" } [dev-dependencies] -xous-riscv = { path = "../xous-riscv" } +vexriscv = "0.0.2" panic-halt = "0.2.0" diff --git a/xous-kernel-riscv-rt/src/lib.rs b/xous-kernel-riscv-rt/src/lib.rs index bc41b5c..ee4647e 100644 --- a/xous-kernel-riscv-rt/src/lib.rs +++ b/xous-kernel-riscv-rt/src/lib.rs @@ -253,13 +253,13 @@ #![deny(missing_docs)] #![deny(warnings)] -extern crate xous_riscv; +extern crate vexriscv; extern crate xous_kernel_riscv_rt_macros as macros; extern crate r0; pub use macros::{xous_kernel_entry, pre_init}; -use xous_riscv::register::mstatus; +use vexriscv::register::mstatus; #[export_name = "error: riscv-rt appears more than once in the dependency graph"] #[doc(hidden)] @@ -341,11 +341,11 @@ pub unsafe extern "Rust" fn default_pre_init() {} #[doc(hidden)] #[no_mangle] pub extern "Rust" fn default_mp_hook() -> bool { - use xous_riscv::register::mhartid; + use vexriscv::register::mhartid; match mhartid::read() { 0 => true, _ => loop { - unsafe { xous_riscv::asm::wfi() } + unsafe { vexriscv::asm::wfi() } }, } }