#[repr(u32)]pub enum SyscallCode {
Show 43 variants
HALT = 0,
WRITE = 2,
ENTER_UNCONSTRAINED = 3,
EXIT_UNCONSTRAINED = 4,
SHA_EXTEND = 3_145_989,
SHA_COMPRESS = 65_798,
ED_ADD = 65_799,
ED_DECOMPRESS = 264,
KECCAK_PERMUTE = 65_801,
SECP256K1_ADD = 65_802,
SECP256K1_DOUBLE = 267,
SECP256K1_DECOMPRESS = 268,
BN254_ADD = 65_806,
BN254_DOUBLE = 271,
COMMIT = 16,
COMMIT_DEFERRED_PROOFS = 26,
VERIFY_SP1_PROOF = 27,
BLS12381_DECOMPRESS = 284,
HINT_LEN = 240,
HINT_READ = 241,
UINT256_MUL = 65_821,
U256XU2048_MUL = 65_839,
BLS12381_ADD = 65_822,
BLS12381_DOUBLE = 287,
BLS12381_FP_ADD = 65_824,
BLS12381_FP_SUB = 65_825,
BLS12381_FP_MUL = 65_826,
BLS12381_FP2_ADD = 65_827,
BLS12381_FP2_SUB = 65_828,
BLS12381_FP2_MUL = 65_829,
BN254_FP_ADD = 65_830,
BN254_FP_SUB = 65_831,
BN254_FP_MUL = 65_832,
BN254_FP2_ADD = 65_833,
BN254_FP2_SUB = 65_834,
BN254_FP2_MUL = 65_835,
SECP256R1_ADD = 65_836,
SECP256R1_DOUBLE = 301,
SECP256R1_DECOMPRESS = 302,
UINT256_ADD_CARRY = 65_840,
UINT256_MUL_CARRY = 65_841,
MPROTECT = 306,
POSEIDON2 = 307,
}Expand description
System Calls.
A system call is invoked by the the ecall instruction with a specific value in register t0.
The syscall number is a 32-bit integer with the following little-endian layout:
| Byte 0 | Byte 1 | Byte 2 | Byte 3 |
|---|---|---|---|
| ID | Table | Unused | Unused |
where:
- Byte 0: The system call identifier.
- Byte 1: Whether the handler of the system call has its own table. This is used in the CPU table to determine whether to lookup the syscall using the syscall interaction.
- Byte 2: Previously, this was the number of additional cycles the syscall uses. Now, this byte is unused, as each syscall instruction increments the clock by 256 additionally.
- Byte 3: Currently unused.
Variants§
HALT = 0
Halts the program.
WRITE = 2
Write to the output buffer.
ENTER_UNCONSTRAINED = 3
Enter unconstrained block.
EXIT_UNCONSTRAINED = 4
Exit unconstrained block.
SHA_EXTEND = 3_145_989
Executes the SHA_EXTEND precompile.
SHA_COMPRESS = 65_798
Executes the SHA_COMPRESS precompile.
ED_ADD = 65_799
Executes the ED_ADD precompile.
ED_DECOMPRESS = 264
Executes the ED_DECOMPRESS precompile.
KECCAK_PERMUTE = 65_801
Executes the KECCAK_PERMUTE precompile.
SECP256K1_ADD = 65_802
Executes the SECP256K1_ADD precompile.
SECP256K1_DOUBLE = 267
Executes the SECP256K1_DOUBLE precompile.
SECP256K1_DECOMPRESS = 268
Executes the SECP256K1_DECOMPRESS precompile.
BN254_ADD = 65_806
Executes the BN254_ADD precompile.
BN254_DOUBLE = 271
Executes the BN254_DOUBLE precompile.
COMMIT = 16
Executes the COMMIT precompile.
COMMIT_DEFERRED_PROOFS = 26
Executes the COMMIT_DEFERRED_PROOFS precompile.
VERIFY_SP1_PROOF = 27
Executes the VERIFY_SP1_PROOF precompile.
BLS12381_DECOMPRESS = 284
Executes the BLS12381_DECOMPRESS precompile.
HINT_LEN = 240
Executes the HINT_LEN precompile.
HINT_READ = 241
Executes the HINT_READ precompile.
UINT256_MUL = 65_821
Executes the UINT256_MUL precompile.
U256XU2048_MUL = 65_839
Executes the U256XU2048_MUL precompile.
BLS12381_ADD = 65_822
Executes the BLS12381_ADD precompile.
BLS12381_DOUBLE = 287
Executes the BLS12381_DOUBLE precompile.
BLS12381_FP_ADD = 65_824
Executes the BLS12381_FP_ADD precompile.
BLS12381_FP_SUB = 65_825
Executes the BLS12381_FP_SUB precompile.
BLS12381_FP_MUL = 65_826
Executes the BLS12381_FP_MUL precompile.
BLS12381_FP2_ADD = 65_827
Executes the BLS12381_FP2_ADD precompile.
BLS12381_FP2_SUB = 65_828
Executes the BLS12381_FP2_SUB precompile.
BLS12381_FP2_MUL = 65_829
Executes the BLS12381_FP2_MUL precompile.
BN254_FP_ADD = 65_830
Executes the BN254_FP_ADD precompile.
BN254_FP_SUB = 65_831
Executes the BN254_FP_SUB precompile.
BN254_FP_MUL = 65_832
Executes the BN254_FP_MUL precompile.
BN254_FP2_ADD = 65_833
Executes the BN254_FP2_ADD precompile.
BN254_FP2_SUB = 65_834
Executes the BN254_FP2_SUB precompile.
BN254_FP2_MUL = 65_835
Executes the BN254_FP2_MUL precompile.
SECP256R1_ADD = 65_836
Executes the SECP256R1_ADD precompile.
SECP256R1_DOUBLE = 301
Executes the SECP256R1_DOUBLE precompile.
SECP256R1_DECOMPRESS = 302
Executes the SECP256R1_DECOMPRESS precompile.
UINT256_ADD_CARRY = 65_840
Executes the UINT256_ADD_CARRY precompile.
UINT256_MUL_CARRY = 65_841
Executes the UINT256_MUL_CARRY precompile.
MPROTECT = 306
Executes the MPROTECT syscall.
POSEIDON2 = 307
Executes the POSEIDON2 syscall.
Implementations§
Source§impl SyscallCode
impl SyscallCode
Sourcepub fn from_u32(value: u32) -> Self
pub fn from_u32(value: u32) -> Self
Create a SyscallCode from a u32.
Sourcepub fn syscall_id(self) -> u32
pub fn syscall_id(self) -> u32
Get the system call identifier.
Sourcepub fn should_send(self) -> u32
pub fn should_send(self) -> u32
Get whether the handler of the system call has its own table.
Sourcepub fn count_map(&self) -> Self
pub fn count_map(&self) -> Self
Map a syscall to another one in order to coalesce their counts.
Sourcepub fn fp_op_map(&self) -> FieldOperation
pub fn fp_op_map(&self) -> FieldOperation
Map a syscall to a field operation.
Sourcepub fn uint256_op_map(&self) -> Uint256Operation
pub fn uint256_op_map(&self) -> Uint256Operation
Map a syscall to a uint256 operation.
Sourcepub fn as_air_id(self) -> Option<RiscvAirId>
pub fn as_air_id(self) -> Option<RiscvAirId>
Get the ID of the AIR used in the syscall implementation.
Sourcepub fn touched_addresses(&self) -> usize
pub fn touched_addresses(&self) -> usize
The maximum number of touched words for each syscall code.
Sourcepub fn touched_pages(&self) -> usize
pub fn touched_pages(&self) -> usize
The maximum number of touched pages for each syscall code.
Trait Implementations§
Source§impl Clone for SyscallCode
impl Clone for SyscallCode
Source§fn clone(&self) -> SyscallCode
fn clone(&self) -> SyscallCode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SyscallCode
impl Debug for SyscallCode
Source§impl DeepSizeOf for SyscallCode
impl DeepSizeOf for SyscallCode
Source§fn deep_size_of_children(&self, context: &mut Context) -> usize
fn deep_size_of_children(&self, context: &mut Context) -> usize
Source§fn deep_size_of(&self) -> usize
fn deep_size_of(&self) -> usize
Source§impl Default for SyscallCode
impl Default for SyscallCode
Source§fn default() -> SyscallCode
fn default() -> SyscallCode
Source§impl<'de> Deserialize<'de> for SyscallCode
impl<'de> Deserialize<'de> for SyscallCode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for SyscallCode
impl Display for SyscallCode
Source§impl Enum for SyscallCode
impl Enum for SyscallCode
Source§impl<V> EnumArray<V> for SyscallCode
impl<V> EnumArray<V> for SyscallCode
Source§impl Hash for SyscallCode
impl Hash for SyscallCode
Source§impl IntoEnumIterator for SyscallCode
impl IntoEnumIterator for SyscallCode
type Iterator = SyscallCodeIter
fn iter() -> SyscallCodeIter ⓘ
Source§impl Ord for SyscallCode
impl Ord for SyscallCode
Source§fn cmp(&self, other: &SyscallCode) -> Ordering
fn cmp(&self, other: &SyscallCode) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SyscallCode
impl PartialEq for SyscallCode
Source§impl PartialOrd for SyscallCode
impl PartialOrd for SyscallCode
Source§impl Serialize for SyscallCode
impl Serialize for SyscallCode
impl Copy for SyscallCode
impl Eq for SyscallCode
impl StructuralPartialEq for SyscallCode
Auto Trait Implementations§
impl Freeze for SyscallCode
impl RefUnwindSafe for SyscallCode
impl Send for SyscallCode
impl Sync for SyscallCode
impl Unpin for SyscallCode
impl UnsafeUnpin for SyscallCode
impl UnwindSafe for SyscallCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<Challenger, A> FromChallenger<Challenger, A> for Challengerwhere
Challenger: Clone,
impl<Challenger, A> FromChallenger<Challenger, A> for Challengerwhere
Challenger: Clone,
fn from_challenger(challenger: &Challenger, _backend: &A) -> Challenger
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
SeparatorPolicy. Read moreSource§fn separate_with_commas(&self) -> String
fn separate_with_commas(&self) -> String
Source§fn separate_with_spaces(&self) -> String
fn separate_with_spaces(&self) -> String
Source§fn separate_with_dots(&self) -> String
fn separate_with_dots(&self) -> String
Source§fn separate_with_underscores(&self) -> String
fn separate_with_underscores(&self) -> String
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.