Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1GUlu0-0006ms-7Z for mharc-grub-devel@gnu.org; Tue, 03 Oct 2006 11:09:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GUlty-0006kL-Jc for grub-devel@gnu.org; Tue, 03 Oct 2006 11:09:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GUltx-0006ip-L0 for grub-devel@gnu.org; Tue, 03 Oct 2006 11:09:46 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GUltx-0006iK-FU for grub-devel@gnu.org; Tue, 03 Oct 2006 11:09:45 -0400 Received: from [66.111.4.25] (helo=out1.smtp.messagingengine.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GUm0B-0002oh-Kk for grub-devel@gnu.org; Tue, 03 Oct 2006 11:16:11 -0400 Received: from frontend3.internal (frontend3.internal [10.202.2.152]) by frontend1.messagingengine.com (Postfix) with ESMTP id 14745DAF4D1 for ; Tue, 3 Oct 2006 11:09:44 -0400 (EDT) Received: from heartbeat1.internal ([10.202.2.160]) by frontend3.internal (MEProxy); Tue, 03 Oct 2006 11:09:46 -0400 X-Sasl-enc: 5R15wEyOr3AIk6G0F2hM85s5OZ2dORi1tRN1zkOehmFg 1159888186 Received: from basalt.austin.ibm.com (pixpat.austin.ibm.com [192.35.232.241]) by mail.messagingengine.com (Postfix) with ESMTP id 48E3F11605 for ; Tue, 3 Oct 2006 11:09:46 -0400 (EDT) From: Hollis Blanchard To: The development of GRUB 2 In-Reply-To: <1159848299.4521e16b8c68d@imp3-g19.free.fr> 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> <1159841871.3746.272390756@webmail.messagingengine.com> <1159848299.4521e16b8c68d@imp3-g19.free.fr> Content-Type: text/plain Date: Tue, 03 Oct 2006 10:09:42 -0500 Message-Id: <1159888182.28737.11.camel@basalt.austin.ibm.com> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 (2.6.3-1.fc5.5) Content-Transfer-Encoding: 7bit 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 15:09:46 -0000 On Tue, 2006-10-03 at 06:04 +0200, tgingold@free.fr wrote: > Selon Hollis Blanchard : > > > > > On Mon, 02 Oct 2006 08:31:10 +0200, tgingold@free.fr said: > > > Quoting Hollis Blanchard : > [...] > > > > > >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: > To create descriptor, grub_dl_arch_func have to grub_malloc memory. How to free > it ? What about this: grub_dl_arch_func(&mod->init, sym->st_value); > I always prefer to use static memory when I can do that: code is smaller and > safer. That's the reason why I'd prefer to have struct grub_dl declared static. > Of course this is just my opinion. Sure, and I'm not really opposed to exporting a struct grub_dl from modules; I'm just trying to make sure we don't overcomplicate what could be a simple change. Do you have a patch illustrating your idea? -Hollis