ref: 2ab042f11e5848089b343cc565acb65d4a5bc64a
parent: ed5c9fd00a2e34a8a45288c986d52ac499db393b
author: cinap_lenrek <[email protected]>
date: Thu Dec 25 12:44:49 EST 2014
getfcr: change getfcr/setfcr to use VFP
--- a/arm/include/u.h
+++ b/arm/include/u.h
@@ -21,27 +21,32 @@
typedef unsigned int u32int;
typedef unsigned long long u64int;
-/* FCR */
-#define FPINEX (1<<20)
-#define FPUNFL (1<<19)
-#define FPOVFL (1<<18)
-#define FPZDIV (1<<17)
-#define FPINVAL (1<<16)
-#define FPRNR (0<<0)
-#define FPRZ (1<<0)
-#define FPRPINF (2<<0)
-#define FPRNINF (3<<0)
-#define FPRMASK (3<<0)
+/* VFP FPSCR (exceptions) */
+#define FPINEX (1<<12)
+#define FPUNFL (1<<11)
+#define FPOVFL (1<<10)
+#define FPZDIV (1<<9)
+#define FPINVAL (1<<8)
+
+/* VFP FPSCR (rounding) */
+#define FPRNR (0<<22)
+#define FPRPINF (1<<22)
+#define FPRNINF (2<<22)
+#define FPRZ (3<<22)
+
+#define FPRMASK (3<<22)
+
+/* VFP FPSCR (status) */
#define FPPEXT 0
#define FPPSGL 0
#define FPPDBL 0
#define FPPMASK 0
-/* FSR */
-#define FPAINEX (1<<4)
-#define FPAUNFL (1<<3)
-#define FPAOVFL (1<<2)
-#define FPAZDIV (1<<1)
+#define FPAINEX (1<<4)
+#define FPAUNFL (1<<3)
+#define FPAOVFL (1<<2)
+#define FPAZDIV (1<<1)
#define FPAINVAL (1<<0)
+
union FPdbleword
{
double x;
--- a/sys/src/ape/lib/ap/arm/getfcr.s
+++ b/sys/src/ape/lib/ap/arm/getfcr.s
@@ -1,16 +1,21 @@
+/* for VFP */
+#define VMRS(fp, cpu) WORD $(0xeef00a10 | (fp)<<16 | (cpu)<<12) /* FP → arm */
+#define VMSR(cpu, fp) WORD $(0xeee00a10 | (fp)<<16 | (cpu)<<12) /* arm → FP */
-TEXT setfcr(SB), $4
- MOVW R0, FPCR
+#define Fpscr 1
+
+TEXT setfcr(SB), $0
+ VMSR(0, Fpscr)
RET
-TEXT getfcr(SB), $4
- MOVW FPCR, R0
+TEXT getfcr(SB), $0
+ VMRS(Fpscr, 0)
RET
TEXT getfsr(SB), $0
- MOVW FPSR, R0
+ VMSR(0, Fpscr)
RET
TEXT setfsr(SB), $0
- MOVW R0, FPSR
+ VMRS(Fpscr, 0)
RET
--- a/sys/src/libc/arm/getfcr.s
+++ b/sys/src/libc/arm/getfcr.s
@@ -1,12 +1,21 @@
+/* for VFP */
+#define VMRS(fp, cpu) WORD $(0xeef00a10 | (fp)<<16 | (cpu)<<12) /* FP → arm */
+#define VMSR(cpu, fp) WORD $(0xeee00a10 | (fp)<<16 | (cpu)<<12) /* arm → FP */
+
+#define Fpscr 1
+
TEXT setfcr(SB), $0
+ VMSR(0, Fpscr)
RET
TEXT getfcr(SB), $0
+ VMRS(Fpscr, 0)
RET
TEXT getfsr(SB), $0
+ VMSR(0, Fpscr)
RET
TEXT setfsr(SB), $0
+ VMRS(Fpscr, 0)
RET
-
--- a/sys/src/libc/arm/getfcr.vfp.S
+++ /dev/null
@@ -1,21 +1,0 @@
-/* for VFP */
-#define VMRS(fp, cpu) WORD $(0xeef00a10 | (fp)<<16 | (cpu)<<12) /* FP → arm */
-#define VMSR(cpu, fp) WORD $(0xeee00a10 | (fp)<<16 | (cpu)<<12) /* arm → FP */
-
-#define Fpscr 1
-
-TEXT setfcr(SB), $0
- VMSR(0, Fpscr)
- RET
-
-TEXT getfcr(SB), $0
- VMRS(Fpscr, 0)
- RET
-
-TEXT getfsr(SB), $0
- VMSR(0, Fpscr)
- RET
-
-TEXT setfsr(SB), $0
- VMRS(Fpscr, 0)
- RET