Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Dec 2002 18:59:09 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        John Baldwin <jhb@FreeBSD.ORG>
Cc:        Chuck Tuffli <chuck_tuffli@agilent.com>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: RE: registers not saved
Message-ID:  <200212120259.gBC2x97R092440@apollo.backplane.com>
References:   <XFMail.20021210145733.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
:> 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.

					-Matt


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?200212120259.gBC2x97R092440>