6 releases

0.1.5 Apr 13, 2023
0.1.4 Apr 7, 2023
0.1.2 Feb 3, 2023
0.1.1 Jan 27, 2023
0.1.0 Aug 12, 2022

#207 in Embedded development

Download history 257/week @ 2024-01-02 120/week @ 2024-01-09 119/week @ 2024-01-16 103/week @ 2024-01-23 150/week @ 2024-01-30 274/week @ 2024-02-06 162/week @ 2024-02-13 136/week @ 2024-02-20 210/week @ 2024-02-27 184/week @ 2024-03-05 221/week @ 2024-03-12 202/week @ 2024-03-19 96/week @ 2024-03-26 308/week @ 2024-04-02 340/week @ 2024-04-09 52/week @ 2024-04-16

817 downloads per month
Used in sjlj

MIT/Apache

12KB
221 lines

#[naked]

Crates.io

Documentation

This crate provide a proc macro version of the #[naked] attribute which can be used on stable Rust.

Example

// The SYSV64 calling convention used on x86_64 Linux passes the first
// 2 integer arguments in EDI/ESI.
#[naked_function::naked]
pub unsafe extern "C" fn add(a: i32, b: i32) -> i32 {
    asm!(
        "lea eax, [edi + esi]",
        "ret",
    );
}

#[test]
fn main() {
    let ret = unsafe { add(1, 2) };
    assert_eq!(ret, 3);
}

License

Licensed under either of:

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~320–770KB
~18K SLoC