This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Getting information on symbols and linkages at run-time


On Mon, 30 Jun 2003, Dr William Bland wrote:
> A more pressing problem for me is calling arbitrary kernel functions.  I
> plan to do this with some assembler glue that loops through a list of
> user-supplied arguments and, depending on the linkage of the C function
> being called, either pushes the arguments onto the stack or loads them
> into registers.

Are you using libffi?  This sort of glue has been written before and
allows you to call arbitrary functions from an interpreter somewhat
portably (it hasn't yet been ported to as many machines as the Linux
kernel).

> 3) I loop through the supplied argument list and do what?  Push each arg?
>    Load it into a register?

This depends mostly on the platform ABI.  Libffi can help with that,
though you still need a mechanism to determine the number and types of
function arguments.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]