From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1GUZqz-0006eh-PM for mharc-grub-devel@gnu.org; Mon, 02 Oct 2006 22:17:53 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GUZqy-0006e3-BW for grub-devel@gnu.org; Mon, 02 Oct 2006 22:17:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GUZqx-0006dj-El for grub-devel@gnu.org; Mon, 02 Oct 2006 22:17:52 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GUZqx-0006dg-AK for grub-devel@gnu.org; Mon, 02 Oct 2006 22:17:51 -0400 Received: from [66.111.4.25] (helo=out1.smtp.messagingengine.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GUZx4-0003gb-3H for grub-devel@gnu.org; Mon, 02 Oct 2006 22:24:10 -0400 Received: from frontend3.internal (frontend3.internal [10.202.2.152]) by frontend1.messagingengine.com (Postfix) with ESMTP id B7CFFDAED86 for ; Mon, 2 Oct 2006 22:17:48 -0400 (EDT) Received: from web2.internal ([10.202.2.211]) by frontend3.internal (MEProxy); Mon, 02 Oct 2006 22:17:50 -0400 Received: by web2.internal (Postfix, from userid 99) id E1B0217CD1; Mon, 2 Oct 2006 22:17:51 -0400 (EDT) Message-Id: <1159841871.3746.272390756@webmail.messagingengine.com> X-Sasl-Enc: 3lXE9uZ5qJQk95eG3klAs785piC7MNjMYZUKnLY4BkVK 1159841871 From: "Hollis Blanchard" To: "The development of GRUB 2" Content-Disposition: inline Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="ISO-8859-1" MIME-Version: 1.0 X-Mailer: MessagingEngine.com Webmail Interface References: <1159443706.451bb4fad4e1a@imp6-g19.free.fr> <87zmck15gp.fsf@xs4all.nl> <1159451113.451bd1e94a4d9@imp1-g19.free.fr> <1159506632.21826.32.camel@diesel> <1159513142.451cc4361703a@imp1-g19.free.fr> <1159535802.5255.4.camel@diesel> <1159770670.4520b22e3cac4@imp2-g19.free.fr> In-Reply-To: <1159770670.4520b22e3cac4@imp2-g19.free.fr> Date: Mon, 02 Oct 2006 21:17:51 -0500 Subject: Re: Grub for ia64 - function descriptors 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: Tue, 03 Oct 2006 02:17:52 -0000 On Mon, 02 Oct 2006 08:31:10 +0200, tgingold@free.fr said: > Quoting Hollis Blanchard : > > > On Fri, 2006-09-29 at 08:59 +0200, tgingold@free.fr wrote: > > > Quoting Hollis Blanchard : > > > > > > > On Thu, 2006-09-28 at 15:45 +0200, tgingold@free.fr wrote: > > > > > > > > > > if (grub_strcmp (name, "grub_mod_init") == 0) > > > > > mod->init = (void (*) (grub_dl_t)) sym->st_value; > > > > > > > > > > This won't work on ia64 AFAIK. > > > > > > > > Can't this problem be solved with an architecture-specific macro? > > > > > > > > FWIW, 64-bit PowerPC also uses function descriptors. They look something > > > > like: > > > > long code_address > > > > long table_of_contents > > > > long unused > > > > > > > > The table_of_contents (TOC) value needs to be placed into r2 when > > > > jumping at code_address (and of course the old one needs to be restored > > > > when returning). > > > Indeed, same issue. > > > > > > >I assume IA64 is similar here, and given that, a > > > > module_jump function implemented in assembly by each architecture would > > > > solve this problem. > > > I'd prefer modules to export pointers. Seems to be easier to deal. > > > > I don't know what you mean; please elaborate (with pseudo-code if > > possible). > > I'd propose modules export struct grub_dl. This struct contains init and > fini > functions pointers. > Getting the address of a data structure is much more portable. > Dealing with function pointers would be a matter of the relocator. It looks like this is only done twice in the current code: mod->init and mod->fini. Wouldn't it be easy to do this: --- kern/dl.c 28 May 2006 23:01:43 -0000 1.12 +++ kern/dl.c 3 Oct 2006 02:15:51 -0000 @@ -380,9 +380,9 @@ grub_dl_resolve_symbols (grub_dl_t mod, return grub_errno; if (grub_strcmp (name, "grub_mod_init") == 0) - mod->init = (void (*) (grub_dl_t)) sym->st_value; + mod->init = grub_dl_arch_func (sym->st_value); else if (grub_strcmp (name, "grub_mod_fini") == 0) - mod->fini = (void (*) (void)) sym->st_value; + mod->fini = grub_dl_arch_func (sym->st_value); break; case STT_SECTION: -Hollis