From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 27 13:44:35 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 21D3F16A41F for ; Wed, 27 Jul 2005 13:44:35 +0000 (GMT) (envelope-from rink@stack.nl) Received: from mailhost.stack.nl (vaak.stack.nl [131.155.140.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id AE39143D49 for ; Wed, 27 Jul 2005 13:44:34 +0000 (GMT) (envelope-from rink@stack.nl) Received: from hammer.stack.nl (hammer.stack.nl [IPv6:2001:610:1108:5010::153]) by mailhost.stack.nl (Postfix) with ESMTP id A5E81A2FFC; Wed, 27 Jul 2005 15:44:32 +0200 (CEST) Received: by hammer.stack.nl (Postfix, from userid 1796) id 800F169BD; Wed, 27 Jul 2005 15:44:32 +0200 (CEST) Date: Wed, 27 Jul 2005 15:44:32 +0200 From: Rink Springer To: Ludvig Strigeus Message-ID: <20050727134432.GA10142@stack.nl> References: <4285cd45050727063146c054d4@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="huq684BweRXVnRxX" Content-Disposition: inline In-Reply-To: <4285cd45050727063146c054d4@mail.gmail.com> X-Editor: Vim http://www.vim.org/ X-Info: http://rink.nu/ X-Operating-System: FreeBSD 5.4-STABLE amd64 User-Agent: Mutt/1.5.9i Cc: hackers@freebsd.org, 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: Wed, 27 Jul 2005 13:44:35 -0000 --huq684BweRXVnRxX Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Ludvig, * Ludvig Strigeus (strigeus@gmail.com) wrote: > Hi! >=20 > I see this code: >=20 > +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 >=20 > 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). You see, in C, I call the function like this (for example): void pic16l_setled(unsigned int val); pic16l_setled (0x1234); And it gets assembled to: pushl $0x1234 call pic16l_setled But it should be assembled to: pushl $0x1234 call pic16l_setled add $4,%esp /* ditch the parameter */ I don't know why it doesn't do this :( > +ENTRY(pic16l_reboot) > + pushl $0x01 > + pushl $0x02 > + pushl $0x20 > + call pic16l_setbyte > + ret > > You're forgetting to adjust the stack here.. you should add 12 to esp > before returning. > Same thing in pic16l_poweroff. Indeed, very correct! Since there functions plainly reboot / halt, I never noticed this, but you are indeed correct. I'll fix it in a new patchset. > I've never done any FBSD dev, so i could be wrong...but it's worth a try. Thank you very much for your time! I've CC-ed this discussion to hackers@, perhaps someone knows more about this ? --=20 Rink P.W. Springer - http://rink.nu "God, root, what is difference?" - Pitr, Userfriendly --huq684BweRXVnRxX Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iD8DBQFC54/Ab3O60uztv/8RAhUJAKC+mqa+HBIpL7b1GGdU83BJ/2hlqgCgoDfm bLoynyNAnMhVLOzn6FRh2cQ= =7ilb -----END PGP SIGNATURE----- --huq684BweRXVnRxX--