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