
From: Andi Kleen <ak@muc.de>

Using -mregparm=3 shrinks the kernel further:

(compiled with gcc 3.4, without -funit-at-a-time, using the later and
together with -Os shrinks .text even more, making over 700KB difference) 

4129346  708629  207240 5045215  4cfbdf vmlinux
3892905  708629  207240 4808774  496046 vmlinux-regparm

This one helps even more, >236KB .text difference. Clearly worth
the effort.

This patch adds an option to use -mregparm=3 while compiling the kernel.  I
did an LTP run and it showed no additional failures over an non regparm
kernel.

According to some gcc developers it should be safe to use in all gccs that
are still supports (2.95 and up) 

I didn't make it the default because it will break all binary only modules
(although they can be fixed by adding a wrapper that calls them with
"asmlinkage").  Actually it may be a good idea to make this default with
2.7.1 or somesuch.



---

 25-akpm/arch/i386/Kconfig  |    8 ++++++++
 25-akpm/arch/i386/Makefile |    2 ++
 2 files changed, 10 insertions(+)

diff -puN arch/i386/Kconfig~add-config-for-mregparm-3 arch/i386/Kconfig
--- 25/arch/i386/Kconfig~add-config-for-mregparm-3	Wed Jan 14 14:58:43 2004
+++ 25-akpm/arch/i386/Kconfig	Wed Jan 14 14:58:43 2004
@@ -813,6 +813,14 @@ config BOOT_IOREMAP
 	depends on (((X86_SUMMIT || X86_GENERICARCH) && NUMA) || (X86 && EFI))
 	default y
 
+config REGPARM
+	bool "Use register arguments (EXPERIMENTAL)"
+	default n
+	help
+	Compile the kernel with -mregparm=3. This uses an different ABI
+	and passes the first three arguments of a function call in registers.
+	This will probably break binary only modules.
+
 endmenu
 
 
diff -puN arch/i386/Makefile~add-config-for-mregparm-3 arch/i386/Makefile
--- 25/arch/i386/Makefile~add-config-for-mregparm-3	Wed Jan 14 14:58:43 2004
+++ 25-akpm/arch/i386/Makefile	Wed Jan 14 14:59:12 2004
@@ -68,6 +68,8 @@ cpuflags-$(CONFIG_CPU_386)	:= -march=i38
 # AMD Elan support
 cpuflags-$(CONFIG_X86_ELAN)	:= -march=i486
 
+cflags-$(CONFIG_REGPARM) 	+= -mregparm=3
+
 CFLAGS += $(cpuflags-y)
 
 # Default subarch .c files

_
