[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rep:Re: [f-cpu] Stack handling


Guys, you're on the wrong track. You're still thinking Intel-style.

On Tue, Jul 23, 2002 at 01:39:53PM +0200, Christophe Avoinne wrote:
> If you want to invent a new OS which doesn't need a stack, well okay. But my
> oppinion is that you would need to be friendly with software programmers and
> don't complicate their jobs because you only think about the hardware part
> without any regard about the habits of programmers.
> I really understand the whys you prefer to avoid a pre-increment/decrement,
> but the fact is there are situations we need it.

Then do it manually:

	subi 8, <sp>, <sp>	// <sp> is the register used as a stack pointer
	storei -8, <sp>, ...
	store <sp>, ...		// last push doesn't use postdecrement

Alternatively, allocate a larger piece of stack memory at once and fill it
later. In either case, calling a signal handler is not a problem at all,
as long as user and kernel mode agree on the stack pointer register (which
will be defined in the user<->kernel API and/or the calling conventions).

In general, doing stack-like operations on a register machine is not a
good idea. On Intel CPUs, you're forced to do it because you have only
eight registers, but the F-CPU has 63 of them (r0 not counted). There
should rarely be a need for stack operations, except on function
entry/exit (where you can use storem/loadm).

 Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
 "All I wanna do is have a little fun before I die"
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/