mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
riscv: use upstream riscv module
Still pulling from git, as the version number hasn't been bumped yet. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
17dd2dcd6f
commit
09890a2ca3
8 changed files with 24 additions and 25 deletions
21
Cargo.lock
generated
21
Cargo.lock
generated
|
|
@ -194,7 +194,7 @@ name = "kernel"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"vexriscv",
|
||||
"riscv",
|
||||
"xous",
|
||||
]
|
||||
|
||||
|
|
@ -351,6 +351,15 @@ version = "0.6.16"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1132f845907680735a84409c3bebc64d1364a5683ffbce899550cd09d5eaefc1"
|
||||
|
||||
[[package]]
|
||||
name = "riscv"
|
||||
version = "0.5.5"
|
||||
source = "git+https://github.com/rust-embedded/riscv.git?rev=30af64cad7b3869a14182ab18b48ad0c71cce1ed#30af64cad7b3869a14182ab18b48ad0c71cce1ed"
|
||||
dependencies = [
|
||||
"bare-metal",
|
||||
"bit_field",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.2.3"
|
||||
|
|
@ -470,16 +479,6 @@ version = "0.8.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
||||
|
||||
[[package]]
|
||||
name = "vexriscv"
|
||||
version = "0.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a8cca4a24ec0049cadb38a5a0767529d28f3ea7bb5e5233b8f6cc02a1d8f0a51"
|
||||
dependencies = [
|
||||
"bare-metal",
|
||||
"bit_field",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.9.0+wasi-snapshot-preview1"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ description = "Core kernel for Xous, including task switching and memory managem
|
|||
|
||||
[dependencies]
|
||||
bitflags = "1.2.1"
|
||||
vexriscv = "0.0.2"
|
||||
riscv = { git = "https://github.com/rust-embedded/riscv.git", rev = "30af64cad7b3869a14182ab18b48ad0c71cce1ed" }
|
||||
xous = { path = "../xous-rs" }
|
||||
|
||||
[features]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#[cfg(target_arch = "riscv32")]
|
||||
mod riscv;
|
||||
#[cfg(target_arch = "riscv32")]
|
||||
pub use riscv::*;
|
||||
pub use crate::arch::riscv::*;
|
||||
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
mod riscv;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use vexriscv::register::{satp, sie, sstatus};
|
||||
use riscv::register::{satp, sie, sstatus};
|
||||
use xous::PID;
|
||||
|
||||
pub mod exception;
|
||||
|
|
@ -20,6 +20,10 @@ pub fn init() {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn wfi() {
|
||||
unsafe { riscv::asm::wfi() };
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
/// Everything required to keep track of a single thread of execution.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::arch::current_pid;
|
|||
use crate::arch::mem::MemoryMapping;
|
||||
use crate::mem::MemoryManagerHandle;
|
||||
use crate::processtable::{ProcessContext, ProcessState, SystemServicesHandle, RETURN_FROM_ISR};
|
||||
use vexriscv::register::{scause, sepc, sie, sstatus, stval, vsim, vsip};
|
||||
use riscv::register::{scause, sepc, sie, sstatus, stval, vexriscv::sim, vexriscv::sip};
|
||||
use xous::{SysCall, PID};
|
||||
|
||||
extern "Rust" {
|
||||
|
|
@ -26,11 +26,11 @@ pub fn enable_all_irqs() {
|
|||
pub fn enable_irq(irq_no: usize) {
|
||||
// Note that the vexriscv "IRQ Mask" register is inverse-logic --
|
||||
// that is, setting a bit in the "mask" register unmasks (i.e. enables) it.
|
||||
vsim::write(vsim::read() | (1 << irq_no));
|
||||
sim::write(sim::read() | (1 << irq_no));
|
||||
}
|
||||
|
||||
pub fn disable_irq(irq_no: usize) {
|
||||
vsim::write(vsim::read() & !(1 << irq_no));
|
||||
sim::write(sim::read() & !(1 << irq_no));
|
||||
}
|
||||
|
||||
static mut PREVIOUS_PID: Option<PID> = None;
|
||||
|
|
@ -169,7 +169,7 @@ pub extern "C" fn trap_handler(
|
|||
println!("CPU Exception on PID {}: {}", pid, ex);
|
||||
loop {}
|
||||
} else {
|
||||
let irqs_pending = vsip::read();
|
||||
let irqs_pending = sip::read();
|
||||
// Safe to access globals since interrupts are disabled
|
||||
// when this function runs.
|
||||
unsafe {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::mem::MemoryManager;
|
||||
use core::fmt;
|
||||
use vexriscv::register::satp;
|
||||
use riscv::register::satp;
|
||||
use xous::{MemoryFlags, PID};
|
||||
|
||||
pub const DEFAULT_STACK_TOP: usize = 0x8000_0000;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::processtable::ProcessContext;
|
||||
use vexriscv::register::{sepc, sstatus};
|
||||
use riscv::register::{sepc, sstatus};
|
||||
|
||||
extern "C" {
|
||||
fn _xous_resume_context(regs: *const usize) -> !;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,9 @@
|
|||
#![cfg_attr(not(test), no_main)]
|
||||
#![cfg_attr(not(test), no_std)]
|
||||
|
||||
extern crate vexriscv;
|
||||
|
||||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
|
||||
extern crate xous;
|
||||
|
||||
#[macro_use]
|
||||
mod debug;
|
||||
|
||||
|
|
@ -127,7 +123,7 @@ pub extern "C" fn main() {
|
|||
}
|
||||
None => {
|
||||
println!("No runnable tasks found. Zzz...");
|
||||
unsafe { vexriscv::asm::wfi() };
|
||||
arch::wfi();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue