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)
call to _UNW_setCFM invalidates the _Unwind_Context
’s general register values in the range
GR32..GR127 and validates the
_Unwind_Context
’s current frame marker (CFM) value. Once the
CFM value is valid writes to General Registers in the range, GR32 through GR32 + CFM.sof are allowed
(for the purpose of initializing RSE stacked general registers in the current procedure’s RSE frame).
A specific set of registers listed in the unwind(5) INITIALIZATION section must be validated in order for a
call to
_UNW_step() to be successful.
Any initialization of register values not specifically listed in the previous paragraph is not allowed. For
instance initialization of the constant registers (GR0, FR0, FR1, PR0) are not allowed. Violating this rule
results in the the
_Unwind_Context
alert code set to _UNW_INITIALIZATION_RANGE_ERROR
and the _UNW_set... function returning _UNW_INITIALIZATION_RANGE_ERROR
.
Attempts to initialize an
_Unwind_Context
object which is in a state where initialization of values is
not allowed causes no change to the value in
_Unwind_Context
. It results in a return alert code of
_UNW_SET_NOT_ALLOWED_IN_STATE
. See also unwind(5).
The unwind library register value initializer functions refer to registers by their physical numbers as
opposed to the mapped (logical) numbers associated with rotations indicated in CFM.sor, CFM.rrb.gr,
CFM.rrb.pr, CFM.rrb.fr. The stack unwind library defines the physical number to be the register number
the value would lie in should the appropriate CFM.rrb field have value 0.
The mapping functions
_UNW_GR_PhysicalNumber()
, _UNW_FR_PhysicalNumber()
, and
_UNW_PR_PhysicalNumber()
return the physical register number to pass to the _UNW_get...
initializer functions to access a given logical register. Passing a mapping function a logical number which is
outside of the range of mapped logical numbers returns 0 and sets the _UNW_QUERY_RANGE_ERROR
alert condition. For example, calling _UNW_GR_PhysicalNumber(uc,42)
while CFM.sor is 0 sets
the alert condition. The contents of the
_Unwind_Context
object’s CFM should be initialized prior to
using the mapping functions.
_UNW_step() modifies the _Unwind_Context
pointed to by parameter p to represent the
predecessor’s processor state.
RETURN VALUE
_UNW_set... returns _UNW_SET_NOT_ALLOWED_IN_STATE
when _Unwind_Context is in a
state where initialization of values is not allowed. States in which initialization is allowed are Init and
Pre_Install. See Error conditions and recovery on the manual page unwind(5).
_UNW_set... returns _UNW_INITIALIZATION_RANGE_ERROR
on an attempt to initialize a regis-
ter for which initialization is forbidden. See the sub-section INTERACTION BETWEEN INITIALIZER
FUNCTIONS above. Otherwise
_UNW_set... returns _UNW_OK on successful completion.
_UNW_clear() returns _UNW_OK on successful completion. Otherwise _UNW_clear() returns
_UNW_CLEAR_NOT_ALLOWED_IN_STATE
when _Unwind_Context is not in one of the following
states: Init, User_Interrupted_Frame, User_Sendsig_Frame, Kernel_Bottom_Frame, Frame. See
unwind(5).
_UNW_GR_PhysicalNumber()
, _UNW_FR_PhysicalNumber(), and
_UNW_PR_PhysicalNumber()
each return a register number. They return 0 (along with the side
effect of setting the
_Unwind_Context
alert code to _UNW_QUERY_RANGE_ERROR) if passed a logical
number which is outside of the range of mapped logical numbers for that register class.
_UNW_step() produces the following return codes:
_UNW_STEP_KERNEL_SAVE_STATE
Indicates _Unwind_Context describes a frame beyond which the stack unwind library
can no longer step. Any HP_UX kernel interruption frame other than the one associated
with _user_sendsig() which supports user signal handling (see signal(5)) results in
this return value.
_UNW_STEP_BOTTOM
Indicates _Unwind_Context describes a frame beyond which the stack unwind library
can no longer step. This return code is produced when _UNW_step() is called for any
_Unwind_Context describing a procedure whose frame is marked with the bottom of
stack convention a saved return link of 0 (see Itanium Processor Family Software Con-
ventions and Runtime Architecture, Chapter 11.1 Unwinding the stack).
_UNW_OK
All’s well.
72 Hewlett-Packard Company 3 HP-UX 11i Version 2: December 2007 Update