Itanium™ Software Conventions and Runtime Architecture Guide
Total Page:16
File Type:pdf, Size:1020Kb
Itanium™ Software Conventions and Runtime Architecture Guide May 2001 Document Number: 245358-003 Information in this document is provided in connection with Intel® products. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted by this document. Except as provided in Intel's Terms and Conditions of Sale for such products, Intel assumes no liability whatsoever, and Intel disclaims any express or implied warranty, relating to sale and/or use of Intel products including liability or warranties relating to fitness for a particular purpose, merchantability, or infringement of any patent, copyright or other intellectual property right. Intel products are not intended for use in medical, life saving, or life sustaining applications. Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked “reserved” or “undefined.” Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The Itanium processor may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request. Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order. Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or by visiting Intel’s website at http://developer.intel.com/design/litcentr. Itanium is a trademark or registered trademark of Intel Corporation or its subsidiaries in the United States and other countries. *Other brands and names may be claimed as the property of others. Copyright © 2001, Intel Corporation. Contents 1 Introduction......................................................................................................................1-1 1.1 Objectives of the Runtime Architecture ..............................................................1-1 1.2 About the Conventions .......................................................................................1-1 1.3 Overview of the Itanium™ Software Conventions and Runtime Architecture Guide..............................................................................................1-2 1.4 Terminology........................................................................................................1-2 2 Processor Architecture ....................................................................................................2-1 2.1 Application State and Programming Model........................................................2-1 2.2 Floating-point Programming Model ....................................................................2-2 2.3 System State and Programming Model..............................................................2-2 2.4 Addressing and Protection .................................................................................2-3 2.5 Interruptions .......................................................................................................2-3 3 Memory Model.................................................................................................................3-1 3.1 Program Segments ............................................................................................3-1 3.2 Protection Areas.................................................................................................3-2 3.3 Data Allocation ...................................................................................................3-4 3.3.1 Global Variables ................................................................................3-4 3.3.2 Local Static Data ...............................................................................3-4 3.3.3 Constants and Literals.......................................................................3-4 3.3.4 Local Memory Stack Variables..........................................................3-4 4 Data Representation .......................................................................................................4-1 4.1 Fundamental Types............................................................................................4-1 4.2 Aggregate Types................................................................................................4-2 4.3 Bit Fields.............................................................................................................4-4 4.4 Fortran Data Types ............................................................................................4-7 5 Register Usage................................................................................................................5-1 5.1 Partitioning .........................................................................................................5-1 5.2 General Registers ..............................................................................................5-1 5.3 Floating-point Registers .....................................................................................5-2 5.4 Predicate Registers ............................................................................................5-3 5.5 Branch Registers................................................................................................5-3 5.6 Application Registers..........................................................................................5-4 5.7 User Mask ..........................................................................................................5-5 6 Register Stack.................................................................................................................6-1 6.1 Input and Local Registers...................................................................................6-1 6.2 Output Registers ................................................................................................6-1 6.3 Rotating Registers..............................................................................................6-2 6.4 Frame Markers ...................................................................................................6-2 6.5 Backing Store for Register Stack .......................................................................6-2 7 Memory Stack .................................................................................................................7-1 7.1 Procedure Frames..............................................................................................7-1 Itanium™ Software Conventions and Runtime Architecture Guide iii 8 Procedure Linkage ..........................................................................................................8-1 8.1 External Naming Conventions............................................................................8-1 8.2 The gp Register..................................................................................................8-1 8.3 Types of Calls ....................................................................................................8-1 8.4 Calling Sequence ...............................................................................................8-2 8.4.1 Direct Calls........................................................................................8-2 8.4.2 Indirect Calls......................................................................................8-4 8.5 Parameter Passing.............................................................................................8-5 8.5.1 Allocation of Parameter Slots............................................................8-6 8.5.2 Register Parameters .........................................................................8-7 8.5.3 Memory Stack Parameters..............................................................8-10 8.5.4 Variable Argument Lists ..................................................................8-10 8.5.5 Pointers to Formal Parameters .......................................................8-10 8.5.6 Languages Other than C.................................................................8-10 8.5.7 Rounding Floating-point Values ......................................................8-11 8.5.8 Examples.........................................................................................8-11 8.6 Return Values ..................................................................................................8-13 8.7 Requirements for Unwinding the Stack............................................................8-14 9 Coding Conventions........................................................................................................9-1 9.1 Sample Code Sequences ..................................................................................9-1 9.1.1 Addressing “own” Data in the Short Data Area .................................9-1 9.1.2 Addressing External Data or Data in a Long Data Area....................9-1 9.1.3 Addressing Literals in the Text Segment...........................................9-2 9.1.4 Materializing Function Pointers .........................................................9-2 9.1.5 Direct Procedure Calls ......................................................................9-2 9.1.6 Indirect Procedure Calls....................................................................9-2