Skip to content

Commit

Permalink
change syscall code
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsing committed Sep 23, 2024
1 parent c9f170c commit 1e333ed
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/fr_sp1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct Fr(pub(crate) [u32; 8]);

#[inline]
fn syscall_bn254_scalar_mul(p: *mut u32, q: *const u32) {
const BN254_SCALAR_MUL: u32 = 0x00_01_01_20;
const BN254_SCALAR_MUL: u32 = 0x00_01_01_80;
unsafe {
asm!(
"ecall",
Expand All @@ -32,7 +32,7 @@ fn syscall_bn254_scalar_mul(p: *mut u32, q: *const u32) {
}
#[inline]
fn syscall_bn254_scalar_mac(ret: *mut u32, a: *const u32, b: *const u32) {
const BN254_SCALAR_MAC: u32 = 0x00_01_01_21;
const BN254_SCALAR_MAC: u32 = 0x00_01_01_81;
unsafe {
asm!(
"ecall",
Expand Down Expand Up @@ -171,6 +171,7 @@ impl Fr {
}

pub fn add(&self, rhs: &Self) -> Fr {
println!("cycle-tracker-start: Fr::add");
let mut p = core::mem::MaybeUninit::<[u32; 8]>::uninit();

let src_ptr = self.0.as_ptr() as *const u32;
Expand All @@ -183,6 +184,7 @@ impl Fr {
}

let p = unsafe { p.assume_init() };
println!("cycle-tracker-end: Fr::add");
Fr(p)
}
}
Expand Down

0 comments on commit 1e333ed

Please sign in to comment.