Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1JFPaE-0006AP-7Z for mharc-grub-devel@gnu.org; Thu, 17 Jan 2008 02:54:42 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JFPaB-0006AJ-Jg for grub-devel@gnu.org; Thu, 17 Jan 2008 02:54:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JFPa7-00069z-67 for grub-devel@gnu.org; Thu, 17 Jan 2008 02:54:39 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JFPa7-00069w-3I for grub-devel@gnu.org; Thu, 17 Jan 2008 02:54:35 -0500 Received: from c60.cesmail.net ([216.154.195.49]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1JFPa6-0007Yt-NY for grub-devel@gnu.org; Thu, 17 Jan 2008 02:54:35 -0500 Received: from unknown (HELO delta2) ([192.168.1.50]) by c60.cesmail.net with ESMTP; 17 Jan 2008 02:54:35 -0500 Received: from pool-96-227-17-250.phlapa.east.verizon.net (pool-96-227-17-250.phlapa.east.verizon.net [96.227.17.250]) by webmail.spamcop.net (Horde MIME library) with HTTP; Thu, 17 Jan 2008 02:54:33 -0500 Message-ID: <20080117025433.ez1grtxjdcc4ckgk@webmail.spamcop.net> Date: Thu, 17 Jan 2008 02:54:33 -0500 From: Pavel Roskin To: grub-devel@gnu.org References: <20080113191251.GA9050@thorin> <20080115200824.GA2881@thorin> In-Reply-To: <20080115200824.GA2881@thorin> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: help with powerpc asm (moving grub_ieee1275_entry_fn initialization to crt0.S) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2008 07:54:40 -0000 Quoting Robert Millan : > Here's an incomplete (missing powerpc & sparc) version of the patch that > would sanitize this function call. I don't see why it needs to be done across the board. Maybe you have =20 further simplifications in mind? Anyway, it's a good idea not to rely =20 on C calling conventions on any platform. Here's the patch for PowerPC. It has been tested both in qemu and on =20 real hardware. I have verified that the value of =20 grub_ieee1275_entry_fn doesn't change. By the way, please don't remove the declaration of cmain(). It may be =20 useful to prevent a gcc warning (missing declaration). cmain() is =20 really an rare case that doesn't need a declaration, since it's not =20 called by any C code, but gcc doesn't know that. ChangeLog: * kern/powerpc/ieee1275/cmain.c (cmain): Don't take any arguments. * kern/powerpc/ieee1275/crt0.S: Store r5 in grub_ieee1275_entry_fn, don't rely on cmain() doing it. diff --git a/kern/powerpc/ieee1275/cmain.c b/kern/powerpc/ieee1275/cmain.c index 5d4b0de..30dfe1c 100644 --- a/kern/powerpc/ieee1275/cmain.c +++ b/kern/powerpc/ieee1275/cmain.c @@ -114,12 +114,10 @@ grub_ieee1275_find_options (void) } } -void cmain (uint32_t r3, uint32_t r4, uint32_t r5); +void cmain (void); void -cmain (UNUSED uint32_t r3, UNUSED uint32_t r4, uint32_t r5) +cmain (void) { - grub_ieee1275_entry_fn =3D (int (*)(void *)) r5; - grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen); grub_ieee1275_find_options (); diff --git a/kern/powerpc/ieee1275/crt0.S b/kern/powerpc/ieee1275/crt0.S index f295dea..f6545fb 100644 --- a/kern/powerpc/ieee1275/crt0.S +++ b/kern/powerpc/ieee1275/crt0.S @@ -38,5 +38,9 @@ _start: 2:=09stwu=092, 4(6) /* We know r2 is already 0 from above. */ =09bdnz=092b +=09/* Store r5 in grub_ieee1275_entry_fn */ +=09lis=099, grub_ieee1275_entry_fn@ha +=09stw=095, grub_ieee1275_entry_fn@l(9) + =09bl=09cmain 1:=09b=091b --=20 Regards, Pavel Roskin