Skip to content

Commit

Permalink
set pc = 0 after ecall/halt in ceno_emul
Browse files Browse the repository at this point in the history
  • Loading branch information
kunxian-xia committed Sep 25, 2024
1 parent 66d635c commit 0713aba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions ceno_emul/src/vm_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ impl EmuContext for VMState {
let function = self.load_register(self.platform.reg_ecall())?;
let argument = self.load_register(self.platform.reg_arg0())?;
if function == self.platform.ecall_halt() && argument == self.platform.code_success() {
self.set_pc(ByteAddr(0));
self.succeeded = true;
Ok(true)
} else {
Expand Down
2 changes: 1 addition & 1 deletion ceno_zkvm/src/instructions/riscv/ecall/halt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl<E: ExtensionField> Instruction<E> for HaltInstruction<E> {
step.rs1().unwrap().value,
(ECALL_HALT[0] + (ECALL_HALT[1] << 16)) as u32
);
assert_eq!(step.pc().after.0, 0);
assert_eq!(step.pc().after.0, 0, "pc after ecall/halt {:x}", step.pc().after.0);

set_val!(
instance,
Expand Down

0 comments on commit 0713aba

Please sign in to comment.