diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2023-05-17 17:37:17 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-05-25 13:08:43 +0000 |
commit | 67d95185865651aecb7ef3d8d343ec3cb9e60f77 (patch) | |
tree | 29916786c3824fe935a5bf52c5fd481e4008f922 /src/arch | |
parent | 7dab99856d22ced1075471e4747d93c2dc6eec86 (diff) |
arch/x86: Don't allow hw floating point operations
Even though coreboot does not allow floating point operations some
compilers like clang generate code using hw floating point registers,
e.g. SSE %XMMx registers on 64bit code by default. Floating point
operations need to be enabled in hardware for this to work (CR4). Also
in SMM we explicitly need to save and restore floating point registers
for this reason. If we instruct the compiler to not generate code with
FPU ops, this simplifies our code as we can skip that step.
With clang this reduces the binary size a bit. For instance ramstage for
qemu/Q35 drops from 216600 bytes decompressed to 212768.
TEST: See that with x86_64 bit and clang coreboot reaches the payload
without setting the CR4_OSFXSR bit in CR4. Without this change it would
bootloop very early in the bootblock on Qemu Q35.
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Change-Id: Ib8590c55e7aed1ece2aa23b8ea99463396435e11
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75316
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/x86/Makefile.inc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc index 4ac30ca270..1c92816547 100644 --- a/src/arch/x86/Makefile.inc +++ b/src/arch/x86/Makefile.inc @@ -301,6 +301,10 @@ target-objcopy=-O elf64-x86-64 -B i386:x86-64 LD_MACHINE =-m elf_x86_64 endif +# Make sure generated code does not use XMMx and MMx registers +CFLAGS_x86_32 += -mno-mmx -mno-sse +CFLAGS_x86_64 += -mno-mmx -mno-sse + ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c) ifeq ($(CONFIG_GENERATE_MP_TABLE),y) ifneq ($(wildcard src/mainboard/$(MAINBOARDDIR)/mptable.c),) |