Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

win_probe_stack_adjust_sp

stack_probe.win_probe_stack_adjust_sp
fn win_probe_stack_adjust_sp() void

File

lib/compiler_rt/stack_probe.zig:174

Code

fn win_probe_stack_adjust_sp() void {
    @setRuntimeSafety(false);

    switch (arch) {
        .x86_64 => {
            asm volatile (
                \\         pushq  %%rcx
                \\         cmpq   $0x1000,%%rax
                \\         leaq   16(%%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)
                \\
                \\         leaq   8(%%rsp),%%rax
                \\         movq   %%rcx,%%rsp
                \\         movq   -8(%%rax),%%rcx
                \\         pushq  (%%rax)
                \\         subq   %%rsp,%%rax
                \\         retq
            );
        },
        .x86 => {
            asm volatile (
                \\         push   %%ecx
                \\         cmp    $0x1000,%%eax
                \\         lea    8(%%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)
                \\
                \\         lea    4(%%esp),%%eax
                \\         mov    %%ecx,%%esp
                \\         mov    -4(%%eax),%%ecx
                \\         push   (%%eax)
                \\         sub    %%esp,%%eax
                \\         ret
            );
        },
        else => {},
    }

    unreachable;
}