Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Dec 2002 11:27:03 -0500 (EST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Matthew Dillon <dillon@apollo.backplane.com>
Cc:        freebsd-hackers@FreeBSD.ORG, Chuck Tuffli <chuck_tuffli@agilent.com>
Subject:   Re: RE: registers not saved
Message-ID:  <XFMail.20021212112703.jhb@FreeBSD.org>
In-Reply-To: <200212120259.gBC2x97R092440@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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 <jhb@FreeBSD.org>  <><  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 <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20021212112703.jhb>