[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: building kernel

On Fri, Nov 29, 2002 at 03:14:21AM +0300, Alexander Kotelnikov wrote:
> Can anyone tell me, why linux kernel is built with -mno-fp-regs and 
> -Wa,-mev6, (see linux/arch/alpha/Makefile).

The switch "-mno-fp-regs" is used to tell the compiler not to use any
FP registers FOR ANY PURPOSE in the code it is generating. The primary
reason for this is because the kernel does not currently (though it
could) SAVE or RESTORE the FP registers EXCEPT during task switching.
During normal interrupt processing, the FP registers are not saved or
restored; if there were kernel code that modified the FP registers,
they WOULD need to be saved or restored for EVERY interrupt. This would
significantly increase the amount of time spent during this operation.

Even though the kernel does not need to do any explicit FP operations
during normal operation, if GCC were not told NOT to generate any FP
instructions, it might well do so under certain circumstances, such as
running out of temporary integer registers during code generation of
complex expressions, or just because it was trying to keep as many
things in registers to optimize execution time.

> The strange thing is that I have configured kernel for my Miata system
> (600ua), which is ev56, even it seems kernel is _always_ linked for ev6
> CPU.

The flag "-Wa,-mev6" is a flag to the ASSEMBLER, not the compiler. It
indicates that the assembler should allow and process all instructions
up to and including EV6-specific ones. This is necessary when
generating a GENERIC kernel, as there are assembly sequences that need
to be present for EV6 machines.

When it is desireable to generate code for a specific CPU, for example
EV56 on MIATA, one would use the flag "-mcpu=ev56". This informs the
compiler that it is OK to use instructions that appear on EV56 and may
not have existed on earlier CPUs, such as byte or short LOAD or STORE.
This can be extremely beneficial to performance, both in speed of
execution and size of the executable, though the latter is much less
of a factor in most cases that aren't sensitive to instruction cache

> It is also interesting, when -mno-soft-float and -mfp-reg are essential
> and not dangerous. Kernel built with -mno-soft-float -mfp-regs -Wa,mev6
> oops'es at boot time, without -Wa,mev6 system boots but many programs do
> not work.

Sorry, I'm not sure what is going on with those flags.

> BTW, what for kernel is built with -ffixed-8?

That indicates to the code generator that register 8 has a FIXED
usage, and is NEVER to be used for general code. In the case of the
Linux kernel on the Alpha, it is used as a global register pointer to
the current task data structure; references to fields of that data
structure are an extremely common occurrence in the kernel, and this
is the way we can optimize these operations, by keeping the value in
a register.


Jay A Estabrook                            HPTC - LINUX support
Hewlett-Packard Company - MRO1-2/K15       (508) 467-2080
200 Forest Street, Marlboro MA 01752       Jay.Estabrook@hp.com

Reply to: