Path: utzoo!attcan!uunet!cbmvax!ditto From: ditto@cbmvax.UUCP (Michael "Ford" Ditto) Newsgroups: comp.sys.m68k Subject: Re: quad-aligning the 68020 stack Summary: Just keep it that way all the time. Keywords: 68020 stack longword alignment quad Message-ID: <4431@cbmvax.UUCP> Date: 6 Aug 88 18:29:03 GMT References: <2194@uhccux.uhcc.hawaii.edu> Reply-To: ditto@cbmvax.UUCP (Mike "Ford" Ditto) Organization: Commodore Technology, West Chester, PA Lines: 33 First of all, on a 68020 system running primarily over a 16-bit bus, it doesn't really matter. Such systems are not too uncommon these days, but they are usually upgraded 680{00,10} systems for which the software needs to be compatible with the 68000 anyway, so for these systems you might as well just put your brain in 16-bit mode. For real 32-bit 68020 systems, I am a firm believer in keeping all stacks and structures longword aligned at all times. This means the C compiler should promote all function arguments to a multiple of 32 bits and pad structures so that longword elements are at aligned offsets. Malloc() and similar functions should return longword aligned storage. Aside from the delays in accessing misaligned longword data, exception processing is an important consideration. Since the 68000 architecture requires some fairly complex (i.e. slow) exception processing, you certainly don't want it to run at half speed because the supervisor stack isn't longword aligned. This means that interrupt routines must keep the stack longword aligned so that any nested interrupts aren't slowed down, and in the case of certain real-time operating systems which run user tasks in supervisor mode, all user code should keep the stack aligned as well. If there is a lot of user software that doesn't do this, it might be worthwhile to put stack alignment code in the system entrypoints and interrupt service routines, so that the perfor- mance problems will not occur when the O.S. itself is running. -- -=] Ford [=- . . (In Real Life: Mike Ditto) . : , ford@kenobi.cts.com This space under construction, ...!ucsd!elgar!ford pardon our dust. ditto@cbmvax.commodore.com