]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/BaseCryptLib/SysCall/Ia32/Alloca.S
Fix PCD token value conflict issue.
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / SysCall / Ia32 / Alloca.S
1 #------------------------------------------------------------------------------
2 #
3 # Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
4 # This program and the accompanying materials
5 # are licensed and made available under the terms and conditions of the BSD License
6 # which accompanies this distribution. The full text of the license may be found at
7 # http://opensource.org/licenses/bsd-license.php.
8 #
9 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 #
12 # Module Name:
13 #
14 # Alloca.S
15 #
16 # Abstract:
17 #
18 # Implementation for allocation of automatically reclaimed memory, which is
19 # used to allocate space off the runtime stack.
20 # (NOTE: There is a assumption in this code that the page size equal to 4K)
21 #
22 #------------------------------------------------------------------------------
23
24
25 .686:
26 .code:
27
28 ASM_GLOBAL ASM_PFX(_alloca)
29
30 #------------------------------------------------------------------------------
31 #
32 # void __cdecl _alloca (unsigned size)
33 #
34 #------------------------------------------------------------------------------
35 ASM_PFX(_alloca):
36
37 pushl %ecx
38 cmpl $0x1000, %eax
39 leal 8(%esp), %ecx
40 jb LastPage
41
42 ProbePages:
43 subl $0x1000, %ecx
44 subl $0x1000, %eax
45 testl %eax, 0(%ecx)
46 cmpl $0x1000, %eax
47 jae ProbePages
48
49 LastPage:
50 subl %eax, %ecx
51 movl %esp, %eax
52 testl %eax, 0(%ecx)
53
54 movl %ecx, %esp
55 movl 0(%eax), %ecx
56 movl 4(%eax), %eax
57 pushl %eax
58
59 ret