From 9088634e9685d76ab37a7b8872b6eaebffbb0f4d Mon Sep 17 00:00:00 2001 From: p-szafonimateusz Date: Wed, 24 Apr 2024 11:52:28 +0200 Subject: [PATCH] testing/ostest/fpu.c: align FPU context some architectures requires FPU context to be aligned, for example x86-64 when used with XSAVE instruction must be aligned to 64 Signed-off-by: p-szafonimateusz --- testing/ostest/fpu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/testing/ostest/fpu.c b/testing/ostest/fpu.c index 0caf173b8..41a201cb1 100644 --- a/testing/ostest/fpu.c +++ b/testing/ostest/fpu.c @@ -79,14 +79,20 @@ #define FPU_NTHREADS 2 +/* Some architectures require XCPTCONTEXT to be aligned */ + +#ifndef XCPTCONTEXT_ALIGN +# define XCPTCONTEXT_ALIGN 1 +#endif + /**************************************************************************** * Private Types ****************************************************************************/ struct fpu_threaddata_s { - uintptr_t save1[XCPTCONTEXT_REGS]; - uintptr_t save2[XCPTCONTEXT_REGS]; + uintptr_t save1[XCPTCONTEXT_REGS] aligned_data(XCPTCONTEXT_ALIGN); + uintptr_t save2[XCPTCONTEXT_REGS] aligned_data(XCPTCONTEXT_ALIGN); /* These are just dummy values to force the compiler to do the * requested floating point computations without the nonsense