__far_jump() — perform far jump (C/C++ and XPLINK only)
The __far_jump() interface performs a function similar to longjmp(). However, it does not require a setjmp() to be performed previously. The information required to perform this "nonlocal goto" is provided by the user in the __jumpinfo structure. This information is normally provided in a jmp_buf and saved by the library when a setjmp() is invoked, When used in conjunction with __set_stack_softlimit(), described in __set_stack_softlimit() — set stack soft limit (C/C++ and XPLINK only), the information needed to fill in __jumpinfo can be obtained from data passed to a signal handler set up to field a softlimit stack overflow signal. This information includes registers, psw, and signal mask.
Syntax
#include <edcwccwi.h>
void __far_jump (struct __jumpinfo * JumpInfo);
- struct __jumpinfo * JumpInfo
- The __jumpinfo structure
must be cleared before it is filled in to ensure that all reserved
areas are zero. The __jumpinfo structure
appears in the following format:
struct __jumpinfo { char __ji_u1[68]; char __ji_mask_saved; char __ji_u2[3]; sigset_t __ji_sigmask; char __ji_u3[11]; unsigned __ji_fl_fp4 :1; unsigned __ji_fl_fp16 :1; unsigned __ji_fl_fpc :1; unsigned __ji_fl_res1a :1; unsigned __ji_fl_hr :1; unsigned __ji_fl_res2 :1; unsigned __ji_fl_exp :1; unsigned __ji_fl_res2a :1; char __ji_u4[12]; struct __jumpinfo_vr_ext *__ji_vr_ext; #ifndef _LP64 char __ji_u7[4]; //only available in AMode 31 #endif char __ji_u8[16]; long __ji_gr[16]; long __ji_hr[16]; int __ji_u5[16]; double __ji_fpr[16]; int __ji_fpc;
- __ji_gr
- Contains the following:
- The values of the 16 general purpose registers that are restored
- The value in Register 7 will be used as the target address of the jump
- The value of Register 4 will be used as the target DSA address
- __ji_hr
- Contains the values of the high halves of the 16 general purpose registers (0-15) that are restored. This is valid only on 64 bit hardware when running in 31 bit mode.
- __ji_fpr
- Contains the values of either 4 or 16 floating-point registers. If all 16 floating-point registers are present, registers 0-15 are saved in __ji_fpr[0] through __ji_fpr[15]. If only 4 floating-point registers are present, they are registers 0, 2, 4, and 6; these are saved in __ji_fpr[0], __ji_fpr[2], __ji_fpr[4], and __ji_fpr[6].
- __ji_mask_saved
- Indicator field that is set to non-zero value when the signal mask field (__ji_sigmask) is valid.
- __ji_sigmask
- Contains the signal mask value.
- __ji_fpc
- Contains the floating point control register value.
- __ji_fl_fp4
- Set to one when values for the 4 floating-point registers 0, 2, 4, and 6 are provided in __ji_fpr. This bit should also be set to one whenever all floating-point registers 0-15 are present (when __ji_fl_fp16 is also set to one.)
- __ji_fl_fp16
- Set to one when values for all 16 floating-point registers 0-15 are provided in __ji_fpr. In this case, __ji_fl_fp4 should also be set to one.
- __ji_fl_fpc
- Set to one when the value of the floating-point control register is provided in __ji_fpc.
- __ji_fl_exp
- Set to one when explicit backchaining is complete to the target stack.
- __ji_fl_hr
- Set to one when values for the high halves of general registers 0-15 are provided in __ji_hr. This flag is set only in 31-bit addressing mode. In 64-bit addressing mode, __ji_gr contains 64-bit values for the general registers, and __ji_fl_hr is not set.
- __ji_vr_ext
- When the Vector Registers are available on the target machine,
the __ji_vr_ext field can be set to a pointer
to vector register save area or set to NULL if vector registers are
not to be restored.
typedef char __jumpinfo_vector_t[16]; struct __jumpinfo_vr_ext { short __ji_ve_version; char __ji_ve_u[14]; __jumpinfo_vector_t__ji_ve_savearea[32]; }
- __ji_ve_version
- Always set to zero.
- __ji_ve_u
- Reserved bytes and should always set to all zero.
- __ji_ve_savearea
- Contains the values of 32 Vector Registers (16 bytes each).
The __far_jump() function has no returned value. When __far_jump() completes, program execution continues at the target address.
- The library does not attempt to verify the contents of the __jumpinfo structure. Incorrect data can lead to unpredictable results.
- The caller of __far_jump() can optionally supply a signal mask suitable to the target of the jump. It is usually required in the soft overflow scenario because the signal handler, which is the __far_jump invoker, is driven with SIGSEGV disabled. However, SIGSEGV must be enabled at resumption in the target.
- The caller of __far_jump() provides the GPR and FPR sets needed for the target of the __far_jump(). The GPR set is always complete. For example, it has all 16 registers, including the target DSA address in R4 and target code address in R7. The FPR set is 4 or 16 registers long, indicated by the accompanying switches.
- The contents of all registers at the point of resumption after a __far_jump() are the values specified in the __jumpinfo buffer. The target address of the jump is not supplied separately. It is supplied as two of the register values in the GPR set in the __jumpinfo buffer, R4 for the target DSA address and R7 for the target code address.
- The Vendor Interfaces header file, <edcwccwi.h>, is located in member EDCWCCWI of the SCEESAMP data set. In order to include <edcwccwi.h> in an application, the header file must be copied into a PDS or into a directory in the z/OS® UNIX file system where the C/C++ compiler will find it.