grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Grub for ia64 - function descriptors


From: Hollis Blanchard
Subject: Re: Grub for ia64 - function descriptors
Date: Tue, 03 Oct 2006 10:09:42 -0500

On Tue, 2006-10-03 at 06:04 +0200, address@hidden wrote:
> Selon Hollis Blanchard <address@hidden>:
> 
> >
> > On Mon, 02 Oct 2006 08:31:10 +0200, address@hidden said:
> > > Quoting Hollis Blanchard <address@hidden>:
> [...]
> > > > > >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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]