Skip to main content

sp1_core_executor/events/
syscall.rs

1use deepsize2::DeepSizeOf;
2use serde::{Deserialize, Serialize};
3
4use crate::{SyscallCode, TrapError, TrapResult};
5
6use super::MemoryReadRecord;
7
8/// Syscall Event.
9///
10/// This object encapsulated the information needed to prove a syscall invocation from the CPU
11/// table. This includes its shard, clk, syscall id, arguments, other relevant information.
12#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, DeepSizeOf)]
13#[repr(C)]
14pub struct SyscallEvent {
15    /// The program counter.
16    pub pc: u64,
17    /// The next program counter.
18    pub next_pc: u64,
19    /// The clock cycle.
20    pub clk: u64,
21    /// Whether this syscall should be sent.
22    pub should_send: bool,
23    /// The syscall code.
24    pub syscall_code: SyscallCode,
25    /// The syscall id.
26    pub syscall_id: u32,
27    /// The first operand value (`op_b`).
28    pub arg1: u64,
29    /// The second operand value (`op_c`).
30    pub arg2: u64,
31    /// The exit code.
32    pub exit_code: u32,
33    /// The memory record to read the next pc, if a `SIG_RETURN` is called.
34    pub sig_return_pc_record: Option<MemoryReadRecord>,
35    /// The trap result, if the syscall event leads to a trap.
36    pub trap_result: Option<TrapResult>,
37    /// The trap error, if the syscall event leads to a trap.
38    pub trap_error: Option<TrapError>,
39}