Skip to content

Commit

Permalink
[SOL] Update syscalls num (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasSte authored Dec 21, 2024
1 parent 548684c commit 0ee1d04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion library/std/src/sys/pal/sbf/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
6 changes: 4 additions & 2 deletions library/std/src/sys/pal/sbf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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());

Expand Down

0 comments on commit 0ee1d04

Please sign in to comment.