|
52 | 52 | // Our goal here is to touch each page between %rsp+8 and %rsp+8-%rax, |
53 | 53 | // ensuring that if any pages are unmapped we'll make a page fault. |
54 | 54 | // |
| 55 | +// This function is unsafe because it uses a custom ABI, it does not actually match `extern "C"`. |
| 56 | +// |
55 | 57 | // The ABI here is that the stack frame size is located in `%rax`. Upon |
56 | 58 | // return we're not supposed to modify `%rsp` or `%rax`. |
57 | 59 | #[cfg(target_arch = "x86_64")] |
58 | 60 | #[unsafe(naked)] |
59 | | -#[no_mangle] |
| 61 | +#[rustc_std_internal_symbol] |
60 | 62 | pub unsafe extern "C" fn __rust_probestack() { |
61 | 63 | #[cfg(not(all(target_env = "sgx", target_vendor = "fortanix")))] |
62 | 64 | macro_rules! ret { |
@@ -141,9 +143,11 @@ pub unsafe extern "C" fn __rust_probestack() { |
141 | 143 | // that on Unix we're expected to restore everything as it was, this |
142 | 144 | // function basically can't tamper with anything. |
143 | 145 | // |
| 146 | +// This function is unsafe because it uses a custom ABI, it does not actually match `extern "C"`. |
| 147 | +// |
144 | 148 | // The ABI here is the same as x86_64, except everything is 32-bits large. |
145 | 149 | #[unsafe(naked)] |
146 | | -#[no_mangle] |
| 150 | +#[rustc_std_internal_symbol] |
147 | 151 | pub unsafe extern "C" fn __rust_probestack() { |
148 | 152 | core::arch::naked_asm!( |
149 | 153 | " |
@@ -186,14 +190,16 @@ pub unsafe extern "C" fn __rust_probestack() { |
186 | 190 | // probestack function will also do things like _chkstk in MSVC. |
187 | 191 | // So we need to sub %ax %sp in probestack when arch is x86. |
188 | 192 | // |
| 193 | +// This function is unsafe because it uses a custom ABI, it does not actually match `extern "C"`. |
| 194 | +// |
189 | 195 | // REF: Rust commit(74e80468347) |
190 | 196 | // rust\src\llvm-project\llvm\lib\Target\X86\X86FrameLowering.cpp: 805 |
191 | 197 | // Comments in LLVM: |
192 | 198 | // MSVC x32's _chkstk and cygwin/mingw's _alloca adjust %esp themselves. |
193 | 199 | // MSVC x64's __chkstk and cygwin/mingw's ___chkstk_ms do not adjust %rsp |
194 | 200 | // themselves. |
195 | 201 | #[unsafe(naked)] |
196 | | -#[no_mangle] |
| 202 | +#[rustc_std_internal_symbol] |
197 | 203 | pub unsafe extern "C" fn __rust_probestack() { |
198 | 204 | core::arch::naked_asm!( |
199 | 205 | " |
|
0 commit comments