Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/os_cpu/linux_arm/fpu_control.h
40930 views
1
/* FPU control word definitions. ARM VFP version.
2
Copyright (C) 2004-2019 Free Software Foundation, Inc.
3
This file is part of the GNU C Library.
4
The GNU C Library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Lesser General Public
6
License as published by the Free Software Foundation; either
7
version 2.1 of the License, or (at your option) any later version.
8
The GNU C Library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Lesser General Public License for more details.
12
You should have received a copy of the GNU Lesser General Public
13
License along with the GNU C Library. If not, see
14
<http://www.gnu.org/licenses/>. */
15
#ifndef _FPU_CONTROL_H
16
#define _FPU_CONTROL_H
17
#if !(defined(_LIBC) && !defined(_LIBC_TEST)) && defined(__SOFTFP__)
18
#define _FPU_RESERVED 0xffffffff
19
#define _FPU_DEFAULT 0x00000000
20
typedef unsigned int fpu_control_t;
21
#define _FPU_GETCW(cw) (cw) = 0
22
#define _FPU_SETCW(cw) (void) (cw)
23
extern fpu_control_t __fpu_control;
24
#else
25
/* masking of interrupts */
26
#define _FPU_MASK_IM 0x00000100 /* invalid operation */
27
#define _FPU_MASK_ZM 0x00000200 /* divide by zero */
28
#define _FPU_MASK_OM 0x00000400 /* overflow */
29
#define _FPU_MASK_UM 0x00000800 /* underflow */
30
#define _FPU_MASK_PM 0x00001000 /* inexact */
31
#define _FPU_MASK_NZCV 0xf0000000 /* NZCV flags */
32
#define _FPU_MASK_RM 0x00c00000 /* rounding mode */
33
#define _FPU_MASK_EXCEPT 0x00001f1f /* all exception flags */
34
/* Some bits in the FPSCR are not yet defined. They must be preserved when
35
modifying the contents. */
36
#define _FPU_RESERVED 0x00086060
37
#define _FPU_DEFAULT 0x00000000
38
/* Default + exceptions enabled. */
39
#define _FPU_IEEE (_FPU_DEFAULT | 0x00001f00)
40
/* Type of the control word. */
41
typedef unsigned int fpu_control_t;
42
/* Macros for accessing the hardware control word. */
43
#ifdef __SOFTFP__
44
/* This is fmrx %0, fpscr. */
45
# define _FPU_GETCW(cw) \
46
__asm__ __volatile__ ("mrc p10, 7, %0, cr1, cr0, 0" : "=r" (cw))
47
/* This is fmxr fpscr, %0. */
48
# define _FPU_SETCW(cw) \
49
__asm__ __volatile__ ("mcr p10, 7, %0, cr1, cr0, 0" : : "r" (cw))
50
#else
51
# define _FPU_GETCW(cw) \
52
__asm__ __volatile__ ("vmrs %0, fpscr" : "=r" (cw))
53
# define _FPU_SETCW(cw) \
54
__asm__ __volatile__ ("vmsr fpscr, %0" : : "r" (cw))
55
#endif
56
/* Default control word set at startup. */
57
extern fpu_control_t __fpu_control;
58
#endif /* __SOFTFP__ */
59
#endif /* _FPU_CONTROL_H */
60
61