Module: xenomai-2.6 Branch: master Commit: d4e755b2a9909afb7bbd0a522ff1d97718494cd7 URL: http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=d4e755b2a9909afb7bbd0a522ff1d97718494cd7
Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org> Date: Wed Jul 6 11:15:42 2016 +0200 hal/arm: fix VFP support When CONFIG_VFP is enabled, use directly union vfp_state as FPU backup area. rthal_fpenv layout no longer has to be kept synchronized with thread_info. --- include/asm-arm/bits/shadow.h | 4 ++++ include/asm-arm/hal.h | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/include/asm-arm/bits/shadow.h b/include/asm-arm/bits/shadow.h index 4c0f38e..a2330f0 100644 --- a/include/asm-arm/bits/shadow.h +++ b/include/asm-arm/bits/shadow.h @@ -42,7 +42,11 @@ static inline void xnarch_init_shadow_tcb(xnarchtcb_t * tcb, tcb->tip = task_thread_info(task); #ifdef CONFIG_XENO_HW_FPU tcb->user_fpu_owner = task; +#ifdef CONFIG_VFP + tcb->fpup = &task_thread_info(task)->vfpstate; +#else /* !CONFIG_VFP */ tcb->fpup = (rthal_fpenv_t *) & task_thread_info(task)->used_cp[0]; +#endif /* !CONFIG_VFP */ #endif /* CONFIG_XENO_HW_FPU */ tcb->entry = NULL; tcb->cookie = NULL; diff --git a/include/asm-arm/hal.h b/include/asm-arm/hal.h index 25d3f5d..996cb47 100644 --- a/include/asm-arm/hal.h +++ b/include/asm-arm/hal.h @@ -226,6 +226,9 @@ asmlinkage void rthal_thread_trampoline(void); #ifdef CONFIG_XENO_HW_FPU +#ifdef CONFIG_VFP +typedef union vfp_state rthal_fpenv_t; +#else /* !CONFIG_VFP */ typedef struct rthal_fpenv { /* @@ -247,19 +250,21 @@ typedef struct rthal_fpenv { #endif /* Linux version >= 2.6.16 */ union vfp_state vfpstate; } rthal_fpenv_t; +#endif /* !CONFIG_VFP */ static inline void rthal_init_fpu(rthal_fpenv_t *fpuenv) { - fp_init(&fpuenv->fpstate); -#if defined(CONFIG_VFP) +#ifdef CONFIG_VFP /* vfpstate has already been zeroed by xnarch_init_fpu */ - fpuenv->vfpstate.hard.fpexc = FPEXC_EN; - fpuenv->vfpstate.hard.fpscr = FPSCR_ROUND_NEAREST; + fpuenv->hard.fpexc = FPEXC_EN; + fpuenv->hard.fpscr = FPSCR_ROUND_NEAREST; #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) \ || defined(CONFIG_VFP_3_2_BACKPORT)) && defined(CONFIG_SMP) - fpuenv->vfpstate.hard.cpu = NR_CPUS; + fpuenv->hard.cpu = NR_CPUS; #endif /* linux >= 3.2.0 */ -#endif +#else /* !CONFIG_VFP */ + fp_init(&fpuenv->fpstate); +#endif /* !CONFIG_VFP */ } #define rthal_task_fpenv(task) \ @@ -272,12 +277,12 @@ asmlinkage void rthal_vfp_load(union vfp_state *vfp, unsigned cpu); static inline void rthal_save_fpu(rthal_fpenv_t *fpuenv, unsigned fpexc) { - rthal_vfp_save(&fpuenv->vfpstate, fpexc); + rthal_vfp_save(fpuenv, fpexc); } static inline void rthal_restore_fpu(rthal_fpenv_t *fpuenv) { - rthal_vfp_load(&fpuenv->vfpstate, rthal_processor_id()); + rthal_vfp_load(fpuenv, rthal_processor_id()); } #define rthal_vfp_fmrx(_vfp_) ({ \ @@ -318,7 +323,7 @@ static inline rthal_fpenv_t *rthal_get_fpu_owner(void) return NULL; #endif /* linux >= 3.2.0 */ - return container_of(vfp_owner, rthal_fpenv_t, vfpstate); + return vfp_owner; } #define rthal_disable_fpu() \ _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git