[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, 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 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 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 or fp_enable_all subroutine or the fp_sh_info or fp_sh_set_stat subroutine, you must use the fp_trap 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 subroutine, fp_clr_flag, fp_read_flag, fpset_flag, or fp_swap_flag subroutine, sigaction, signal, or sigvec subroutine.

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

Floating-Point Exceptions Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Contents | Glossary | Home | Search ]