fn win_probe_stack_only() void
fn win_probe_stack_only() void {
@setRuntimeSafety(false);
switch (arch) {
.thumb => {
asm volatile (
\\ lsl r4, r4, #2
\\ mov r12, sp
\\ push {r5, r6}
\\ mov r5, r4
\\1:
\\ sub r12, r12, #4096
\\ subs r5, r5, #4096
\\ ldr r6, [r12]
\\ bgt 1b
\\ pop {r5, r6}
\\ bx lr
);
},
.aarch64 => {
asm volatile (
\\ lsl x16, x15, #4
\\ mov x17, sp
\\1:
\\
\\ sub x17, x17, 4096
\\ subs x16, x16, 4096
\\ ldr xzr, [x17]
\\ b.gt 1b
\\
\\ ret
);
},
.x86_64 => {
asm volatile (
\\ pushq %%rcx
\\ pushq %%rax
\\ cmpq $0x1000,%%rax
\\ leaq 24(%%rsp),%%rcx
\\ jb 1f
\\ 2:
\\ subq $0x1000,%%rcx
\\ testq %%rcx,(%%rcx)
\\ subq $0x1000,%%rax
\\ cmpq $0x1000,%%rax
\\ ja 2b
\\ 1:
\\ subq %%rax,%%rcx
\\ testq %%rcx,(%%rcx)
\\ popq %%rax
\\ popq %%rcx
\\ retq
);
},
.x86 => {
asm volatile (
\\ push %%ecx
\\ push %%eax
\\ cmp $0x1000,%%eax
\\ lea 12(%%esp),%%ecx
\\ jb 1f
\\ 2:
\\ sub $0x1000,%%ecx
\\ test %%ecx,(%%ecx)
\\ sub $0x1000,%%eax
\\ cmp $0x1000,%%eax
\\ ja 2b
\\ 1:
\\ sub %%eax,%%ecx
\\ test %%ecx,(%%ecx)
\\ pop %%eax
\\ pop %%ecx
\\ ret
);
},
else => {},
}
unreachable;
}