Date: Thu, 28 Jul 2005 09:59:28 +0200 From: Uwe Doering <gemini@geminix.org> To: Rink Springer <rink@stack.nl> Cc: hackers@freebsd.org, Ludvig Strigeus <strigeus@gmail.com>, ed@fxq.nl Subject: Re: Problem with pic16l_setled Message-ID: <42E89060.3060700@geminix.org> In-Reply-To: <20050727134432.GA10142@stack.nl> References: <4285cd45050727063146c054d4@mail.gmail.com> <20050727134432.GA10142@stack.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42E89060.3060700>