From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephane Eranian Date: Fri, 08 Nov 2002 19:07:12 +0000 Subject: Re: [Linux-ia64] Newbie questions Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-ia64@vger.kernel.org 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