HP UX Developer Tools manual Spaces

Page 40

HP-UX Architecture Conventions

Spaces

for the duration of program execution. The identifier of the code space is placed in space register 4 (%sr4) and the identifier of the data space is placed in space register 5 (%sr5).

When writing an assembly language program, declare a space named $TEXT$ for executable code, and a space named $PRIVATE$ for modifiable data. Constant data or literals that you do not plan to modify during program execution, can be placed in either space. Placing constant data in the $TEXT$ space decreases the size of the nonsharable part of your program and improves the overall efficiency of the operating system.

The particular space registers mentioned above play an important role in virtual addressing. While many of the branching instructions, such as BL, BLR, and BV, are capable of branching only within the currently executing code space (called PC-space), two of the branching instructions, BE and BLE, require that you specify a space register as well as an offset. These instructions allow you to branch to code executing in a different space. On HP-UX systems, normally all code for a program is contained in one space, so all BE and BLE instructions should be coded to use %sr4.

In contrast, the memory reference instructions, such as LDW and STW, allow a choice between two forms of addressing: long and short. With long addressing, you can choose any of the space registers 1 through 3 for the space identifier part of the virtual address. The space offset is formed as the sum of an immediate displacement and the contents of a general register. With short addressing, one of the space registers between 4 through 7 is chosen automatically, based on the high-order two bits of the base register. Each space addressed by these four space registers is effectively divided into four quadrants, with a different quadrant of each space accessible via short addressing.

On HP-UX systems, all of a program's code is placed in quadrant zero of the $TEXT$ space, or %sr4, (space offsets from 0 through 0x3FFFFFFF). The data is placed in quadrant one of the $PRIVATE$ space, or %sr5 (space offsets from 0x40000000 through 0x7FFFFFFF). Therefore, literal data in the code space and modifiable data in the data space can be addressed using the short addressing technique, without any concern for the space registers.

The identifier for shared memory segments, including shared library text, is placed into space register 6 (%sr6). Shared memory and shared library text are placed into quadrant two of the shared memory space (offsets 0x80000000 through 0xBFFFFFFF). The identifier for system

40

Chapter 3

