1 #ifndef KERNEL_VFP_H 2 #define KERNEL_VFP_H 3 4 #include <types_ext.h> 5 6 #define VFP_NUM_REGS 32 7 8 struct vfp_state { 9 uint32_t fpexc; 10 uint32_t fpscr; 11 uint64_t reg[VFP_NUM_REGS]; 12 }; 13 14 bool vfp_is_enabled(void); 15 bool vfp_is_vpfinstr(uint32_t instr, uint32_t spsr); 16 void vfp_enable(void); 17 void vfp_disable(void); 18 19 /* 20 * vfp_lazy_save_state_init() - Saves FPEXC and disables VFP 21 * @state: VFP state structure to initialize 22 */ 23 void vfp_lazy_save_state_init(struct vfp_state *state); 24 25 /* 26 * vfp_lazy_save_state_final() - Saves rest of VFP state 27 * @state: VFP state to save in 28 * 29 * If VFP was enabled in the previously saved FPEXC save rest of FVP state. 30 */ 31 void vfp_lazy_save_state_final(struct vfp_state *state); 32 33 /* 34 * vfp_lazy_restore_state() - Lazy restore VFP state 35 * @state: VFP state to restore 36 * 37 * Restores FPEXC and also restores rest of VFP state if 38 * vfp_lazy_save_state_final() was called on this state. 39 */ 40 void vfp_lazy_restore_state(struct vfp_state *state, bool full_state); 41 42 #define FPEXC_EN (1 << 30) 43 44 /* 45 * These functions can't be implemented in inline assembly when compiling 46 * for thumb mode, to make it easy always implement then in ARM assembly as 47 * ordinary functions. 48 */ 49 void vfp_write_fpexc(uint32_t fpexc); 50 uint32_t vfp_read_fpexc(void); 51 void vfp_write_fpscr(uint32_t fpscr); 52 uint32_t vfp_read_fpscr(void); 53 54 #endif /*KERNEL_VFP_H*/ 55