Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
wine-mirror
GitHub Repository: wine-mirror/wine
Path: blob/master/libs/compiler-rt/lib/builtins/aarch64/chkstk.S
12349 views
1
// This file is dual licensed under the MIT and the University of Illinois Open
2
// Source Licenses. See LICENSE.TXT for details.
3
4
#include "../assembly.h"
5
6
// __chkstk routine
7
// This routine is windows specific.
8
// http://msdn.microsoft.com/en-us/library/ms648426.aspx
9
10
// This clobbers registers x16 and x17.
11
// Does not modify any memory or the stack pointer.
12
13
// mov x15, #256 // Number of bytes of stack, in units of 16 byte
14
// bl __chkstk
15
// sub sp, sp, x15, lsl #4
16
17
#if defined(__aarch64__) || defined(__arm64ec__)
18
19
#ifdef __arm64ec__
20
#define CHKSTK_FUNC __chkstk_arm64ec
21
#else
22
#define CHKSTK_FUNC __chkstk
23
#endif
24
25
#define PAGE_SIZE 4096
26
27
.p2align 2
28
DEFINE_COMPILERRT_FUNCTION(CHKSTK_FUNC)
29
lsl x16, x15, #4
30
mov x17, sp
31
1:
32
sub x17, x17, #PAGE_SIZE
33
subs x16, x16, #PAGE_SIZE
34
ldr xzr, [x17]
35
b.gt 1b
36
37
ret
38
END_COMPILERRT_FUNCTION(CHKSTK_FUNC)
39
40
#endif // defined(__aarch64__) || defined(__arm64ec__)
41
42