From owner-freebsd-hackers Wed Dec 11 18:59:12 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 6060D37B401; Wed, 11 Dec 2002 18:59:11 -0800 (PST) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id D8DF443EDC; Wed, 11 Dec 2002 18:59:10 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.12.5/8.12.5) with ESMTP id gBC2xAOM092441; Wed, 11 Dec 2002 18:59:10 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.5/8.12.5/Submit) id gBC2x97R092440; Wed, 11 Dec 2002 18:59:09 -0800 (PST) (envelope-from dillon) Date: Wed, 11 Dec 2002 18:59:09 -0800 (PST) From: Matthew Dillon Message-Id: <200212120259.gBC2x97R092440@apollo.backplane.com> To: John Baldwin Cc: Chuck Tuffli , freebsd-hackers@FreeBSD.ORG Subject: Re: RE: registers not saved References: 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 :> 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. -Matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message