Matt Dillon wrote:
> :As long as gcc uses %ebp to address local variables and functoin parameters
> :rather than %esp you should be fine. %esp will be preserved, but if %esp is
> :for some odd reason used to address a variable during the C code, you are hosed.
> I strongly recommend against making assumptions about GCC's use of %ebp vs
> %esp... not if you want the __asm code to survive the GCC optimizer!
> :Just use foo = save_intr(); disable_intr(); .. restore_intr() for now. If you
> :want to save the 2 instructions so badly, then you should probably be writing
> :the whole chunk in assembly. Getting it correct first and optimizing later is
> :more sane than getting correctness and optimization at the same time and not
> :knowing which one your bugs are coming from.
> :John Baldwin <[EMAIL PROTECTED]> -- http://www.FreeBSD.org/~jhb/
> Yah, gotta agree there. The only thing that matters, Julian, are memory
> accesses. The number of instructions you use is irrelevant.
foo = save_intr(); disable_intr(); .. restore_intr()
has 4 extra memory accesses.
pushf (the only way to save interrupt state) save to stack.
save_intr() reads it back off the stack
(ok a cache hit I suppose)
and writes it to a memory location specied as an argument.
(Not a cache hit..)(though maybe defered)
After some processing,
restore_intr() then reads it from the nominated address
(probably a cache hit)
and puts it on the stack.
(not a cache hit). (though maybe defered)
it is then read off the stack by popf
(a cache hit).
Since all I WANT to do is
popf (chache hit)
I am annoyed by the fact that I have all those extra bus cycles going on.
I can live with it for development but it still annoys me.
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-current" in the body of the message
__--_|\ Julian Elischer
/ \ [EMAIL PROTECTED]
( OZ ) World tour 2000
---> X_.---._/ presently in: Budapest
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message