On 12-Dec-2002 Matthew Dillon wrote:
>:> function A calls function B which uses ecx as a loop index. The bad part is 
>function B never
>:> saves/restores the value of ecx and function A starts dereferencing garbage.
>:> 
>:> An informal sampling of my driver seems to indicate that ebx gets
>:> pushed/poped at entry/exit but ecx and edx don't. Does any of this
>:> sound familiar? Thanks!
>:
>:Yes, eax, ebx, and edx are not "call-safe" registers.  If you are writing
>:your own function in assembly and you call a function you need to either
>:save those registers yourself or reload their values.  If you are writing
>:...
>:John Baldwin <[EMAIL PROTECTED]>  <><  http://www.FreeBSD.org/~jhb/
>:"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/
> 
>     I think you meant ecx there.  eax, ecx, and edx are not call safe.
>     ebx is.

Yep.

-- 

John Baldwin <[EMAIL PROTECTED]>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to