Skip to content

Commit

Permalink
Update syscalls num
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasSte committed Dec 20, 2024
1 parent 548684c commit d2dddfe
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);

// TODO: This implementation needs a revision in tandem with

Check failure on line 71 in library/std/src/sys/pal/sbf/mod.rs

View workflow job for this annotation

GitHub Actions / mingw-check-tidy

TODO is used for tasks that should be done before merging a PR; If you want to leave a message in the codebase use FIXME
// 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 d2dddfe

Please sign in to comment.