Re: Linux/i386 fastcall support

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Fri, 4 Jun 1999 22:19:38 +0200


As a general rule, regparm(1) makes code smaller. Above that it stands
getting larger again. I've never timed the difference.

Konstantin Boldyshev wrote:
> I've browsed through the source and notices that main
> drawback is some assembler code.. however it can be
> easily enclosed in C functions to let compiler use specified
> calling convention instead of hardcoded one..

Much of the assembler code is declared with __fastcall: a macro saying
to pass the arguments in registers anyway!

The system calls are done with asmlinkage; you could add regparm(0) to
that so you don't have to change the assembly code, or change the code
in entry.S to put the first parameter in %eax. There are probably a few
other functions declared with asmlinkage to be considered.

A few difficult ones: the things that take `struct pt_regs' such as
sys_fork and sys_clone. They're called from entry.S and expect a stack
full of registers which can be treated as a struct pt_regs -- and they
pass the address of that to other functions. You'd need special
treatment for those.

It's probably best to start by adding regparm(0) to asmlinkage.

A few assembly things such as the semaphore code call C functions with
stack conventions -- that'd need fixing up. You can hack the semaphore
case by putting regparm(0) in the right places in the C code.

-- Jamie

-
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/