pr 37
This commit is contained in:
@@ -36,6 +36,10 @@ pub const TRAP_DEAD_GATE: u32 = 0x02;
|
||||
pub const TRAP_OOB: u32 = 0x03;
|
||||
/// Attempted a typed operation on a gate whose storage type does not match.
|
||||
pub const TRAP_TYPE: u32 = 0x04;
|
||||
/// The syscall ID provided is not recognized by the system.
|
||||
pub const TRAP_INVALID_SYSCALL: u32 = 0x0000_0007;
|
||||
/// Not enough arguments on the stack for the requested syscall.
|
||||
pub const TRAP_STACK_UNDERFLOW: u32 = 0x0000_0008;
|
||||
|
||||
/// Detailed information about a runtime trap.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@@ -74,6 +78,8 @@ mod tests {
|
||||
assert_eq!(TRAP_DEAD_GATE, 0x02);
|
||||
assert_eq!(TRAP_OOB, 0x03);
|
||||
assert_eq!(TRAP_TYPE, 0x04);
|
||||
assert_eq!(TRAP_INVALID_SYSCALL, 0x07);
|
||||
assert_eq!(TRAP_STACK_UNDERFLOW, 0x08);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -86,6 +92,10 @@ HIP Traps:
|
||||
- OOB (0x03): Access beyond allocated slots.
|
||||
- TYPE (0x04): Type mismatch during heap access.
|
||||
|
||||
System Traps:
|
||||
- INVALID_SYSCALL (0x07): Unknown syscall ID.
|
||||
- STACK_UNDERFLOW (0x08): Missing syscall arguments.
|
||||
|
||||
Operand Sizes:
|
||||
- Alloc: 8 bytes (u32 type_id, u32 slots)
|
||||
- GateLoad: 4 bytes (u32 offset)
|
||||
@@ -95,8 +105,9 @@ Operand Sizes:
|
||||
// This test serves as a "doc-lock".
|
||||
// If you change the ABI, you must update this string.
|
||||
let current_info = format!(
|
||||
"\nHIP Traps:\n- INVALID_GATE (0x{:02X}): Non-existent gate handle.\n- DEAD_GATE (0x{:02X}): Gate handle with RC=0.\n- OOB (0x{:02X}): Access beyond allocated slots.\n- TYPE (0x{:02X}): Type mismatch during heap access.\n\nOperand Sizes:\n- Alloc: {} bytes (u32 type_id, u32 slots)\n- GateLoad: {} bytes (u32 offset)\n- GateStore: {} bytes (u32 offset)\n- PopN: {} bytes (u32 count)\n",
|
||||
"\nHIP Traps:\n- INVALID_GATE (0x{:02X}): Non-existent gate handle.\n- DEAD_GATE (0x{:02X}): Gate handle with RC=0.\n- OOB (0x{:02X}): Access beyond allocated slots.\n- TYPE (0x{:02X}): Type mismatch during heap access.\n\nSystem Traps:\n- INVALID_SYSCALL (0x{:02X}): Unknown syscall ID.\n- STACK_UNDERFLOW (0x{:02X}): Missing syscall arguments.\n\nOperand Sizes:\n- Alloc: {} bytes (u32 type_id, u32 slots)\n- GateLoad: {} bytes (u32 offset)\n- GateStore: {} bytes (u32 offset)\n- PopN: {} bytes (u32 count)\n",
|
||||
TRAP_INVALID_GATE, TRAP_DEAD_GATE, TRAP_OOB, TRAP_TYPE,
|
||||
TRAP_INVALID_SYSCALL, TRAP_STACK_UNDERFLOW,
|
||||
operand_size(OpCode::Alloc),
|
||||
operand_size(OpCode::GateLoad),
|
||||
operand_size(OpCode::GateStore),
|
||||
|
||||
Reference in New Issue
Block a user