HP-UX Reference (11i v2 07/12) - 3 Library Functions A-M (vol 6)

_
_UNW_currentContext(3X) _UNW_currentContext(3X)
(Itanium(R)-based System Only)
_UNW_setGR_NaT()
initializes the value of a numbered general register num to value in the
_Unwind_Context
pointed to by parameter p. The NAT bit for the register is set to
NaTval
_UNW_setFR()
initializes the value of a numbered floating point register, num, in the
_Unwind_Context
pointed to by parameter p, to the value image represented in parameters
first_container and second_container. These two containers represent the two consecutive double words of
the Floating point register Spill/Fill memory format. See Intel IA-64 Architecture Software Developer’s
Manual, Volume 1: IA-64 Application Architecture, Section 5.3: Floating Point Instructions.
_UNW_setBR() initializes the value of numbered branch register num to value in the
_Unwind_Context
pointed to by parameter p.
_UNW_setAR() initializes the value of enumerated application register num to value in the
_Unwind_Context
pointed to by parameter p. The enumeration type
_UNW_AppReg is used for
accessing application registers.
_UNW_setPR() initializes the value of a numbered predicate register num, in the
_Unwind_Context
pointed to by parameter p,tovalue, which is one of
_UNW_TRUE or _UNW_FALSE .
_UNW_setPreds()
initializes the value of all predicate registers in the _Unwind_Context
pointed
to by parameter p to a representation passed in value. value contains the contents of each predicate regis-
ter in the bit corresponding corresponding to the predicate register number; for instance, bit 63 contains
the contents (1 or 0) for predicate register 63.
_UNW_setIP() initializes the value of the instruction pointer to value in the _Unwind_Context
pointed to by parameter p. value must be a full 64-bit address. That means that any 32-bit pointer values
from the 32-bit address space must be swizzled before being passed to _UNW_setIP() . See Itanium Pro-
cessor Family Runtime Architecture Supplement: 32-Bit Runtime Architecture for HP-UX, Section 1:
Memory Model.
_UNW_setCFM() initializes the value of the current frame marker (CFM) to value in the
_Unwind_Context pointed to by parameter p. Refer to Intel IA-64 Architecture Software Developer’s
Manual, Volume 1: IA-64 Application Architecture, Section 3.1.7 Current Frame Marker. The current
frame marker contains the sizes of the various portions of the stack frame. It also specifies three Register
Rename Base values (used in register rotation). The current frame marker is not an architecturally visible
value. It is used by the unwind library while initializing an
_Unwind_Context
for unwinding to pro-
vide the initial
_Unwind_Context
with a picture of the Register Stack Engine (RSE) (specifically how
many stacked general registers registers from the range GR32 to GR127 are in the current frame) and any
register base rotations in effect. A client program can construct a current frame marker value by several
means:
A procedure wanting to unwind itself can call a "current state" collection procedure whose purpose
is to fill in an
_Unwind_Context
structure which describes its own state. That procedure (if
written in assembly) can use knowledge of its own register usage to craft the current frame marker
value.
A tool (such as a debugger) wishing to unwind a process other than itself that it has interrupted
(for instance, by setting a break point) can piece together the current frame marker value from the
interruption context produced by the interruption event. See Intel IA-64 Architecture Software
Developer’s Manual, Volume 2: IA-64 System Architecture, Chapter 5: IA-64 Interruptions.
_UNW_GR_PhysicalNumber(), _UNW_FR_PhysicalNumber()
, and
_UNW_PR_PhysicalNumber() for the _Unwind_Context
pointed to by parameter p return the
physical register number corresponding to the logical register number, logical_num. The distinction
between physical and logical register number is explained below in subsection INTERACTION BETWEEN
INITIALIZER FUNCTIONS.
INTERACTION BETWEEN INITIALIZER FUNCTIONS
The stack unwind library requires that calls to these setter functions occur only during the Init state (and
the Pre-install state while handling a conforming ANSI C++ standards exception). The state constraints
are discussed in unwind(5).
The transition into the Init state happens when
_UNW_clear() ,
_UNW_createContextForSelf(),or_UNW_createContext() is called. In the Init state,
_UNW_set... calls are allowed to initialize values in the _Unwind_Context of General Registers
1-31, scratch and preserved Floating Point Registers, scratch and preserved Predicate Registers, Branch
Registers 0-7, IP, CFM, and Application Registers in the set RSC, BSP, BSPSTORE, RNAT, CCV, UNAT,
FPSR, ITC, PFS, LC. Writing to a particular register validates that value in the _Unwind_Context.A
HP-UX 11i Version 2: December 2007 Update 2 Hewlett-Packard Company 71