- Timestamp:
- Mar 13, 2005, 12:14:15 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gcc/gcc/config/i386/emx-libgcc1.asm
-
Property cvs2svn:cvs-rev
changed from
1.4
to1.5
r1843 r1844 1 /* $Id$ */ 2 /** @file 3 * 4 * GCC alloca helper 5 * 6 * Copyright (c) 2005 knut st. osmundsen <bird@anduin.net> 7 * 8 * 9 * This file is part of InnoTek LIBC. 10 * 11 * InnoTek LIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * InnoTek LIBC is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * GNU Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with InnoTek LIBC; if not, write to the Free Software 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 * 25 */ 26 1 27 .text 2 28 3 29 #ifdef L_alloca 4 30 .globl __alloca … … 8 34 // CHG: EAX. ESP 9 35 __alloca: 10 pushl %ecx /* save work registers */ 11 movl %esp,%ecx /* keep a pointer to stack frame */ 36 /* 37 * Calc new %esp, store it in %eax. 38 * The returned address is 8 byte aligned. 39 */ 12 40 negl %eax 13 leal 4+4(%esp,%eax),%esp /* adjust stack pointer */ 14 leal 4+4(%ecx),%eax 41 lea (%esp, %eax), %eax 42 andl $0xfffffff8, %eax 43 44 /* 45 * Setup the prober, %ecx, to point to the top of the stack page below. 46 */ 47 pushl %ecx 48 movl %esp, %ecx 49 andl $0xfffff000, %ecx 50 subl $8, %ecx 51 /* Do we need to probe anything? */ 52 cmpl %eax, %ecx 53 jl L2 54 55 /* 56 * The probe loop 57 */ 15 58 .align 2, 0x90 16 L1: subl $0x1000,%eax /* step down */ 17 cmpl %esp,%eax 18 jb L2 19 testb %al,(%eax) /* probe stack */ 20 jmp L1 21 L2: movl 4(%ecx),%eax /* return address */ 22 movl (%ecx),%ecx /* pop ECX */ 59 L1: 60 movb $0, (%ecx) /* probe */ 61 subl $0x1000, %ecx /* next page */ 62 cmpl %eax, %ecx /* done? */ 63 jnl L1 /* jump if done */ 64 65 /* 66 * Done probing, commit the allocation and jump to the return address. 67 */ 68 L2: popl %ecx 69 xchg %esp, %eax /* commit */ 70 movl (%eax), %eax /* load return address */ 23 71 #if defined (__EPILOGUE__) 24 72 ___POST$_alloca: 25 #endif 73 #endif 26 74 jmp *%eax /* return */ 27 28 75 #endif // L_alloca 29 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.