getfcr: change getfcr/setfcr to use VFP

This commit is contained in:
cinap_lenrek 2014-12-25 17:44:49 +01:00
parent ed5c9fd00a
commit 2ab042f11e
4 changed files with 42 additions and 44 deletions

View file

@ -21,27 +21,32 @@ typedef unsigned short u16int;
typedef unsigned int u32int; typedef unsigned int u32int;
typedef unsigned long long u64int; typedef unsigned long long u64int;
/* FCR */ /* VFP FPSCR (exceptions) */
#define FPINEX (1<<20) #define FPINEX (1<<12)
#define FPUNFL (1<<19) #define FPUNFL (1<<11)
#define FPOVFL (1<<18) #define FPOVFL (1<<10)
#define FPZDIV (1<<17) #define FPZDIV (1<<9)
#define FPINVAL (1<<16) #define FPINVAL (1<<8)
#define FPRNR (0<<0)
#define FPRZ (1<<0) /* VFP FPSCR (rounding) */
#define FPRPINF (2<<0) #define FPRNR (0<<22)
#define FPRNINF (3<<0) #define FPRPINF (1<<22)
#define FPRMASK (3<<0) #define FPRNINF (2<<22)
#define FPRZ (3<<22)
#define FPRMASK (3<<22)
/* VFP FPSCR (status) */
#define FPPEXT 0 #define FPPEXT 0
#define FPPSGL 0 #define FPPSGL 0
#define FPPDBL 0 #define FPPDBL 0
#define FPPMASK 0 #define FPPMASK 0
/* FSR */
#define FPAINEX (1<<4) #define FPAINEX (1<<4)
#define FPAUNFL (1<<3) #define FPAUNFL (1<<3)
#define FPAOVFL (1<<2) #define FPAOVFL (1<<2)
#define FPAZDIV (1<<1) #define FPAZDIV (1<<1)
#define FPAINVAL (1<<0) #define FPAINVAL (1<<0)
union FPdbleword union FPdbleword
{ {
double x; double x;

View file

@ -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 #define Fpscr 1
MOVW R0, FPCR
TEXT setfcr(SB), $0
VMSR(0, Fpscr)
RET RET
TEXT getfcr(SB), $4 TEXT getfcr(SB), $0
MOVW FPCR, R0 VMRS(Fpscr, 0)
RET RET
TEXT getfsr(SB), $0 TEXT getfsr(SB), $0
MOVW FPSR, R0 VMSR(0, Fpscr)
RET RET
TEXT setfsr(SB), $0 TEXT setfsr(SB), $0
MOVW R0, FPSR VMRS(Fpscr, 0)
RET RET

View file

@ -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 TEXT setfcr(SB), $0
VMSR(0, Fpscr)
RET RET
TEXT getfcr(SB), $0 TEXT getfcr(SB), $0
VMRS(Fpscr, 0)
RET RET
TEXT getfsr(SB), $0 TEXT getfsr(SB), $0
VMSR(0, Fpscr)
RET RET
TEXT setfsr(SB), $0 TEXT setfsr(SB), $0
VMRS(Fpscr, 0)
RET RET

View file

@ -1,21 +0,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