diff options
Diffstat (limited to 'src/instructions.rs')
| -rw-r--r-- | src/instructions.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/instructions.rs b/src/instructions.rs index fe79684..99df830 100644 --- a/src/instructions.rs +++ b/src/instructions.rs @@ -13,7 +13,10 @@ use crate::{ consts::DWord, core::Core, decode::Instruction, - exceptions::{Exception, ExceptionType::IllegalInstruction}, + exceptions::{ + Exception, + ExceptionType::{self, IllegalInstruction}, + }, }; fn illegal(instr: Instruction) -> Result<(), Exception> { @@ -130,6 +133,15 @@ pub(crate) fn find_and_exec(instr: Instruction, core: &mut Core) -> Result<(), E } _ => illegal(instr), }, + 0b11100 => match (instr.funct3(), instr.funct12(), instr.rs1(), instr.rd()) { + (0b000, 0b000000000000, 0, 0) => { + // TODO: When privilege modes are added, make the exception raised by ecall + // depend on privilege mode + Err(ExceptionType::EnvironmentCallFromMMode.with_no_value()) + } + (0b000, 0b000000000001, 0, 0) => Err(ExceptionType::Breakpoint.with_no_value()), + _ => illegal(instr), + }, _ => illegal(instr), } } |
