mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 23:05:24 +00:00
add ___chkstk_ms compiler-rt function
This commit is contained in:
parent
09369b6a43
commit
53aa72b58a
@ -98,7 +98,7 @@ export nakedcc fn __aeabi_uidivmod() {
|
||||
@setGlobalLinkage(__aeabi_uidivmod, builtin.GlobalLinkage.Internal);
|
||||
}
|
||||
|
||||
export nakedcc fn __chkstk() {
|
||||
export nakedcc fn __chkstk() align 4 {
|
||||
@setDebugSafety(this, false);
|
||||
|
||||
if (comptime builtin.os == builtin.Os.windows) {
|
||||
@ -132,6 +132,37 @@ export nakedcc fn __chkstk() {
|
||||
@setGlobalLinkage(__chkstk, builtin.GlobalLinkage.Internal);
|
||||
}
|
||||
|
||||
export nakedcc fn ___chkstk_ms() align 4 {
|
||||
@setDebugSafety(this, false);
|
||||
|
||||
if (comptime builtin.os == builtin.Os.windows) {
|
||||
if (comptime builtin.arch == builtin.Arch.x86_64) {
|
||||
asm volatile (
|
||||
\\ push %%rcx
|
||||
\\ push %%rax
|
||||
\\ cmp $0x1000,%%rax
|
||||
\\ lea 24(%%rsp),%%rcx
|
||||
\\ jb 1f
|
||||
\\2:
|
||||
\\ sub $0x1000,%%rcx
|
||||
\\ test %%rcx,(%%rcx)
|
||||
\\ sub $0x1000,%%rax
|
||||
\\ cmp $0x1000,%%rax
|
||||
\\ ja 2b
|
||||
\\1:
|
||||
\\ sub %%rax,%%rcx
|
||||
\\ test %%rcx,(%%rcx)
|
||||
\\ pop %%rax
|
||||
\\ pop %%rcx
|
||||
\\ ret
|
||||
);
|
||||
unreachable;
|
||||
}
|
||||
}
|
||||
|
||||
@setGlobalLinkage(__chkstk, builtin.GlobalLinkage.Internal);
|
||||
}
|
||||
|
||||
export fn __udivmodsi4(a: u32, b: u32, rem: &u32) -> u32 {
|
||||
@setDebugSafety(this, is_test);
|
||||
@setGlobalLinkage(__udivmodsi4, builtin.GlobalLinkage.LinkOnce);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user