From within a floating-point signal handler, determines any floating-point exception that caused the trap in the process and changes the state of the Floating-Point Status and Control register (FPSCR) in the user process.
#include <fpxcp.h> #include <fptrap.h> #include <signal.h>
void fp_sh_info(scp, fcp, struct_size) struct sigcontext *scp; struct fp_sh_info *fcp; size_t struct_size;
void fp_sh_trap_info(scp, fcp) struct sigcontext *scp; struct fp_ctx *fcp;
void fp_sh_set_stat(scp, fpscr) struct sigcontext *scp; fpstat_t fpscr;
These subroutines are for use within a user-written signal handler. They return information about the process that was running at the time the signal occurred, and they update the Floating-Point Status and Control register for the process.
Note: The fp_sh_trap_info subroutine is maintained for compatibility only. It has been replaced by the fp_sh_info subroutine, which should be used for development.
These subroutines operate only on the state of the user process that was running at the time the signal was delivered. They read and write the sigcontext structure. They do not change the state of the signal handler process itself.
The state of the signal handler process can be modified by the fp_any_enable, fp_is_enabled, fp_enable_all, fp_enable, fp_disable_all, or fp_disable subroutine.
The fp_sh_info subroutine returns information about the process that caused the trap by means of a floating-point context (fp_sh_info) structure. This structure contains the following information:
typedef struct fp_sh_info { fpstat_t fpscr; fpflag_t trap; short trap_mode; char flags; char extra; } fp_sh_info_t;
The fp_sh_trap_info subroutine is maintained for compatibility only. The fp_sh_trap_info subroutine returns information about the process that caused the trap by means of a floating-point context (fp_ctx) structure. This structure contains the following information:
fpstat_t fpscr; fpflag_t trap;
The fp_sh_set_stat subroutine updates the Floating-Point Status and Control register (FPSCR) in the user process with the value in the fpscr field.
The signal handler must either clear the exception bit that caused the trap to occur or disable the trap to prevent a recurrence. If the instruction generated more than one exception, and the signal handler clears only one of these exceptions, a signal is raised for the remaining exception when the next floating-point instruction is executed in the user process.
The fp_any_enable, fp_disable_all, fp_disable, fp_enable_all, fp_enable, or fp_is_enabled subroutine, fp_clr_flag, fp_read_flag, fp_set_flag, or fp_swap_flag subroutine, fp_trap subroutine.
Floating-Point Exceptions Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.