Re: [Linux-ia64] Newbie questions

From: Stephane Eranian <eranian_at_frankl.hpl.hp.com>
Date: 2002-11-09 06:07:12
On Fri, Nov 08, 2002 at 07:01:10PM +0000, Matthew Wilcox wrote:
> On Sat, Nov 09, 2002 at 12:21:40AM +0530, CH Gowri Kumar wrote:
> > I wrote the above program and compiled it and found the appropriate codes
> > for the instructions using objdump -d and wrote the following program
> > 
> > char sc[] ="\x0a"
> >            "\x10"
> >            "\x00"
> >            "\x18\x00\x21\x00\x92\x00\x00\x42\xe0\x11\x00\x20\x84\x0a";
> >        main()
> >        {
> >          void (*fp)(void);
> >          fp = (void*)sc;
> >          fp();
> >       }
> > 
> > But this program on execution gives me the error:
> > "Illegal instruction (core dumped)"
> > (A similar program for IA-32 worked well.)
> 
> function pointers on ia64 are "fat" -- that is, they are not the address
> of the function, they are the address of a function descriptor which
> contains (iirc) the GP and the address of the function.  i believe glibc
> pokes around with this kind of thing, so you may wish to look at the
> ia64 assembly code in there to see how it does it.
> 

to be more precise a function descriptors is:
	struct {
		unsigned long func_addr;
		unsigned long gp;
	};

You should also take a look at the calling convention documentation
at:
	http://developer.intel.com/design/itanium
-- 
-Stephane
Received on Fri Nov 08 11:08:45 2002

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:10 EST