Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Dec 2002 16:58:34 +0100
From:      phk@FreeBSD.ORG
To:        Chuck Tuffli <chuck_tuffli@agilent.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: registers not saved 
Message-ID:  <99179.1039535914@critter.freebsd.dk>
In-Reply-To: Your message of "Tue, 10 Dec 2002 07:46:36 PST." <20021210154635.GC605@thegrail.rose.agilent.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20021210154635.GC605@thegrail.rose.agilent.com>, Chuck Tuffli write
s:
>I've been chasing down some weird panics in my CAM driver and have
>noticed that functions don't seem to save all register values before
>they modify them.
>
>For example, function A uses register ecx to hold the value of a pointer. Part way through, 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!

There are strict rules for which registers should be saved and which not.

You can modify these rules somewhat using weird compiler options, but
it should be consistent for all the code generated with the same
settings.

Which FreeBSD version (uname -a) and which compiler version (cc -v)
is this ?

Poul-Henning


-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

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?99179.1039535914>