From owner-freebsd-hackers Thu Dec 12 8:27:10 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 730EB37B401 for ; Thu, 12 Dec 2002 08:27:09 -0800 (PST) Received: from mail.speakeasy.net (mail13.speakeasy.net [216.254.0.213]) by mx1.FreeBSD.org (Postfix) with ESMTP id D756C43EA9 for ; Thu, 12 Dec 2002 08:27:06 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 13922 invoked from network); 12 Dec 2002 16:27:07 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail13.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 12 Dec 2002 16:27:07 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.6/8.12.6) with ESMTP id gBCGR1uH069874; Thu, 12 Dec 2002 11:27:01 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200212120259.gBC2x97R092440@apollo.backplane.com> Date: Thu, 12 Dec 2002 11:27:03 -0500 (EST) From: John Baldwin To: Matthew Dillon Subject: Re: RE: registers not saved Cc: freebsd-hackers@FreeBSD.ORG, Chuck Tuffli 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 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 <>< 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 <>< 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