| ... | @@ -98,7 +98,7 @@ export nakedcc fn __aeabi_uidivmod() { | ... | @@ -98,7 +98,7 @@ export nakedcc fn __aeabi_uidivmod() { |
| 98 | @setGlobalLinkage(__aeabi_uidivmod, builtin.GlobalLinkage.Internal); | 98 | @setGlobalLinkage(__aeabi_uidivmod, builtin.GlobalLinkage.Internal); |
| 99 | } | 99 | } |
| 100 | | 100 | |
| 101 | export nakedcc fn __chkstk() { | 101 | export nakedcc fn __chkstk() align 4 { |
| 102 | @setDebugSafety(this, false); | 102 | @setDebugSafety(this, false); |
| 103 | | 103 | |
| 104 | if (comptime builtin.os == builtin.Os.windows) { | 104 | if (comptime builtin.os == builtin.Os.windows) { |
| ... | @@ -132,6 +132,37 @@ export nakedcc fn __chkstk() { | ... | @@ -132,6 +132,37 @@ export nakedcc fn __chkstk() { |
| 132 | @setGlobalLinkage(__chkstk, builtin.GlobalLinkage.Internal); | 132 | @setGlobalLinkage(__chkstk, builtin.GlobalLinkage.Internal); |
| 133 | } | 133 | } |
| 134 | | 134 | |
| | 135 | export nakedcc fn ___chkstk_ms() align 4 { |
| | 136 | @setDebugSafety(this, false); |
| | 137 | |
| | 138 | if (comptime builtin.os == builtin.Os.windows) { |
| | 139 | if (comptime builtin.arch == builtin.Arch.x86_64) { |
| | 140 | asm volatile ( |
| | 141 | \\ push %%rcx |
| | 142 | \\ push %%rax |
| | 143 | \\ cmp $0x1000,%%rax |
| | 144 | \\ lea 24(%%rsp),%%rcx |
| | 145 | \\ jb 1f |
| | 146 | \\2: |
| | 147 | \\ sub $0x1000,%%rcx |
| | 148 | \\ test %%rcx,(%%rcx) |
| | 149 | \\ sub $0x1000,%%rax |
| | 150 | \\ cmp $0x1000,%%rax |
| | 151 | \\ ja 2b |
| | 152 | \\1: |
| | 153 | \\ sub %%rax,%%rcx |
| | 154 | \\ test %%rcx,(%%rcx) |
| | 155 | \\ pop %%rax |
| | 156 | \\ pop %%rcx |
| | 157 | \\ ret |
| | 158 | ); |
| | 159 | unreachable; |
| | 160 | } |
| | 161 | } |
| | 162 | |
| | 163 | @setGlobalLinkage(__chkstk, builtin.GlobalLinkage.Internal); |
| | 164 | } |
| | 165 | |
| 135 | export fn __udivmodsi4(a: u32, b: u32, rem: &u32) -> u32 { | 166 | export fn __udivmodsi4(a: u32, b: u32, rem: &u32) -> u32 { |
| 136 | @setDebugSafety(this, is_test); | 167 | @setDebugSafety(this, is_test); |
| 137 | @setGlobalLinkage(__udivmodsi4, builtin.GlobalLinkage.LinkOnce); | 168 | @setGlobalLinkage(__udivmodsi4, builtin.GlobalLinkage.LinkOnce); |