[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH v3 7/8] arch/x86: Introduce NO_X86_EXTREGS_FLAGS



Reviewed-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>

Florian Schmidt <florian.schmidt@xxxxxxxxx> writes:

> This set of flags disables the use of extended registers: FP, MMX/XMM,
> YMM, and hence should be used on files that implement
> trap/exception/interrupt handler functions, because we do not save the
> extended x86 register state when those events happen.
>
> Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
> ---
>  arch/x86/x86_64/Makefile.uk | 3 +++
>  plat/kvm/Makefile.uk        | 1 +
>  plat/kvm/x86/time.c         | 4 ++++
>  3 files changed, 8 insertions(+)
>
> diff --git a/arch/x86/x86_64/Makefile.uk b/arch/x86/x86_64/Makefile.uk
> index 8cd2f8be..8ec7d6b9 100644
> --- a/arch/x86/x86_64/Makefile.uk
> +++ b/arch/x86/x86_64/Makefile.uk
> @@ -9,6 +9,9 @@ CINCLUDES   += -I$(CONFIG_UK_BASE)/arch/x86/x86_64/include
>  ASINCLUDES  += -I$(CONFIG_UK_BASE)/arch/x86/x86_64/include
>  CXXINCLUDES += -I$(CONFIG_UK_BASE)/arch/x86/x86_64/include
>  
> +# compiler flags to prevent use of extended (FP, SSE, AVX) registers.
> +# This is for files that contain trap/exception/interrupt handlers
> +NO_X86_EXTREGS_FLAGS := -mno-80387 -mno-fp-ret-in-387 -mno-mmx -mno-sse 
> -mno-avx
>  
>  ASFLAGS-$(CONFIG_MARCH_X86_64_GENERIC)     += -mtune=generic
>  CFLAGS-$(CONFIG_MARCH_X86_64_GENERIC)      += -mtune=generic
> diff --git a/plat/kvm/Makefile.uk b/plat/kvm/Makefile.uk
> index 5fb56ee9..19ad3d67 100644
> --- a/plat/kvm/Makefile.uk
> +++ b/plat/kvm/Makefile.uk
> @@ -27,6 +27,7 @@ LIBKVMPLAT_CXXFLAGS            += -DKVMPLAT
>  ##
>  LIBKVMPLAT_SRCS-$(CONFIG_ARCH_X86_64) += 
> $(UK_PLAT_COMMON_BASE)/x86/trace.c|common
>  LIBKVMPLAT_SRCS-$(CONFIG_ARCH_X86_64) += 
> $(UK_PLAT_COMMON_BASE)/x86/traps.c|common
> +LIBKVMPLAT_TRAPS_COMMON_FLAGS += $(NO_X86_EXTREGS_FLAGS)
>  LIBKVMPLAT_SRCS-$(CONFIG_ARCH_X86_64) += 
> $(UK_PLAT_COMMON_BASE)/x86/cpu_features.c|common
>  LIBKVMPLAT_SRCS-$(CONFIG_ARCH_X86_64) += 
> $(UK_PLAT_COMMON_BASE)/x86/cpu_native.c|common
>  ifeq ($(CONFIG_HAVE_SCHED),y)
> diff --git a/plat/kvm/x86/time.c b/plat/kvm/x86/time.c
> index 3d8a8421..d62142ff 100644
> --- a/plat/kvm/x86/time.c
> +++ b/plat/kvm/x86/time.c
> @@ -58,6 +58,10 @@ __nsec ukplat_clock_wall(void)
>       return tscclock_monotonic() + tscclock_epochoffset();
>  }
>  
> +/* NB: If this ever does more than an immediate return, it will need to be
> + * compiled with NO_X86_EXTREGS_FLAGS to prevent potential clobbering of
> + * registers that are not saved on interrupt handling.
> + */
>  static int timer_handler(void *arg __unused)
>  {
>       /* Yes, we handled the irq. */
> -- 
> 2.20.1
>

-- 
Yuri Volchkov
Software Specialist

NEC Europe Ltd
Kurfürsten-Anlage 36
D-69115 Heidelberg

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.