diff options
author | David Li <li.davidm96@gmail.com> | 2015-12-20 22:29:28 -0500 |
---|---|---|
committer | David Li <li.davidm96@gmail.com> | 2015-12-20 22:29:28 -0500 |
commit | 398e6b6a3c7cc7efd579e00f6f65bde40e39d628 (patch) | |
tree | 10b075be354e8dc6c602629fb0dec4663782d624 | |
parent | 8ca42acf1a92ac0d811bbeecf8aed25a8c2d5a30 (diff) |
Try handling syscalls
-rw-r--r-- | src/simulator.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/simulator.rs b/src/simulator.rs index a7140fe..8142b32 100644 --- a/src/simulator.rs +++ b/src/simulator.rs @@ -69,7 +69,7 @@ impl Simulator { pub fn run(&mut self) { let base_core = Core { - pc: 0x10000, + pc: 0x1002C, registers: RegisterFile::new(), running: true, }; @@ -273,11 +273,18 @@ impl Simulator { panic!("Invalid store funct3code: 0x{:x}", inst.funct3()); } }, - isa::opcodes::SYSTEM => { - + isa::opcodes::SYSTEM => match inst.i_imm() { + 0x0 => { + // System call + println!("System call {}:", core.registers.read_word(isa::Register::X10)); + println!("Argument {:X}:", core.registers.read_word(isa::Register::X11)); + } + _ => { + + } }, _ => { - panic!("Invalid opcode: 0x{:02X}", inst.opcode()); + panic!("Invalid opcode: 0x{:02X} at PC 0x{:X}", inst.opcode(), pc); } } } |