HP.com home PA-RISC Procedure Calling Conventions Reference Manual > Appendix D The Stack Unwind Process

D.1 Role of Stubs in Unwinding

MPE documents

Complete PDF
Table of Contents

Stubs are generated by the linker when a procedure makes an external call. Although there are various kinds of stubs, all of them save some data about the current location and then branch to some other location. Since it will be necessary to unwind from stubs, it is necessary to describe these regions in the unwind table. To do this, the linker generates two-word unwind descriptors for stubs. The stub-unwind descriptors have the following format:
  word 1:  address of the first instruction of the stub

  word 2:
      bits 0..3     -  reserved
      
      bits 4..7     -  type of stub
      
      bits 8..10    -  reserved
      
      bits 11..15   -  used only for parameter relocation stub;
                       contains the number of the instruction which
                       stores RP on the stack in the stub.

      bits 16..31   -  length (# of words) of stub area
In some cases, a contiguous sequence of calling, called, or long branch stubs or millicode long branch can be covered by a single unwind descriptor. The

UNWIND and RECOVER subspaces point to the unwind, stub, and recover tables. These tables are arranged in code space as follows:

[Unwind & Recover Tables]

These four labels will be initialized at run time by the loader startup routines. These tables can be accessed by the unwind library routines U_get_unwind_table(} and U_get_recover_table(). The recover table consists of twelve-byte entries. The first two words are the PC-start and PC-end values; the last word is the address at which the recover should take place. This table is built for the HP Pascal ESCAPE mechanism, as explained in Appendix C.




Appendix D The Stack Unwind Process


D.2 Unwinding From Stubs on MPE XL