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

#408 in Embedded development

Download history 406/week @ 2024-11-15 239/week @ 2024-11-22 386/week @ 2024-11-29 471/week @ 2024-12-06 200/week @ 2024-12-13 407/week @ 2024-12-20 241/week @ 2024-12-27 257/week @ 2025-01-03 749/week @ 2025-01-10 686/week @ 2025-01-17 1135/week @ 2025-01-24 987/week @ 2025-01-31 1226/week @ 2025-02-07 830/week @ 2025-02-14 1155/week @ 2025-02-21 1057/week @ 2025-02-28

4,488 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

~205–640KB
~15K SLoC