2004-10-05 22:58:32

by Richard B. Johnson

[permalink] [raw]
Subject: Linux-2.6.5-1.358 SMP


Hello,

I almost have everything converted over from 2.4.26 to
2.6.whatever.

I need to make some modules that have lots of assembly code.
This assembly uses the UNIX calling convention and can't be
re-written (it would take many months). The new kernel
is compiled with "-mregparam=2". I can't find where that's
defined. I need to remove it because I cannot pass parameters
to the assembly stuff in registers.

Where is it defined??? I grepped through all the scripts and
the hidden files, but I can't discover where it's defined.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.


2004-10-05 23:08:45

by Jan Dittmer

[permalink] [raw]
Subject: Re: Linux-2.6.5-1.358 SMP

Richard B. Johnson wrote:
> Hello,
>
> I almost have everything converted over from 2.4.26 to
> 2.6.whatever.
>
> I need to make some modules that have lots of assembly code.
> This assembly uses the UNIX calling convention and can't be
> re-written (it would take many months). The new kernel
> is compiled with "-mregparam=2". I can't find where that's
> defined. I need to remove it because I cannot pass parameters
> to the assembly stuff in registers.
>
> Where is it defined??? I grepped through all the scripts and
> the hidden files, but I can't discover where it's defined.

You don't mean CONFIG_REGPARM=n:

arch/i386/Makefile:cflags-$(CONFIG_REGPARM) += $(shell if [
$(GCC_VERSION) -ge 0300 ] ; then echo "-mregparm=3"; fi ;)

?

Jan

2004-10-05 23:12:06

by Nathan Bryant

[permalink] [raw]
Subject: Re: Linux-2.6.5-1.358 SMP

Richard B. Johnson wrote:
> Hello,
>
> I almost have everything converted over from 2.4.26 to
> 2.6.whatever.
>
> I need to make some modules that have lots of assembly code.
> This assembly uses the UNIX calling convention and can't be
> re-written (it would take many months). The new kernel
> is compiled with "-mregparam=2". I can't find where that's
> defined. I need to remove it because I cannot pass parameters
> to the assembly stuff in registers.
>
> Where is it defined??? I grepped through all the scripts and
> the hidden files, but I can't discover where it's defined.

In the 2.6.8 that's shipping in Fedora, it's a config option: CONFIG_REGPARM

2004-10-05 23:16:26

by Richard B. Johnson

[permalink] [raw]
Subject: Re: Linux-2.6.5-1.358 SMP

On Wed, 6 Oct 2004, Jan Dittmer wrote:

> Richard B. Johnson wrote:
> > Hello,
> >
> > I almost have everything converted over from 2.4.26 to
> > 2.6.whatever.
> >
> > I need to make some modules that have lots of assembly code.
> > This assembly uses the UNIX calling convention and can't be
> > re-written (it would take many months). The new kernel
> > is compiled with "-mregparam=2". I can't find where that's
> > defined. I need to remove it because I cannot pass parameters
> > to the assembly stuff in registers.
> >
> > Where is it defined??? I grepped through all the scripts and
> > the hidden files, but I can't discover where it's defined.
>
> You don't mean CONFIG_REGPARM=n:
>
> arch/i386/Makefile:cflags-$(CONFIG_REGPARM) += $(shell if [
> $(GCC_VERSION) -ge 0300 ] ; then echo "-mregparm=3"; fi ;)
>
> ?

Okay. Thanks. I wouldn't have guessed what to look for.



Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.

2004-10-05 23:47:29

by Roland Dreier

[permalink] [raw]
Subject: Re: Linux-2.6.5-1.358 SMP

Richard> I need to make some modules that have lots of assembly
Richard> code. This assembly uses the UNIX calling convention and
Richard> can't be re-written (it would take many months). The new
Richard> kernel is compiled with "-mregparam=2". I can't find
Richard> where that's defined. I need to remove it because I
Richard> cannot pass parameters to the assembly stuff in
Richard> registers.

You should be able to use CONFIG_REGPARM to control this. Another
option is just to mark the functions in your source as "asmlinkage"
(which is defined to "__attribute__((regparm(0)))" in
asm-i386/linkage.h). The advantage of using asmlinkage is that your
code will work with anyone's kernel.

- Roland

2004-10-06 00:01:58

by Richard B. Johnson

[permalink] [raw]
Subject: Re: Linux-2.6.5-1.358 SMP



On Tue, 5 Oct 2004, Roland Dreier wrote:

> Richard> I need to make some modules that have lots of assembly
> Richard> code. This assembly uses the UNIX calling convention and
> Richard> can't be re-written (it would take many months). The new
> Richard> kernel is compiled with "-mregparam=2". I can't find
> Richard> where that's defined. I need to remove it because I
> Richard> cannot pass parameters to the assembly stuff in
> Richard> registers.
>
> You should be able to use CONFIG_REGPARM to control this. Another
> option is just to mark the functions in your source as "asmlinkage"
> (which is defined to "__attribute__((regparm(0)))" in
> asm-i386/linkage.h). The advantage of using asmlinkage is that your
> code will work with anyone's kernel.
>
> - Roland
>

Ahah! I just put that in the headers that define the functions??

2004-10-06 00:30:42

by Roland Dreier

[permalink] [raw]
Subject: Re: Linux-2.6.5-1.358 SMP

root> Ahah! I just put that in the headers that define the functions??

I'm not enough of a gcc expert to know for sure, but I think you need
it in both the functions and the actual source. You can grep the
kernel source for "asmlinkage" to find dozens of examples of its use.

- Roland