[PATCH] Support new egcs/pgcc -mpentium(pro) options

Matthias Andree (mandree@sx1.HRZ.Uni-Dortmund.DE)
Sun, 13 Dec 1998 05:26:43 +0100


--YiEDa0DAkWCtVeE4
Content-Type: text/plain; charset=us-ascii

Hello penguinoids,

I have wrote a small patch against 2.1.131-ac9 which implements the
promised enhanced support for the new egcs/pgcc i386 target submodel
options such as -mpentium, -mpentiumpro, -march=pentium and
-march=pentiumpro.

The patch should be pretty self-explanatory and touches:
+++ linux-2.1.131-ac9-ma/Documentation/Configure.help Sun Dec 13 05:15:06 1998
+++ linux-2.1.131-ac9-ma/arch/i386/Makefile Sun Dec 13 05:14:09 1998
+++ linux-2.1.131-ac9-ma/arch/i386/config.in Sun Dec 13 05:14:21 1998

Some questions left:

1. Does gcc 2.8 support the aforementioned options?

2. What is the minimum egcs/pgcc version for these options?

3. What is the reason a 486 configured kernel will not run on the 386?
It's evidently not the compiler as far as I can tell from my
gcc-2.7.2.x/pgcc-1.1.1 documentation.

And *please*, do check the Configure.help if the contents are correct.
There are probably some gcc/egcs/pgcc gurus out there which can comment
on for-/backwards compatibility, particularly in context with the
-march= option.

Please Cc: your answers/comments.

Happy compiling,

-- 
Matthias Andree

--YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=patch-to-support-386-submodel

diff -r -u linux-2.1.131-ac9/Documentation/Configure.help linux-2.1.131-ac9-ma/Documentation/Configure.help --- linux-2.1.131-ac9/Documentation/Configure.help Sun Dec 13 04:46:14 1998 +++ linux-2.1.131-ac9-ma/Documentation/Configure.help Sun Dec 13 05:15:06 1998 @@ -129,6 +129,29 @@ If you are not sure, say Y; apart from resulting in a 45 KB bigger kernel, it won't hurt. +Set compiler to use new i386 submodel options +CONFIG_EGCS_NTSO + If your compiler supports the new i386 submodel options -mpentium or + -mpentiumpro - like egcs-1.1.1 does - you can enable this switch to + take advantage of this new feature. The code will remain 486 compatible + unless you set CONFIG_EGCS_UARCH. + + If your compiler supports it, say Y. Otherwise, say N. (If your + compiler does not support it, the kernel build will fail.) + +Set compiler to use march instead of m +CONFIG_EGCS_UARCH + If your compiler supports the new i386 submodel options -march=CPU + AND you want the kernel to support ONLY the CPU type it was + configured and compiled for, you may say Y here. + + Otherwise, or if unsure, say N. (If your compiler does not support + it, the kernel build will fail.) + + Note that this option breaks support for other CPU types than + configured, because the compiler uses instructions specific to the + CPU type configured above, so use with care. + Normal PC floppy disk support CONFIG_BLK_DEV_FD If you want to use the floppy disk drive(s) of your PC under Linux, diff -r -u linux-2.1.131-ac9/arch/i386/Makefile linux-2.1.131-ac9-ma/arch/i386/Makefile --- linux-2.1.131-ac9/arch/i386/Makefile Mon Jul 20 19:05:15 1998 +++ linux-2.1.131-ac9-ma/arch/i386/Makefile Sun Dec 13 05:14:09 1998 @@ -12,6 +12,9 @@ # # Copyright (C) 1994 by Linus Torvalds # +# Enhanced 586/686 target submodel options added and +# Copyright (C) 1998 by Matthias Andree. +# LD=$(CROSS_COMPILE)ld -m elf_i386 CPP=$(CC) -E @@ -28,9 +31,32 @@ endif ifdef CONFIG_M486 +ifdef CONFIG_EGCS_UARCH +CFLAGS := $(CFLAGS) -march=i486 -DCPU=486 +else CFLAGS := $(CFLAGS) -m486 -DCPU=486 endif +endif + +ifdef CONFIG_EGCS_NTSO +ifdef CONFIG_EGCS_UARCH +ifdef CONFIG_M586 +CFLAGS := $(CFLAGS) -march=pentium -DCPU=586 +endif + +ifdef CONFIG_M686 +CFLAGS := $(CFLAGS) -march=pentiumpro -DCPU=686 +endif +else +ifdef CONFIG_M586 +CFLAGS := $(CFLAGS) -mpentium -DCPU=586 +endif +ifdef CONFIG_M686 +CFLAGS := $(CFLAGS) -mpentiumpro -DCPU=686 +endif +endif +else ifdef CONFIG_M586 CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586 endif @@ -38,6 +64,8 @@ ifdef CONFIG_M686 CFLAGS := $(CFLAGS) -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=686 endif +endif + HEAD := arch/i386/kernel/head.o arch/i386/kernel/init_task.o diff -r -u linux-2.1.131-ac9/arch/i386/config.in linux-2.1.131-ac9-ma/arch/i386/config.in --- linux-2.1.131-ac9/arch/i386/config.in Sun Dec 13 04:46:14 1998 +++ linux-2.1.131-ac9-ma/arch/i386/config.in Sun Dec 13 05:14:21 1998 @@ -16,6 +16,14 @@ 486/Cx486 CONFIG_M486 \ Pentium/K5/5x86/6x86 CONFIG_M586 \ PPro/K6/6x86MX CONFIG_M686" Pentium +if [ "$CONFIG_M386" = "n" ] ; then + if [ "$CONFIG_M486" = "n" ] ; then + bool 'Use new pentium(pro) submodel options (see help!)' CONFIG_EGCS_NTSO + fi + if [ "$CONFIG_M486" = "y" -o "$CONFIG_EGCS_NTSO" = "y" ] ; then + bool 'Use -march=CPU instead of -mCPU (see help!)' CONFIG_EGCS_UARCH + fi +fi bool 'Math emulation' CONFIG_MATH_EMULATION if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then bool 'MTRR (Memory Type Range Register) support' CONFIG_MTRR

--YiEDa0DAkWCtVeE4--

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/