mirror of
https://github.com/ziglang/zig.git
synced 2025-12-16 11:13:08 +00:00
only export __chkstk for windows
it's a windows only function anyway
This commit is contained in:
parent
e93ece7514
commit
06b64d82bf
@ -101,30 +101,32 @@ export nakedcc fn __aeabi_uidivmod() {
|
|||||||
export nakedcc fn __chkstk() {
|
export nakedcc fn __chkstk() {
|
||||||
@setDebugSafety(this, false);
|
@setDebugSafety(this, false);
|
||||||
|
|
||||||
if (comptime builtin.arch == builtin.Arch.x86_64) {
|
if (comptime builtin.os == builtin.Os.windows) {
|
||||||
asm volatile (
|
if (comptime builtin.arch == builtin.Arch.x86_64) {
|
||||||
\\ push %%rcx
|
asm volatile (
|
||||||
\\ cmp $0x1000,%%rax
|
\\ push %%rcx
|
||||||
\\ lea 16(%%rsp),%%rcx // rsp before calling this routine -> rcx
|
\\ cmp $0x1000,%%rax
|
||||||
\\ jb 1f
|
\\ lea 16(%%rsp),%%rcx // rsp before calling this routine -> rcx
|
||||||
\\ 2:
|
\\ jb 1f
|
||||||
\\ sub $0x1000,%%rcx
|
\\ 2:
|
||||||
\\ test %%rcx,(%%rcx)
|
\\ sub $0x1000,%%rcx
|
||||||
\\ sub $0x1000,%%rax
|
\\ test %%rcx,(%%rcx)
|
||||||
\\ cmp $0x1000,%%rax
|
\\ sub $0x1000,%%rax
|
||||||
\\ ja 2b
|
\\ cmp $0x1000,%%rax
|
||||||
\\ 1:
|
\\ ja 2b
|
||||||
\\ sub %%rax,%%rcx
|
\\ 1:
|
||||||
\\ test %%rcx,(%%rcx)
|
\\ sub %%rax,%%rcx
|
||||||
\\
|
\\ test %%rcx,(%%rcx)
|
||||||
\\ lea 8(%%rsp),%%rax // load pointer to the return address into rax
|
\\
|
||||||
\\ mov %%rcx,%%rsp // install the new top of stack pointer into rsp
|
\\ lea 8(%%rsp),%%rax // load pointer to the return address into rax
|
||||||
\\ mov -8(%%rax),%%rcx // restore rcx
|
\\ mov %%rcx,%%rsp // install the new top of stack pointer into rsp
|
||||||
\\ push (%%rax) // push return address onto the stack
|
\\ mov -8(%%rax),%%rcx // restore rcx
|
||||||
\\ sub %%rsp,%%rax // restore the original value in rax
|
\\ push (%%rax) // push return address onto the stack
|
||||||
\\ ret
|
\\ sub %%rsp,%%rax // restore the original value in rax
|
||||||
);
|
\\ ret
|
||||||
unreachable;
|
);
|
||||||
|
unreachable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@setGlobalLinkage(__chkstk, builtin.GlobalLinkage.Internal);
|
@setGlobalLinkage(__chkstk, builtin.GlobalLinkage.Internal);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user