0001
0002
0003
0004
0005
0006
0007 #include <asm/hwcap.h>
0008
0009 #include <asm/vfp.h>
0010
0011 #ifdef CONFIG_AS_VFP_VMRS_FPINST
0012 .macro VFPFMRX, rd, sysreg, cond
0013 vmrs\cond \rd, \sysreg
0014 .endm
0015
0016 .macro VFPFMXR, sysreg, rd, cond
0017 vmsr\cond \sysreg, \rd
0018 .endm
0019 #else
0020 @ Macros to allow building with old toolkits (with no VFP support)
0021 .macro VFPFMRX, rd, sysreg, cond
0022 MRC\cond p10, 7, \rd, \sysreg, cr0, 0 @ FMRX \rd, \sysreg
0023 .endm
0024
0025 .macro VFPFMXR, sysreg, rd, cond
0026 MCR\cond p10, 7, \rd, \sysreg, cr0, 0 @ FMXR \sysreg, \rd
0027 .endm
0028 #endif
0029
0030 @ read all the working registers back into the VFP
0031 .macro VFPFLDMIA, base, tmp
0032 .fpu vfpv2
0033 #if __LINUX_ARM_ARCH__ < 6
0034 fldmiax \base!, {d0-d15}
0035 #else
0036 vldmia \base!, {d0-d15}
0037 #endif
0038 #ifdef CONFIG_VFPv3
0039 .fpu vfpv3
0040 #if __LINUX_ARM_ARCH__ <= 6
0041 ldr \tmp, =elf_hwcap @ may not have MVFR regs
0042 ldr \tmp, [\tmp, #0]
0043 tst \tmp, #HWCAP_VFPD32
0044 vldmiane \base!, {d16-d31}
0045 addeq \base, \base, #32*4 @ step over unused register space
0046 #else
0047 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
0048 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
0049 cmp \tmp, #2 @ 32 x 64bit registers?
0050 vldmiaeq \base!, {d16-d31}
0051 addne \base, \base, #32*4 @ step over unused register space
0052 #endif
0053 #endif
0054 .endm
0055
0056 @ write all the working registers out of the VFP
0057 .macro VFPFSTMIA, base, tmp
0058 #if __LINUX_ARM_ARCH__ < 6
0059 fstmiax \base!, {d0-d15}
0060 #else
0061 vstmia \base!, {d0-d15}
0062 #endif
0063 #ifdef CONFIG_VFPv3
0064 .fpu vfpv3
0065 #if __LINUX_ARM_ARCH__ <= 6
0066 ldr \tmp, =elf_hwcap @ may not have MVFR regs
0067 ldr \tmp, [\tmp, #0]
0068 tst \tmp, #HWCAP_VFPD32
0069 vstmiane \base!, {d16-d31}
0070 addeq \base, \base, #32*4 @ step over unused register space
0071 #else
0072 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
0073 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
0074 cmp \tmp, #2 @ 32 x 64bit registers?
0075 vstmiaeq \base!, {d16-d31}
0076 addne \base, \base, #32*4 @ step over unused register space
0077 #endif
0078 #endif
0079 .endm