[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


fp_trapstate Subroutine

Purpose

Queries or changes the trapping mode in the Machine Status register (MSR).

Note: This subroutine replaces the fp_cpusync (fp_cpusync Subroutine) subroutine. The fp_cpusync subroutine is supported for compatibility, but the fp_trapstate subroutine should be used for development.

Library

Standard C Library (libc.a)

Syntax

#include <fptrap.h>

int fp_trapstate (int)

Description

The fp_trapstate subroutine is a service routine used to query or set the trapping mode. The trapping mode determines whether floating-point exceptions can generate traps, and can affect execution speed. See Floating-Point Exceptions Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs for a description of precise and imprecise trapping modes. Floating-point traps can be generated by the hardware only when the processor is in a traps-enabled mode.

The fp_trapstate subroutine changes only the trapping mode. It is a service routine for use in developing custom floating-point exception-handling software. If you are using the fp_enable (fp_any_enable, fp_is_enabled, fp_enable_all, fp_enable, fp_disable_all, or fp_disable Subroutine) or fp_enable_all subroutine or the fp_sh_info (fp_sh_info, fp_sh_trap_info, or fp_sh_set_stat Subroutine) or fp_sh_set_stat subroutine, you must use the fp_trap (fp_trap Subroutine) subroutine to change the process' trapping mode.

Parameters


flag Specifies a query of, or change in, the trap mode:

FP_TRAPSTATE_OFF
Sets the trapping mode to Off and returns the previous mode.

FP_TRAPSTATE_QUERY
Returns the current trapping mode without modifying it.

FP_TRAPSTATE_IMP
Puts the process in non-recoverable imprecise trapping mode and returns the previous state.

FP_TRAPSTATE_IMP_REC
Puts the process in recoverable imprecise trapping mode and returns the previous state.

FP_TRAPSTATE_PRECISE
Puts the process in precise trapping mode and returns the previous state.

FP_TRAPSTATE_FASTMODE
Puts the process in the fastest trap-generating mode available on the hardware platform and returns the state selected.

Note: Some hardware models do not support all modes. If an unsupported mode is requested, the fp_trapstate subroutine returns FP_TRAP_UNIMPL and the trapping mode is not changed.

Return Values

If called with the FP_TRAPSTATE_OFF, FP_TRAPSTATE_IMP, FP_TRAPSTATE_IMP_REC, or FP_TRAPSTATE_PRECISE flag, the fp_trapstate subroutine returns a value indicating the previous mode of the process. The value may be FP_TRAPSTATE_OFF, FP_TRAPSTATE_IMP, FP_TRAPSTATE_IMP_REC, or FP_TRAPSTATE_PRECISE. If the hardware does not support the requested mode, the fp_trapstate subroutine returns FP_TRAP_UNIMPL.

If called with the FP_TRAP_QUERY flag, the fp_trapstate subroutine returns a value indicating the current mode of the process. The value may be FP_TRAPSTATE_OFF, FP_TRAPSTATE_IMP, FP_TRAPSTATE_IMP_REC, or FP_TRAPSTATE_PRECISE.

If called with the FP_TRAPSTATE_FASTMODE flag, the fp_trapstate subroutine returns a value indicating which mode was selected. The value may be FP_TRAPSTATE_OFF, FP_TRAPSTATE_IMP, FP_TRAPSTATE_IMP_REC, or FP_TRAPSTATE_PRECISE.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The fp_any_enable, fp_disable_all, fp_disable, fp_enable_all, fp_enable, or fp_is_enabled (fp_any_enable, fp_is_enabled, fp_enable_all, fp_enable, fp_disable_all, or fp_disable Subroutine) subroutine, fp_clr_flag, fp_read_flag, fpset_flag, or fp_swap_flag (fp_clr_flag, fp_set_flag, fp_read_flag, or fp_swap_flag Subroutine) subroutine, sigaction, signal, or sigvec subroutine.

The Floating-Point Processor in POWERstation and POWERserver Hardware Technical Information-General Architectures.

Floating-Point Exceptions in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]