Path: utzoo!attcan!uunet!husc6!think!ames!ucsd!ucsdhub!jack!elgar!ford
From: ford@elgar.UUCP (Mike "Ford" Ditto)
Newsgroups: comp.sys.att
Subject: Re: diffs to get gcc-1.22 running on unix pc
Summary: Better version of alloca
Message-ID: <195@elgar.UUCP>
Date: 22 Jun 88 17:41:23 GMT
References: <737@naucse.UUCP> <31200025@urbsdc> <743@naucse.UUCP>
Reply-To: ford@kenobi.cts.com (Mike "Ford" Ditto)
Organization: Omnicron Data Systems,  Bonita, CA
Lines: 29

In article <743@naucse.UUCP> rrr@naucse.UUCP (Bob Rose ) writes:
>alloca:
> [ ... ]
>	tst.b	P%1(%sp)	# stack probe to allocate pages

That is the alloca from emacs, which has some extra code to handle
some peculiarities of various 68000 systems.  Here is my version,
optimized for the Unix PC:

	global	alloca
alloca:
	mov.l	(%sp)+,%a0	# pop return addr
	mov.l	(%sp),%d0	# get size argument
	and.l	&-4,%d0		# round size down to long word
	sub.l	%d0,%sp		# allocate by moving stack pointer
	mov.l	%sp,%d0		# return pointer in d0
	lea	-4(%sp),%sp	# allow caller to pop the arg
	jmp	(%a0)		# return

It tries to keep things longword aligned, even though the 68010 only
needs word alignment, but it's good for 68020's that way.


					-=] Ford [=-

"Once there were parking lots,		(In Real Life:  Mike Ditto)
now it's a peaceful oasis.		ford@kenobi.cts.com
This was a Pizza Hut,			...!sdcsvax!crash!kenobi!ford
now it's all covered with daisies." -- Talking Heads