[CRIU] [PATCH 2/8] sigframe: introduced the macros to access the FPU state

Alexander Kartashov alekskartashov at parallels.com
Thu Oct 10 23:47:59 PDT 2013


An fpu_state_t instance shouldn't be stored in an ARM sigframe
that makes it necessary to generalize the way the FPU state is
accessed in the routine construct_sigframe()

Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
 arch/arm/include/asm/restorer.h |    2 ++
 arch/x86/include/asm/restorer.h |    2 ++
 sigframe.c                      |    5 ++---
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/restorer.h b/arch/arm/include/asm/restorer.h
index fc835ca..661959c 100644
--- a/arch/arm/include/asm/restorer.h
+++ b/arch/arm/include/asm/restorer.h
@@ -125,6 +125,8 @@ struct rt_sigframe {
 
 #define RT_SIGFRAME_UC(rt_sigframe) rt_sigframe->sig.uc
 #define RT_SIGFRAME_REGIP(rt_sigframe) (rt_sigframe)->sig.uc.uc_mcontext.arm_ip
+#define RT_SIGFRAME_HAS_FPU(rt_sigframe) 1
+#define RT_SIGFRAME_FPU(rt_sigframe) ((struct aux_sigframe *)&sigframe->sig.uc.uc_regspace)->vfp
 
 #define SIGFRAME_OFFSET 0
 
diff --git a/arch/x86/include/asm/restorer.h b/arch/x86/include/asm/restorer.h
index d066f44..4cc510c 100644
--- a/arch/x86/include/asm/restorer.h
+++ b/arch/x86/include/asm/restorer.h
@@ -132,6 +132,8 @@ struct rt_sigframe {
 
 #define RT_SIGFRAME_UC(rt_sigframe) rt_sigframe->uc
 #define RT_SIGFRAME_REGIP(rt_sigframe) (rt_sigframe)->uc.uc_mcontext.rip
+#define RT_SIGFRAME_HAS_FPU(rt_sigframe) (rt_sigframe)->fpu_state.has_fpu
+#define RT_SIGFRAME_FPU(rt_sigframe) (rt_sigframe)->fpu_state
 
 #define SIGFRAME_OFFSET 8
 
diff --git a/sigframe.c b/sigframe.c
index 0c7e600..55d172c 100644
--- a/sigframe.c
+++ b/sigframe.c
@@ -20,12 +20,11 @@ int construct_sigframe(struct rt_sigframe *sigframe,
 	} else
 		memset(blk_sigset, 0, sizeof(k_rtsigset_t));
 
-	sigframe->fpu_state.has_fpu = true;
 	if (restore_fpu(sigframe, core))
 		return -1;
 
-	if (sigframe->fpu_state.has_fpu)
-		if (sigreturn_prep_fpu_frame(sigframe, &rsigframe->fpu_state))
+	if (RT_SIGFRAME_HAS_FPU(sigframe))
+		if (sigreturn_prep_fpu_frame(sigframe, &RT_SIGFRAME_FPU(rsigframe)))
 			return -1;
 
 	if (restore_gpregs(sigframe, CORE_THREAD_ARCH_INFO(core)->gpregs))
-- 
1.7.9.5



More information about the CRIU mailing list