From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 28 07:59:36 2005 Return-Path: X-Original-To: hackers@freebsd.org 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 05A3E16A41F for ; Thu, 28 Jul 2005 07:59:36 +0000 (GMT) (envelope-from gemini@geminix.org) Received: from gen129.n001.c02.escapebox.net (gen129.n001.c02.escapebox.net [213.73.91.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9898543D62 for ; Thu, 28 Jul 2005 07:59:35 +0000 (GMT) (envelope-from gemini@geminix.org) Message-ID: <42E89060.3060700@geminix.org> Date: Thu, 28 Jul 2005 09:59:28 +0200 From: Uwe Doering Organization: Private UNIX Site User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.10) Gecko/20050726 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rink Springer References: <4285cd45050727063146c054d4@mail.gmail.com> <20050727134432.GA10142@stack.nl> In-Reply-To: <20050727134432.GA10142@stack.nl> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Received: from gemini by geminix.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.51 (FreeBSD)) id 1Dy3If-0002y2-Pc; Thu, 28 Jul 2005 09:59:29 +0200 Cc: hackers@freebsd.org, Ludvig Strigeus , ed@fxq.nl Subject: Re: Problem with pic16l_setled X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2005 07:59:36 -0000 Rink Springer wrote: > * Ludvig Strigeus (strigeus@gmail.com) wrote: > >>I see this code: >> >>+ENTRY(pic16l_setled) >>+ push %ebp >>+ mov %esp,%ebp >>+ >>+ movl 0x8(%ebp),%ebx >>+ orl $0x800,%ebx >>+ call pic16l_ledhlp >>+ movl $0x701,%ebx >>+ call pic16l_ledhlp >>+ >>+ leave >>+ ret >> >>With the standard x86 calling convention, you're not supposed to >>modify ebx, esi or edi without saving them first. Try adding a >>push/pop ebx around. > > I doubt this is the problem (I've looked at other .s files like > i386/i386/support.s, function ssdtosd, and they don't seem to do this). Well, at least in 'support.s' of RELENG_4 register ebx _does_ get pushed onto the stack in function 'ssdtosd'. I suppose this is true also for the other FreeBSD branches. If you call a function from the C level only registers eax, edx and ecx may be altered without preserving their original contents on the stack (or wherever else). That is, in C the calling level expects that the other registers survive a function call unharmed. As pointed out that's the standard x86 calling convention which applies to all x86 compilers, not just GCC. Uwe -- Uwe Doering | EscapeBox - Managed On-Demand UNIX Servers gemini@geminix.org | http://www.escapebox.net