Image 40
Contents HP 9000 Computers 92432-90012 JuneRestricted Rights Legend Legal NoticesHanover Street Palo Alto, California Contents Assembler Directives and Pseudo-Operations Contents Contents Contents Contents Pseudo-Instruction Set Assembling Your Program Programming Examples Diagnostic MessagesIndex Printing History PrefaceEdition Date Software Version Audience Related DocumentationTypographical Conventions This ManualSummary of Technical Changes for HP-UX Assembly Language Assembler FeaturesAssembler Features Summary of Changes for PA-RISC Summary of Changes for PA-RISC 2.0W Wide Mode, 64-bitSummary of Changes for PA-RISC ChapterSummary of Changes for PA-RISC 2.0W Wide Mode, 64-bit Program Structure Program Structure Label Opcode Operands CommentsSymbols and Constants Symbols and ConstantsInteger Constants Signed Unsigned Registers and Register Mnemonics Registers and Register MnemonicsRegisters by using an L or R suffix General Registers Single-Precision Floating-Point Registers Space Registers Double-Precision Floating-Point RegistersControl Registers Synonyms Register Procedure Calling Conventions Register Synonyms DescriptionExpressions ExpressionsStandard Arithmetic Operators Operator OperationLegal Combinations For Relocatable Terms Operation Result Available Field Selectors Meaning Field Meaning Selector Multiple of 2048 allows a three-instruction sequence Parenthesized Subexpressions Operands and Completers Operands and CompletersAddi Defining New Instructions With Macros Macro ProcessingMacro Processing Contains general register 19, or binary 10011. These HP-UX Architecture Conventions SpacesSpaces Memory Layout on HP-UX Sr4 Sr5 Sr6 Attributes SubspacesSubspaces Standard Subspaces and Sort Keys DirectivesSpace Subspace Sort Key Use Sections in 64-bit Mode Sections in 64-bit Mode$INIT$ Location Counters Location CountersCompiler Conventions Compiler ConventionsCompiler Conventions Global Symbol Usage Mfctl Shared Libraries Assembly ListingShared Libraries Assembly Listing Assembler Directives IntroductionDirective Function Requests common storage for a specified number Bytes Pseudo-Operations Directive Function Reserves 16 bits a half word of storage Align Directive SyntaxParameters ExampleDiscussion Allow DirectiveAllow Directive To the .LEVEL specified for the file Block and .BLOCKZ Pseudo-Operations Block and .BLOCKZ Pseudo-OperationsSpace $TEXT$ Subspa $CODE$ Block Byte Pseudo-Operation Byte Pseudo-OperationByte initvalue , initvalue Call Directive Call DirectiveCall argumentdescription argumentdescription Form of argument-description is Arg=location Where arg can Return value for a procedurefirst word in the argument list Second word in the argument listLIT Align Word Procend Export Callinfo Directive Callinfo DirectiveCallinfo parameter , parameter Register ENTRYSR= Unwound It restores the RP value when it encounters a .LEAVE Callinfo Directive Stack Frames Re-enter code subspace Comm Directive Comm DirectiveLabel .COMM numbytes Label Labels the location of the reserved storageCopyright Directive Copyright DirectiveCompany-name Proc Callinfo Enter Integer .fraction E power Fraction E powerDouble Pseudo-Operation Double Pseudo-OperationDword Pseudo-Operation Dword Pseudo-OperationDword initvalue , initvalue END Directive END DirectiveEndm Directive Endm DirectiveEnter and .LEAVE Pseudo-Operations Enter and .LEAVE Pseudo-OperationsSpace $TEXT$ Entry and .EXIT Directives Entry and .EXIT DirectivesSymbolicname .EQU value EQU DirectiveEQU Directive ValueExport Directive Export DirectiveArgument Export proc,ENTRY,ARGW0=GR Float Pseudo-Operation Float Pseudo-OperationHalf Pseudo-Operation Half Pseudo-OperationHalf initvalue , initvalue Import Directive Import DirectiveNOP END Label Directive Label DirectiveLabel labelid Labelid Names the label identifierLevel Directive Level DirectiveLevel Directive Listoff and .LISTON Directives Listoff and .LISTON DirectivesListon Code Space $TEXT$ SPNUM=0,SORT=0 Subspa $CODE$ Locct Directive Locct DirectiveMacro Directive Macro DirectiveLabel .MACRO formalparameter,formalparameter Examples 100 Origin Directive Origin DirectiveChapter 101 Proc and .PROCEND Directives Proc and .PROCEND Directives102 Chapter 103 REG Directive REG DirectiveLabel .REG typedregister Label User-defined register nameShlibversion Directive Shlibversion DirectiveChapter 105 Space Directive Space Directive106 Chapter 107 Spnum Pseudo-Operation Spnum Pseudo-Operation108 String and .STRINGZ Pseudo-Operations String and .STRINGZ Pseudo-OperationsChapter 109 110 Subspa Directive Subspa DirectiveName An identifier that names the current subspace Chapter 111112 Chapter 113 Version Directive Version Directive114 Word Pseudo-Operation Word Pseudo-OperationWord initvalue , initvalue Chapter 115Directive Space Name Default Parameters Programming AidsProgramming Aids Predefined Subspace DirectivesShortdata Chapter 117Programming Aids 118 Pseudo-Instruction Set 119120 Cond Description Compare and Branch Conditions Comb and ComibChapter 121 Add and Branch Conditions Addb and Addib Description 122Invoking the Assembler 123Using the as Command Using the as CommandAssemble code for the architecture 124Level filenameChapter 125 Wnumber Tables, see HP-UX Linker and LibrariesOnline User Guide 126Using the cc Command Using the cc CommandPassing Arguments to the Assembler Wa, ,as-argument as-argumentCpp Preprocessor 128Programming Examples 129Binary Search for Highest Bit Position Binary Search for Highest Bit Position130 Chapter 131 Copying a String Copying a String132 Chapter 133 Dividing a Double-Word Dividend Dividing a Double-Word Dividend134 Programming Examples Chapter 135Demonstrating the Procedure Calling Convention Demonstrating the Procedure Calling ConventionProgram Listing 136Assembly Program Listing Chapter 137Output of the cc -S Command Assembly Program Listing From the C CompilerOutput of the cc -S Command 138Chapter 139 Output of the cc -S Command 140 141 Option operand 142Chapter 143 Reserve 144Use a general register Wrong register type usedChapter 145 Use a control register Use a space register146 Chapter 147 148 Chapter 149 150 Chapter 151 Used to invoke the assembler 152Chapter 153 Error Messages Error Messages154 Chapter 155 156 Chapter 157 158 1027 10281029 10301031 10321033 10341035 10361037 1038162 Chapter 163 1054 10551056 1057Chapter 165 166 Chapter 167 168 Format keyword=value 10801081 1082170 1088 10891090 Chapter 1711091 10941095 10961097 10981099 11001101 11021103 11041105 Chapter 175Panic Messages Panic Messages176 2005 20062007 2008User Warning Messages User Warning Messages178 7003 70047005 7006180 Chapter 181 182 Limit Error Messages Limit Error Messages7200 72017202 72037204 184Diagnostic Messages Chapter 185186 Branching Error Messages Branching Error MessagesChapter 187 188 Chapter 189 190 Chapter 191 192 7827 78287834 78357836 7837Expr 194Index Index 195196 NumericsIndex 197 Copyright198 HP C/HP-UX,49Index 199 Mfctl200 DoubleIndex 201 See also memory202
Related manuals
Manual 29 pages 37.9 Kb Manual 44 pages 5.6 Kb Manual 2 pages 37.54 Kb