lkml.org 
[lkml]   [1999]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Linux/i386 fastcall support
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/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.028 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site