File:  [MW Coherent from dump] / coherent / b / lib / libc / gen / i386 / alloca.s
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:35 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

//////////
/ libc/gen/i386/alloca.s
/ Dynamic stack allocation.
//////////

//////////
/ char *
/ alloca(int n)
/ Grab n bytes directly from the stack.
//////////

	.globl	alloca
	.text

alloca:
	popl	%edx		/ return address to EDX
	popl	%eax		/ nbytes to EAX
	negl	%eax		/ -nbytes
	andl	%eax, $-4	/ round up to dword
	movl	%ecx, %esp	/ saved register pointer to ECX
	addl	%eax, %esp	/ return pointer to EAX
	movl	%esp, %eax	/ allocate
	pushl	8(%ecx)		/ copy saved registers
	pushl	4(%ecx)
	pushl	(%ecx)
	pushl	%eax		/ restore arg
	jmp	*%edx		/ and return

/ end of alloca.s

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.