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.
Standard C Library (libc.a)
#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.
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.
fp_sh_info
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 fields are:
Item | Description |
---|---|
fpscr | The Floating-Point Status and Control register (FPSCR) in the user process at the time the interrupt occurred. |
trap | A mask indicating the trap or traps that caused the signal handler to be entered. This mask is the logical OR operator of the enabled floating-point exceptions that occurred to cause the trap. This mask can have up to two exceptions; if there are two, the INEXACT signal must be one of them. If the mask is 0, the SIGFPE signal was raised not by a floating-point operation, but by the kill or raise subroutine or the kill command. |
trap_mode | The trap mode in effect in the process at the time the signal
handler was entered. The values returned in the fp_sh_info.trap_mode file
use the following argument definitions:
|
flags | This field is interpreted as an array of bits and should
be accessed with masks. The following mask is defined:
|
fp_sh_trap_info
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 fields are:
Item | Description |
---|---|
fpscr | The Floating-Point Status and Control register (FPSCR) in the user process at the time the interrupt occurred. |
trap | A mask indicating the trap or traps that caused the signal handler to be entered. This mask is the logical OR operator of the enabled floating-point exceptions that occurred to cause the trap. This mask can have up to two exceptions; if there are two, the INEXACT signal must be one of them. If the mask is 0, the SIGFPE signal was raised not by a floating-point operation, but by the kill or raise subroutine or the kill command. |
fp_sh_set_stat
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.
Item | Description |
---|---|
fcp | Specifies a floating-point context structure. |
scp | Specifies a sigcontext structure for the interrupt. |
struct_size | Specifies the size of the fp_sh_info structure. |
fpscr | Specifies which Floating-Point Status and Control register to update. |