Path: blob/master/src/hotspot/os_cpu/linux_arm/fpu_control.h
40930 views
/* FPU control word definitions. ARM VFP version.1Copyright (C) 2004-2019 Free Software Foundation, Inc.2This file is part of the GNU C Library.3The GNU C Library is free software; you can redistribute it and/or4modify it under the terms of the GNU Lesser General Public5License as published by the Free Software Foundation; either6version 2.1 of the License, or (at your option) any later version.7The GNU C Library is distributed in the hope that it will be useful,8but WITHOUT ANY WARRANTY; without even the implied warranty of9MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU10Lesser General Public License for more details.11You should have received a copy of the GNU Lesser General Public12License along with the GNU C Library. If not, see13<http://www.gnu.org/licenses/>. */14#ifndef _FPU_CONTROL_H15#define _FPU_CONTROL_H16#if !(defined(_LIBC) && !defined(_LIBC_TEST)) && defined(__SOFTFP__)17#define _FPU_RESERVED 0xffffffff18#define _FPU_DEFAULT 0x0000000019typedef unsigned int fpu_control_t;20#define _FPU_GETCW(cw) (cw) = 021#define _FPU_SETCW(cw) (void) (cw)22extern fpu_control_t __fpu_control;23#else24/* masking of interrupts */25#define _FPU_MASK_IM 0x00000100 /* invalid operation */26#define _FPU_MASK_ZM 0x00000200 /* divide by zero */27#define _FPU_MASK_OM 0x00000400 /* overflow */28#define _FPU_MASK_UM 0x00000800 /* underflow */29#define _FPU_MASK_PM 0x00001000 /* inexact */30#define _FPU_MASK_NZCV 0xf0000000 /* NZCV flags */31#define _FPU_MASK_RM 0x00c00000 /* rounding mode */32#define _FPU_MASK_EXCEPT 0x00001f1f /* all exception flags */33/* Some bits in the FPSCR are not yet defined. They must be preserved when34modifying the contents. */35#define _FPU_RESERVED 0x0008606036#define _FPU_DEFAULT 0x0000000037/* Default + exceptions enabled. */38#define _FPU_IEEE (_FPU_DEFAULT | 0x00001f00)39/* Type of the control word. */40typedef unsigned int fpu_control_t;41/* Macros for accessing the hardware control word. */42#ifdef __SOFTFP__43/* This is fmrx %0, fpscr. */44# define _FPU_GETCW(cw) \45__asm__ __volatile__ ("mrc p10, 7, %0, cr1, cr0, 0" : "=r" (cw))46/* This is fmxr fpscr, %0. */47# define _FPU_SETCW(cw) \48__asm__ __volatile__ ("mcr p10, 7, %0, cr1, cr0, 0" : : "r" (cw))49#else50# define _FPU_GETCW(cw) \51__asm__ __volatile__ ("vmrs %0, fpscr" : "=r" (cw))52# define _FPU_SETCW(cw) \53__asm__ __volatile__ ("vmsr fpscr, %0" : : "r" (cw))54#endif55/* Default control word set at startup. */56extern fpu_control_t __fpu_control;57#endif /* __SOFTFP__ */58#endif /* _FPU_CONTROL_H */596061