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

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



And if you are not convienced, just imagine the SIG_BUS case :

You want to execute a signal handler which displays your message using
'printf'.

But the trouble is that if you want use a different stack register, 'printf'
still uses those of user process, so you are still stuck. So you need to
compile as many functions as you have different stacks. Sorry to say, but it
is stupid to duplicate code because of a different stack register.
Personnally, if things were easy with different stack register, there would
be a long time people would use them instead of an signle stack register.

I tell you, your stack design is bad or incomplete, should I say at least.
Post-increment/decrement is a no use without pre-decrement/increment.

Hummm... i think we can remove one instruction.

// pushing r1..r5
store -8,r62,r1
store -8,r62,r2
store -8,r62,r3
store -8,r62,r4
store -8,r62,r5
...
addi +8,r62,r62 // we still need to adjust the stack pointer
load +8,r62,r1
load +8,r62,r2
load +8,r62,r3
load +8,r62,r4
load +0,r62,r5 // but we don't need to advance stack pointer !

But stack crashing still remains possible.



*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/