Operating System - HP-UX
1825810 Members
3031 Online
109688 Solutions
New Discussion

Re: PA RISC calling convention

 
SOLVED
Go to solution
Srimalik
Valued Contributor

PA RISC calling convention

I was trying to learn gdb on PA RISC and IA.
for PA RISC I am not able to find out the arguments being passed to the function.

In the PA RISC 2.0 runtime arch. doc it is mentioned that GR19- GR26 will hold the parameters, but in my case it is not happening so.

Can anybody please help/give me a doc/link where it is explained.

For IA r32,r33.... will contain the params and It is working as expected.
abandon all hope, ye who enter here..
4 REPLIES 4
Srimalik
Valued Contributor

Re: PA RISC calling convention

I am not able to connect to the machine on which I was experimenting.. I will try to reproduce the skeleton program here.
###################
void funcA(int *a,char *b,int c,int d, int e,int f, int g)
{
*a = 13;
}

int main()
{
funcA((int *)10,(char *) "string",1,2,3,4);
return 0;
}

####################

This program with dump at "*a = 13"

When I print the registers, r19-r26 do not have all the parameters, some are missing and some are accessible by these regs.

I will provide the actual values when the machine is accessible again(not before tomorrow morning :-( ).
abandon all hope, ye who enter here..
Srimalik
Valued Contributor

Re: PA RISC calling convention

Please read
"This program with dump at "*a = 13""
as
"This program will dump at "*a = 13""

and I am not using(and dun want to use) the -g flag during compilation.
abandon all hope, ye who enter here..
Dennis Handly
Acclaimed Contributor
Solution

Re: PA RISC calling convention

>In the PA RISC 2.0 runtime arch. doc it is mentioned that GR19-GR26 will hold the parameters, but in my case it is not happening so.

The arguments are in r26, r25, r24, r23 for PA32. As soon as you enter the function, these registers could be moved from the caller save registers to callee save registers, or saved in the dedicated arg slots.

>Can anybody please help/give me a doc/link where it is explained.

You seem to have some documentation. At one time there was a PA-RISC Procedure Calling Conventions manual. But it appears this was never put into electronic form. You could look at the Assembler manual:
http://docs.hp.com/en/92432-90012/ch03s05.html

>When I print the registers, r19-r26 do not have all the parameters

That's correct. You need to compile with -S and look at the assembly. Or use the disass gdb command.

>I am not using (and don't want to use) the -g flag during compilation.

You should use it so you know what tricks the compiler plays.
Srimalik
Valued Contributor

Re: PA RISC calling convention

PA32 and PA64 conventions differ.
Closing.
abandon all hope, ye who enter here..