brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1009 B · ad7953a Raw
41 lines · plain
1// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.2// See https://llvm.org/LICENSE.txt for license information.3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception4 5#include "../assembly.h"6 7// _chkstk routine8// This routine is windows specific9// http://msdn.microsoft.com/en-us/library/ms648426.aspx10 11// Notes from r22751912// MSVC x64s __chkstk and cygmings ___chkstk_ms do not adjust %rsp13// themselves. It also does not clobber %rax so we can reuse it when14// adjusting %rsp.15 16#ifdef __x86_64__17 18.text19.balign 420DEFINE_COMPILERRT_FUNCTION(___chkstk_ms)21        push   %rcx22        push   %rax23        cmp    $0x1000,%rax24        lea    24(%rsp),%rcx25        jb     1f262:27        sub    $0x1000,%rcx28        test   %rcx,(%rcx)29        sub    $0x1000,%rax30        cmp    $0x1000,%rax31        ja     2b321:33        sub    %rax,%rcx34        test   %rcx,(%rcx)35        pop    %rax36        pop    %rcx37        ret38END_COMPILERRT_FUNCTION(___chkstk_ms)39 40#endif // __x86_64__41