Operating System - HP-UX
1827251 Members
2933 Online
109716 Solutions
New Discussion

how to call a function by aCC inline assembly

 
SOLVED
Go to solution
Dennis Handly
Acclaimed Contributor

Re: how to call a function by aCC inline assembly

>still don't know what exactly the called function does to find the inputted parms.

 

You need to simulate and reverse engineer in your head what it does.

 

>can you please describe more details? till now, I can't find useful document of this.

 

http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=821ffd06ab1b7110VgnVCM100000275d6e10RCRD

http://www.intel.com/content/dam/www/public/us/en/documents/guides/itanium-software-runtime-architecture-guide.pdf

7.1 Procedure Frames

 

>if I pass int, double, int, double by stack, how are they placed?
sp+0x20 -> int
sp+0x28 -> double
sp+0x30 -> int
sp+0x38 -> double

 

These would be parms 9 .. 12.  If you took the address of these in the callee, p1 .. p8 would be stored into sp-0x30 to sp+0x18.

The two int (4 byte) parms would be stored right justified:

sp+0x24 -> int
sp+0x34 -> int