Back to index

glibc  2.9
fpu_control.h
Go to the documentation of this file.
00001 /* FPU control word definitions.  ARM VFP version.
00002    Copyright (C) 2004, 2005 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with GCC; see the file COPYING.  If not, write to the Free
00017    Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
00018    02110-1301, USA.  */
00019 
00020 #ifndef _FPU_CONTROL_H
00021 #define _FPU_CONTROL_H
00022 
00023 /* masking of interrupts */
00024 #define _FPU_MASK_IM 0x00000100    /* invalid operation */
00025 #define _FPU_MASK_ZM 0x00000200    /* divide by zero */
00026 #define _FPU_MASK_OM 0x00000400    /* overflow */
00027 #define _FPU_MASK_UM 0x00000800    /* underflow */
00028 #define _FPU_MASK_PM 0x00001000    /* inexact */
00029 
00030 /* Some bits in the FPSCR are not yet defined.  They must be preserved when
00031    modifying the contents.  */
00032 #define _FPU_RESERVED       0x0e08e0e0
00033 #define _FPU_DEFAULT    0x00000000
00034 /* Default + exceptions enabled. */
00035 #define _FPU_IEEE    (_FPU_DEFAULT | 0x00001f00)
00036 
00037 /* Type of the control word.  */
00038 typedef unsigned int fpu_control_t;
00039 
00040 /* Macros for accessing the hardware control word.  */
00041 /* This is fmrx %0, fpscr.  */
00042 #define _FPU_GETCW(cw) \
00043   __asm__ __volatile__ ("mrc p10, 7, %0, cr1, cr0, 0" : "=r" (cw))
00044 /* This is fmxr fpscr, %0.  */
00045 #define _FPU_SETCW(cw) \
00046   __asm__ __volatile__ ("mcr p10, 7, %0, cr1, cr0, 0" : : "r" (cw))
00047 
00048 /* Default control word set at startup.  */
00049 extern fpu_control_t __fpu_control;
00050 
00051 #endif /* _FPU_CONTROL_H */