reactos/sdk/lib/crt/except/amd64/chkstk_ms.s
Timo Kreuzer 701b0a3f24
[MSVCRTEX] Only include _CrtDbgReport*, if we don't already export them (#6797)
* [MSVCRTEX] Only include _CrtDbgReport*, if we don't already export them

For some reason clang builds now want the ___chkstk_ms on x64 as well, so add it.
2024-04-27 14:59:06 +03:00

55 lines
1.3 KiB
ArmAsm

/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* PURPOSE: Implementation of _chkstk and _alloca_probe
* PROGRAMMERS Richard Henderson <rth@redhat.com>
* Kai Tietz <kai.tietz@onevision.com>
* Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <asm.inc>
#define PAGE_SIZE 4096
/* CODE **********************************************************************/
.code64
PUBLIC __chkstk
PUBLIC ___chkstk_ms
PUBLIC __alloca_probe
__alloca_probe:
___chkstk_ms:
.PROC __chkstk
push rcx /* save temps */
.pushreg rcx
push rax
.pushreg rax
.endprolog
cmp rax, PAGE_SIZE /* > 4k ?*/
lea rcx, [rsp + 24] /* point past return addr */
jb l_LessThanAPage
l_MoreThanAPage:
sub rcx, PAGE_SIZE /* yes, move pointer down 4k */
or byte ptr [rcx], 0 /* probe there */
sub rax, PAGE_SIZE /* decrement count */
cmp rax, PAGE_SIZE
ja l_MoreThanAPage /* and do it again */
l_LessThanAPage:
sub rcx, rax
or byte ptr [rcx], 0 /* less than 4k, just peek here */
pop rax
pop rcx
ret
.ENDP
END
/* EOF */