Skip to content

Commit 87d6021

Browse files
arndbsuryasaimadhu
authored andcommitted
x86/math-emu: Limit MATH_EMULATION to 486SX compatibles
The FPU emulation code is old and fragile in places, try to limit its use to builds for CPUs that actually use it. As far as I can tell, this is only true for i486sx compatibles, including the Cyrix 486SLC, AMD Am486SX and ÉLAN SC410, UMC U5S amd DM&P VortexSX86, all of which were relatively short-lived and got replaced with i486DX compatible processors soon after introduction, though some of the embedded versions remained available much longer. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Reviewed-by: Kees Cook <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Bill Metzenthen <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: x86-ml <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent e6b44ce commit 87d6021

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

arch/x86/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1751,7 +1751,7 @@ config X86_RESERVE_LOW
17511751
config MATH_EMULATION
17521752
bool
17531753
depends on MODIFY_LDT_SYSCALL
1754-
prompt "Math emulation" if X86_32
1754+
prompt "Math emulation" if X86_32 && (M486SX || MELAN)
17551755
---help---
17561756
Linux can emulate a math coprocessor (used for floating point
17571757
operations) if you don't have one. 486DX and Pentium processors have

arch/x86/Kconfig.cpu

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,19 @@ choice
5050
See each option's help text for additional details. If you don't know
5151
what to do, choose "486".
5252

53+
config M486SX
54+
bool "486SX"
55+
depends on X86_32
56+
---help---
57+
Select this for an 486-class CPU without an FPU such as
58+
AMD/Cyrix/IBM/Intel SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5S.
59+
5360
config M486
54-
bool "486"
61+
bool "486DX"
5562
depends on X86_32
5663
---help---
5764
Select this for an 486-class CPU such as AMD/Cyrix/IBM/Intel
58-
486DX/DX2/DX4 or SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S.
65+
486DX/DX2/DX4 and UMC U5D.
5966

6067
config M586
6168
bool "586/K5/5x86/6x86/6x86MX"
@@ -312,20 +319,20 @@ config X86_L1_CACHE_SHIFT
312319
int
313320
default "7" if MPENTIUM4 || MPSC
314321
default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU
315-
default "4" if MELAN || M486 || MGEODEGX1
322+
default "4" if MELAN || M486SX || M486 || MGEODEGX1
316323
default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
317324

318325
config X86_F00F_BUG
319326
def_bool y
320-
depends on M586MMX || M586TSC || M586 || M486
327+
depends on M586MMX || M586TSC || M586 || M486SX || M486
321328

322329
config X86_INVD_BUG
323330
def_bool y
324-
depends on M486
331+
depends on M486SX || M486
325332

326333
config X86_ALIGNMENT_16
327334
def_bool y
328-
depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MELAN || MK6 || M586MMX || M586TSC || M586 || M486 || MVIAC3_2 || MGEODEGX1
335+
depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MELAN || MK6 || M586MMX || M586TSC || M586 || M486SX || M486 || MVIAC3_2 || MGEODEGX1
329336

330337
config X86_INTEL_USERCOPY
331338
def_bool y
@@ -378,7 +385,7 @@ config X86_MINIMUM_CPU_FAMILY
378385

379386
config X86_DEBUGCTLMSR
380387
def_bool y
381-
depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486) && !UML
388+
depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486SX || M486) && !UML
382389

383390
menuconfig PROCESSOR_SELECT
384391
bool "Supported processor vendors" if EXPERT
@@ -402,7 +409,7 @@ config CPU_SUP_INTEL
402409
config CPU_SUP_CYRIX_32
403410
default y
404411
bool "Support Cyrix processors" if PROCESSOR_SELECT
405-
depends on M486 || M586 || M586TSC || M586MMX || (EXPERT && !64BIT)
412+
depends on M486SX || M486 || M586 || M586TSC || M586MMX || (EXPERT && !64BIT)
406413
---help---
407414
This enables detection, tunings and quirks for Cyrix processors
408415

@@ -470,7 +477,7 @@ config CPU_SUP_TRANSMETA_32
470477
config CPU_SUP_UMC_32
471478
default y
472479
bool "Support UMC processors" if PROCESSOR_SELECT
473-
depends on M486 || (EXPERT && !64BIT)
480+
depends on M486SX || M486 || (EXPERT && !64BIT)
474481
---help---
475482
This enables detection, tunings and quirks for UMC processors
476483

arch/x86/Makefile_32.cpu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ else
1010
tune = $(call cc-option,-mcpu=$(1),$(2))
1111
endif
1212

13+
cflags-$(CONFIG_M486SX) += -march=i486
1314
cflags-$(CONFIG_M486) += -march=i486
1415
cflags-$(CONFIG_M586) += -march=i586
1516
cflags-$(CONFIG_M586TSC) += -march=i586

arch/x86/include/asm/module.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ struct mod_arch_specific {
1515

1616
#ifdef CONFIG_X86_64
1717
/* X86_64 does not define MODULE_PROC_FAMILY */
18+
#elif defined CONFIG_M486SX
19+
#define MODULE_PROC_FAMILY "486SX "
1820
#elif defined CONFIG_M486
1921
#define MODULE_PROC_FAMILY "486 "
2022
#elif defined CONFIG_M586

0 commit comments

Comments
 (0)