source: trunk/minix/lib/i386/misc/alloca.s@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 801 bytes
Line 
1#
2! alloca() - allocate space on the stack Author: Kees J. Bot
3! 2 Dec 1993
4.sect .text; .sect .rom; .sect .data; .sect .bss
5
6.sect .text
7 .align 16
8.define _alloca
9_alloca:
10#if __ACK__
11 pop ecx ! Return address
12 pop eax ! Bytes to allocate
13 add eax, 2*4+3 ! Add space for two saved register variables
14 andb al, 0xFC ! Align
15 mov ebx, esp ! Keep current esp
16 sub esp, eax ! Lower stack
17 mov eax, esp ! Return value
18 push 4(ebx) ! Push what is probably the saved esi
19 push (ebx) ! Saved edi
20 ! Now ACK can still do:
21 ! pop edi; pop esi; leave; ret
22 push eax ! Dummy argument
23 jmp ecx
24#else
25 pop ecx ! Return address
26 pop eax ! Bytes to allocate
27 add eax, 3
28 andb al, 0xFC ! Align
29 sub esp, eax ! Lower stack
30 mov eax, esp ! Return value
31 push eax ! Dummy argument
32 jmp ecx
33#endif
Note: See TracBrowser for help on using the repository browser.