From b8d4c630667b262a60f6d8939931e956e250d8cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Kr=C3=BCger?= Date: Mon, 18 Dec 2023 14:24:41 +0000 Subject: [PATCH] RISC-V: Upgrade rvemu version --- src/risc_v/kernel_loader/Cargo.lock | 3 +-- src/risc_v/kernel_loader/Cargo.toml | 4 +++- src/risc_v/sandbox/Cargo.lock | 3 +-- src/risc_v/sandbox/Cargo.toml | 3 ++- src/risc_v/sandbox/src/main.rs | 24 +++++++++++++------ .../Run risc-v unit tests (ud).out | 2 +- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/risc_v/kernel_loader/Cargo.lock b/src/risc_v/kernel_loader/Cargo.lock index 4bd4768ba653..efb9d9e27b5a 100644 --- a/src/risc_v/kernel_loader/Cargo.lock +++ b/src/risc_v/kernel_loader/Cargo.lock @@ -110,8 +110,7 @@ dependencies = [ [[package]] name = "rvemu" version = "0.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2cf2d0137e679b050f594199a7fddd31f06a80be7c8dc572cee89fa850e732b" +source = "git+https://github.com/d0iasm/rvemu.git#f55eb5b376f22a73c0cf2630848c03f8d5c93922" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/src/risc_v/kernel_loader/Cargo.toml b/src/risc_v/kernel_loader/Cargo.toml index 4b3af3b56297..0825bce682f1 100644 --- a/src/risc_v/kernel_loader/Cargo.toml +++ b/src/risc_v/kernel_loader/Cargo.toml @@ -7,5 +7,7 @@ edition = "2021" [dependencies] goblin = "0.7.1" -rvemu = "0.0.11" derive_more = "0.99.17" + +[dependencies.rvemu] +git = "https://github.com/d0iasm/rvemu.git" diff --git a/src/risc_v/sandbox/Cargo.lock b/src/risc_v/sandbox/Cargo.lock index 196bcc4845e0..aee4e170b92c 100644 --- a/src/risc_v/sandbox/Cargo.lock +++ b/src/risc_v/sandbox/Cargo.lock @@ -221,8 +221,7 @@ dependencies = [ [[package]] name = "rvemu" version = "0.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2cf2d0137e679b050f594199a7fddd31f06a80be7c8dc572cee89fa850e732b" +source = "git+https://github.com/d0iasm/rvemu.git#f55eb5b376f22a73c0cf2630848c03f8d5c93922" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/src/risc_v/sandbox/Cargo.toml b/src/risc_v/sandbox/Cargo.toml index 84e9ce485c0c..67730173eb36 100644 --- a/src/risc_v/sandbox/Cargo.toml +++ b/src/risc_v/sandbox/Cargo.toml @@ -5,7 +5,6 @@ edition = "2021" [dependencies] goblin = "0.7.1" -rvemu = "0.0.11" derive_more = "0.99.17" [dependencies.clap] @@ -16,3 +15,5 @@ features = ["derive"] version = "0.1.0" path = "../kernel_loader" +[dependencies.rvemu] +git = "https://github.com/d0iasm/rvemu.git" diff --git a/src/risc_v/sandbox/src/main.rs b/src/risc_v/sandbox/src/main.rs index 89361e3604ac..191041d8c37b 100644 --- a/src/risc_v/sandbox/src/main.rs +++ b/src/risc_v/sandbox/src/main.rs @@ -35,15 +35,25 @@ fn main() -> Result<(), Box> { emu.cpu .execute() .map(|_| ()) - .or_else(|exception| match exception { - Exception::EnvironmentCallFromUMode => syscall::handle(&mut emu), + .or_else(|exception| -> Result<(), Box> { + match exception { + Exception::EnvironmentCallFromUMode => { + syscall::handle(&mut emu)?; - _ => { - let trap = exception.take_trap(&mut emu.cpu); + // We need to update the program counter ourselves now. + // This is a recent change in behaviour in RVEmu. + emu.cpu.pc += 4; - // Don't bother handling other exceptions. For now they're - // all fatal. - panic!("Exception {:?} at {:#x}: {:?}", exception, prev_pc, trap) + Ok(()) + } + + _ => { + let trap = exception.take_trap(&mut emu.cpu); + + // Don't bother handling other exceptions. For now they're + // all fatal. + panic!("Exception {:?} at {:#x}: {:?}", exception, prev_pc, trap) + } } })?; diff --git a/tezt/tests/expected/risc_v_sandbox.ml/Run risc-v unit tests (ud).out b/tezt/tests/expected/risc_v_sandbox.ml/Run risc-v unit tests (ud).out index a4de9aa83429..0b0d19341fa0 100644 --- a/tezt/tests/expected/risc_v_sandbox.ml/Run risc-v unit tests (ud).out +++ b/tezt/tests/expected/risc_v_sandbox.ml/Run risc-v unit tests (ud).out @@ -9,7 +9,7 @@ rv64ud-p-fmin: fail rv64ud-p-ldst: fail rv64ud-p-move: fail rv64ud-p-recoding: fail -rv64ud-p-structural: fail +rv64ud-p-structural: success rv64ud-v-fadd: fail rv64ud-v-fclass: fail rv64ud-v-fcmp: fail -- GitLab