| 805 | // --- Sub-decoders --- |
| 806 | |
| 807 | fn decode_fence(word: u32) -> Result<DecodedInsn, VmError> { |
| 808 | match funct3(word) { |
| 809 | 0 => Ok(DecodedInsn::Fence { |
| 810 | fm: field(word, 31, 28) as u8, |
| 811 | pred: field(word, 27, 24) as u8, |
| 812 | succ: field(word, 23, 20) as u8, |
| 813 | }), |
| 814 | 1 => Ok(DecodedInsn::FenceI), |
| 815 | _ => Err(VmError::IllegalInstruction(word)), |
| 816 | } |
| 817 | } |
| 818 | |
| 819 | fn decode_system(word: u32) -> Result<DecodedInsn, VmError> { |
| 820 | // Check for SFENCE.VMA first (opcode 0x73, funct3=0, but with specific pattern) |