HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: stack preparation
Operating System - HP-UX
1833310
Members
2642
Online
110051
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2003 08:22 PM
07-01-2003 08:22 PM
stack preparation
Hi,
I have an application to simulate the 'c' type function calling. It would read the function name and arguments from a file.
Use a generic function pointer to call the function passing the arguments using an array of void * .
The argument array is filled based on the argument type and the pointer is incremented accordingly.
(Eg. For double, the pointer will be incremented by 2).
Now if I call the function with a generic function pointer with the arguments like
func_ptr(args[0], args[1], args[2], args[3], ..
args[49]); (whare areg is declared as void *args[50])
The problem is if I have a double as argument anywhere after the 5th argument it is not getting passed properly to the actual function.
It works fine on a HP-UX 11.11 PA-RISC based workstaion but on a HP-UX 11.22 Itanium based m/c the arguments are screwed up in the actual function. 9It doesn't work on SGI and IBM also)
Please suggest the right approach to construct the stack and call the function with a generic function pointer.
TIA
satya
I have an application to simulate the 'c' type function calling. It would read the function name and arguments from a file.
Use a generic function pointer to call the function passing the arguments using an array of void * .
The argument array is filled based on the argument type and the pointer is incremented accordingly.
(Eg. For double, the pointer will be incremented by 2).
Now if I call the function with a generic function pointer with the arguments like
func_ptr(args[0], args[1], args[2], args[3], ..
args[49]); (whare areg is declared as void *args[50])
The problem is if I have a double as argument anywhere after the 5th argument it is not getting passed properly to the actual function.
It works fine on a HP-UX 11.11 PA-RISC based workstaion but on a HP-UX 11.22 Itanium based m/c the arguments are screwed up in the actual function. 9It doesn't work on SGI and IBM also)
Please suggest the right approach to construct the stack and call the function with a generic function pointer.
TIA
satya
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 02:51 AM
07-02-2003 02:51 AM
Re: stack preparation
Hi
I would think of passing the single address to the beginning of the array with arguments, rather than declaring function with 50 spare arguments just in case. Despite from being more optimal, it should be easier to handle I guess.
Good luck
Adam
I would think of passing the single address to the beginning of the array with arguments, rather than declaring function with 50 spare arguments just in case. Despite from being more optimal, it should be easier to handle I guess.
Good luck
Adam
I do everything perfectly, except from my mistakes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 12:26 PM
07-02-2003 12:26 PM
Re: stack preparation
If you want the C compiler to pass float or double parameters according to the calling conventions then you have to let the compiler know that they are float data types. You can read the calling conventions here.
Intel Itanium software conventions and runtime architecture
http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,3309,00.html
The first eight parameter "slots" are passed in registers. Float data types that are known to be float parameters should be passed in float registers. Float data that are varargs parameters should be passed in general registers. If the caller is not able to tell if they are varargs, parameters should be passed in both float and general registers.
If you caused every parameter to be treated as float data, then you would be at risk of NaN traps from certain integers interpreted as floats. Also, the parameter float registers, f8-f15, are only used up by passing a float value. If a call passes "(float,int,float,int)", then it uses the f8, out1, f9, and out3.
It seems that the only way to handle all cases is with 2^8 enumerated code versions for the possible combinations of float and non-float parameters.
Intel Itanium software conventions and runtime architecture
http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,3309,00.html
The first eight parameter "slots" are passed in registers. Float data types that are known to be float parameters should be passed in float registers. Float data that are varargs parameters should be passed in general registers. If the caller is not able to tell if they are varargs, parameters should be passed in both float and general registers.
If you caused every parameter to be treated as float data, then you would be at risk of NaN traps from certain integers interpreted as floats. Also, the parameter float registers, f8-f15, are only used up by passing a float value. If a call passes "(float,int,float,int)", then it uses the f8, out1, f9, and out3.
It seems that the only way to handle all cases is with 2^8 enumerated code versions for the possible combinations of float and non-float parameters.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP