Skip to content

Commit a61823f

Browse files
authored
Merge pull request rust-lang#544 from nicholasbishop/bishop-aarch64-chkstk
2 parents 03c759c + 9406c0d commit a61823f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/aarch64.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#![allow(unused_imports)]
2+
3+
use core::intrinsics;
4+
5+
intrinsics! {
6+
#[naked]
7+
#[cfg(all(target_os = "uefi", not(feature = "no-asm")))]
8+
pub unsafe extern "C" fn __chkstk() {
9+
core::arch::asm!(
10+
".p2align 2",
11+
"lsl x16, x15, #4",
12+
"mov x17, sp",
13+
"1:",
14+
"sub x17, x17, 4096",
15+
"subs x16, x16, 4096",
16+
"ldr xzr, [x17]",
17+
"b.gt 1b",
18+
"ret",
19+
options(noreturn)
20+
);
21+
}
22+
}

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ pub mod mem;
5858
#[cfg(target_arch = "arm")]
5959
pub mod arm;
6060

61+
#[cfg(target_arch = "aarch64")]
62+
pub mod aarch64;
63+
6164
#[cfg(all(target_arch = "aarch64", target_os = "linux", not(feature = "no-asm"),))]
6265
pub mod aarch64_linux;
6366

0 commit comments

Comments
 (0)