]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/builtins/aarch64/chkstk.S
Fix a memory leak in if_delgroups() introduced in r334118.
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / builtins / aarch64 / chkstk.S
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-exception
4
5 #include "../assembly.h"
6
7 // __chkstk routine
8 // This routine is windows specific.
9 // http://msdn.microsoft.com/en-us/library/ms648426.aspx
10
11 // This clobbers registers x16 and x17.
12 // Does not modify any memory or the stack pointer.
13
14 //      mov     x15, #256 // Number of bytes of stack, in units of 16 byte
15 //      bl      __chkstk
16 //      sub     sp, sp, x15, lsl #4
17
18 #ifdef __aarch64__
19
20 #define PAGE_SIZE 4096
21
22         .p2align 2
23 DEFINE_COMPILERRT_FUNCTION(__chkstk)
24         lsl    x16, x15, #4
25         mov    x17, sp
26 1:
27         sub    x17, x17, #PAGE_SIZE
28         subs   x16, x16, #PAGE_SIZE
29         ldr    xzr, [x17]
30         b.gt   1b
31
32         ret
33 END_COMPILERRT_FUNCTION(__chkstk)
34
35 #endif // __aarch64__