[U-Boot] [PATCH 2/4] x86: Ensure no instruction sets of MMX/SSE are generated in 64-bit build

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Oct 11 18:04:12 UTC 2018


On 10/11/2018 03:53 AM, Bin Meng wrote:
> With the '-march=core2' fix, it seems that we have some luck that
> the 64-bit U-Boot boots again. However if we examine the disassembly
> codes there are still SSE instructions elsewhere which means passing
> cpu type to GCC is not enough to prevent it from generating these
> instructions. A simple test case is doing a 'bootefi selftest' from
> the U-Boot shell and it leads to a reset too.

I can confirm that an unexpected reset patch occurs without the patch.

> 
> The 'bootefi selftest' reset is even seen with the image created by
> the relative older GCC 5.4.0, the one shipped by Ubuntu 16.04.
> 
> To make sure no MMX/SSE instruction sets are generated, tell GCC not
> to do this. Note AVX is out of the question as CORE2 is old enough
> to support AVX yet.
> 
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
> ---
> 
>  arch/x86/config.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/config.mk b/arch/x86/config.mk
> index 576501e..8151e47 100644
> --- a/arch/x86/config.mk
> +++ b/arch/x86/config.mk
> @@ -24,6 +24,7 @@ ifeq ($(IS_32BIT),y)
>  PLATFORM_CPPFLAGS += -march=i386 -m32
>  else
>  PLATFORM_CPPFLAGS += $(if $(CONFIG_SPL_BUILD),,-fpic) -fno-common -march=core2 -m64
> +PLATFORM_CPPFLAGS += -mno-mmx -mno-sse

According to https://wiki.osdev.org/SSE SSE has to be initialized.
Otherwise SSE instructions lead to an undefined instruction exception.
Is it this initialization that we lack? If this is your motivation
please, state it in the commit message.

I think this patch could be squashed with the prior one.

Heinrich

>  endif
>  
>  PLATFORM_RELFLAGS += -fdata-sections -ffunction-sections -fvisibility=hidden
> 



More information about the U-Boot mailing list