lx_emul: set minimum alignment of allocations to 16 byte

FPU allocations on x86/ARM require a minimum alignment or may raise
faults (#GP or general protection in the x86 case).
This commit is contained in:
Sebastian Sumpf 2023-05-09 18:00:46 +02:00 committed by Christian Helmuth
parent 9cb9060794
commit 69d3d83930
3 changed files with 11 additions and 1 deletions

View File

@ -64,6 +64,7 @@ LX_ARCH := x86
GEN_ARCH := x86
SPEC_ARCH := x86_64
SRC_C += lx_emul/shadow/arch/x86/kernel/irq.c
SRC_C += lx_emul/shadow/arch/x86/kernel/setup_percpu.c
endif
@ -101,7 +102,6 @@ INC_DIR += $(SHADOW_INC_DIR)
vpath % $(DDE_LINUX_DIR)/src/lib
#
# Linux kernel definitions
#

View File

@ -31,6 +31,11 @@ SRC_CC += lx_kit/memory_non_dma.cc
ifeq ($(filter-out $(SPECS),x86),)
SRC_C += lx_emul/virt/spec/x86/dummies_arch.c
#
# Align memory allocations to 16 byte (because we allow FPU use in drivers)
#
CC_DEF += -DARCH_DMA_MINALIGN=16 -DARCH_SLAB_MINALIGN=1
endif
ifeq ($(filter-out $(SPECS),arm_64),)
SRC_C += lx_emul/virt/spec/arm_64/dummies_arch.c

View File

@ -9,6 +9,11 @@ LX_GEN_DIR := $(LIB_CACHE_DIR)/pc_linux_generated
include $(call select_from_repositories,lib/import/import-lx_emul_common.inc)
#
# Align memory allocations to 16 byte (because we allow FPU use in drivers)
#
CC_DEF += -DARCH_DMA_MINALIGN=16 -DARCH_SLAB_MINALIGN=16
INC_DIR += $(REP_DIR)/src/include
# Handle specific source requirements