From owner-freebsd-hackers Tue Dec 10 7:58:52 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1078737B401 for ; Tue, 10 Dec 2002 07:58:51 -0800 (PST) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C81543ED1 for ; Tue, 10 Dec 2002 07:58:49 -0800 (PST) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.6/8.12.6) with ESMTP id gBAFwY3p099180; Tue, 10 Dec 2002 16:58:35 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: Chuck Tuffli Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: registers not saved From: phk@FreeBSD.ORG In-Reply-To: Your message of "Tue, 10 Dec 2002 07:46:36 PST." <20021210154635.GC605@thegrail.rose.agilent.com> Date: Tue, 10 Dec 2002 16:58:34 +0100 Message-ID: <99179.1039535914@critter.freebsd.dk> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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