|
|
1.1 root 1: //////////
2: / libc/gen/i386/alloca.s
3: / Dynamic stack allocation.
4: //////////
5:
6: //////////
7: / char *
8: / alloca(int n)
9: / Grab n bytes directly from the stack.
10: //////////
11:
12: .globl alloca
13: .text
14:
15: alloca:
16: popl %edx / return address to EDX
17: popl %eax / nbytes to EAX
18: negl %eax / -nbytes
19: andl %eax, $-4 / round up to dword
20: movl %ecx, %esp / saved register pointer to ECX
21: addl %eax, %esp / return pointer to EAX
22: movl %esp, %eax / allocate
23: pushl 8(%ecx) / copy saved registers
24: pushl 4(%ecx)
25: pushl (%ecx)
26: pushl %eax / restore arg
27: jmp *%edx / and return
28:
29: / end of alloca.s
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.