diff --git a/src/risc_v/kernel_loader/Cargo.lock b/src/risc_v/kernel_loader/Cargo.lock index 4bd4768ba653ddc1b2b3a7666cd2beedbe8fc32f..efb9d9e27b5a15677be7f7a30953c25970a232d9 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 4b3af3b562979195fa81b95cb7ad572c2059ddb2..0825bce682f14c75a5fe27230dcfa85ef8596be9 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 196bcc4845e089b1d5db3e34708b6fd1cf80ed06..aee4e170b92c6b6427ef671fc6259ecf00b50106 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 84e9ce485c0cd2a0660c20883d43e2d132490e81..67730173eb362d785c296c1f3c6920d0f75b7d1e 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 89361e3604acf7b8f7b793140894dc6d9b8558e3..191041d8c37b4e1f40bb6a177e66d0563d0a79ab 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 a4de9aa8342990e14333462efe6535d6eaaa41b6..0b0d19341fa0f3967e3a6193ad0a306c980b8b2b 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