From 0ee1d04863922d35535637056550aeda3fd0e7bd Mon Sep 17 00:00:00 2001 From: Lucas Ste <38472950+LucasSte@users.noreply.github.com> Date: Sat, 21 Dec 2024 11:29:28 -0300 Subject: [PATCH] [SOL] Update syscalls num (#97) --- library/std/src/sys/pal/sbf/alloc.rs | 2 +- library/std/src/sys/pal/sbf/mod.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/library/std/src/sys/pal/sbf/alloc.rs b/library/std/src/sys/pal/sbf/alloc.rs index e6ef85d99adf5..7d7c67c6e1368 100644 --- a/library/std/src/sys/pal/sbf/alloc.rs +++ b/library/std/src/sys/pal/sbf/alloc.rs @@ -41,6 +41,6 @@ extern "C" { #[cfg(target_feature = "static-syscalls")] fn sol_alloc_free_(size: u64, ptr: u64) -> *mut u8 { let syscall: extern "C" fn(u64, u64) -> *mut u8 = - unsafe { core::mem::transmute(2213547663u64) }; // murmur32 hash of "sol_alloc_free_" + unsafe { core::mem::transmute(11usize) }; // 11 is the code for "sol_alloc_free_" syscall(size, ptr) } diff --git a/library/std/src/sys/pal/sbf/mod.rs b/library/std/src/sys/pal/sbf/mod.rs index df41a5e52ac2f..9637f0401fbde 100644 --- a/library/std/src/sys/pal/sbf/mod.rs +++ b/library/std/src/sys/pal/sbf/mod.rs @@ -47,13 +47,13 @@ extern "C" { #[cfg(target_feature = "static-syscalls")] unsafe extern "C" fn abort() -> ! { - let syscall: extern "C" fn() -> ! = core::mem::transmute(3069975057u64); // murmur32 hash of "abort" + let syscall: extern "C" fn() -> ! = core::mem::transmute(1usize); // 1 is the code for "abort" syscall() } #[cfg(target_feature = "static-syscalls")] unsafe extern "C" fn sol_log_(message: *const u8, length: u64) { - let syscall: extern "C" fn(*const u8, u64) = core::mem::transmute(544561597u64); // murmur32 hash of "sol_log_" + let syscall: extern "C" fn(*const u8, u64) = core::mem::transmute(7usize); // 7 is the code for "sol_log_" syscall(message, length) } @@ -68,6 +68,8 @@ pub fn panic(info: &core::panic::PanicInfo<'_>) -> ! { #[cfg(not(target_feature = "static-syscalls"))] custom_panic(info); + // FIXME: This implementation needs a revision in tandem with + // https://github.com/anza-xyz/agave/pull/3951 #[cfg(target_feature = "static-syscalls")] sol_log(info.to_string().as_bytes());