pr1.2
This commit is contained in:
@@ -7,8 +7,8 @@ use prometeu_bytecode::OpCode;
|
||||
use prometeu_bytecode::ProgramImage;
|
||||
use prometeu_bytecode::Value;
|
||||
use prometeu_bytecode::{
|
||||
TRAP_BAD_RET_SLOTS, TRAP_DEAD_GATE, TRAP_DIV_ZERO, TRAP_INVALID_FUNC, TRAP_INVALID_GATE,
|
||||
TRAP_INVALID_SYSCALL, TRAP_OOB, TRAP_STACK_UNDERFLOW, TRAP_TYPE, TrapInfo,
|
||||
TRAP_BAD_RET_SLOTS, TRAP_DIV_ZERO, TRAP_INVALID_FUNC, TRAP_INVALID_SYSCALL, TRAP_OOB,
|
||||
TRAP_STACK_UNDERFLOW, TRAP_TYPE, TrapInfo,
|
||||
};
|
||||
use prometeu_hal::vm_fault::VmFault;
|
||||
|
||||
@@ -1156,11 +1156,11 @@ impl VirtualMachine {
|
||||
) -> Result<&GateEntry, LogicalFrameEndingReason> {
|
||||
let idx = gate_id as usize;
|
||||
let entry = self.gate_pool.get(idx).ok_or_else(|| {
|
||||
self.trap(TRAP_INVALID_GATE, opcode, format!("Invalid gate id: {}", gate_id), pc)
|
||||
self.trap(TRAP_OOB, opcode, format!("Invalid gate id: {}", gate_id), pc)
|
||||
})?;
|
||||
if !entry.alive {
|
||||
return Err(self.trap(
|
||||
TRAP_DEAD_GATE,
|
||||
TRAP_OOB,
|
||||
opcode,
|
||||
format!("Dead gate id: {}", gate_id),
|
||||
pc,
|
||||
@@ -2034,7 +2034,7 @@ mod tests {
|
||||
let report = vm.run_budget(100, &mut native, &mut ctx).unwrap();
|
||||
match report.reason {
|
||||
LogicalFrameEndingReason::Trap(trap) => {
|
||||
assert_eq!(trap.code, TRAP_INVALID_GATE);
|
||||
assert_eq!(trap.code, TRAP_OOB);
|
||||
assert_eq!(trap.opcode, OpCode::GateLoad as u16);
|
||||
}
|
||||
_ => panic!("Expected Trap, got {:?}", report.reason),
|
||||
|
||||
Reference in New Issue
Block a user