From: "Hollis Blanchard" <hollis@penguinppc.org>
To: "The development of GRUB 2" <grub-devel@gnu.org>
Subject: Re: Grub for ia64 - function descriptors
Date: Mon, 02 Oct 2006 21:17:51 -0500 [thread overview]
Message-ID: <1159841871.3746.272390756@webmail.messagingengine.com> (raw)
In-Reply-To: <1159770670.4520b22e3cac4@imp2-g19.free.fr>
On Mon, 02 Oct 2006 08:31:10 +0200, tgingold@free.fr said:
> Quoting Hollis Blanchard <hollis@penguinppc.org>:
>
> > On Fri, 2006-09-29 at 08:59 +0200, tgingold@free.fr wrote:
> > > Quoting Hollis Blanchard <hollis@penguinppc.org>:
> > >
> > > > 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
next prev parent reply other threads:[~2006-10-03 2:17 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-28 11:41 Grub for ia64 tgingold
2006-09-28 13:06 ` bibo,mao
2006-09-28 13:12 ` tgingold
2006-09-28 13:33 ` Marco Gerards
2006-09-28 13:45 ` tgingold
2006-09-28 14:29 ` Marco Gerards
2006-09-28 14:49 ` tgingold
2006-09-29 5:10 ` Grub for ia64 - function descriptors Hollis Blanchard
2006-09-29 6:59 ` tgingold
2006-09-29 13:16 ` Hollis Blanchard
2006-10-02 6:31 ` tgingold
2006-10-03 2:17 ` Hollis Blanchard [this message]
2006-10-03 4:04 ` tgingold
2006-10-03 15:09 ` Hollis Blanchard
2006-09-28 13:47 ` Grub for ia64 Johan Rydberg
2006-09-28 13:35 ` tgingold
2006-09-28 14:15 ` Johan Rydberg
2006-09-28 13:38 ` Marco Gerards
2006-10-10 18:15 ` Johan Rydberg
2006-10-10 22:03 ` Jeff Bailey
2006-10-11 11:19 ` Johan Rydberg
2006-10-11 10:50 ` Tristan Gingold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1159841871.3746.272390756@webmail.messagingengine.com \
--to=hollis@penguinppc.org \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.