Subject: Re: Kernel calls - args in registers
To: Travis Hassloch x231 <>
From: Michael Smith <>
List: tech-kern
Date: 11/20/1996 10:52:03
Travis Hassloch x231 stands accused of saying:
> One thing I thought might make a worthwhile gain is to make all
> intrakernel calls use registers -- and if possible, all kernel calls.

I think Bruce will have opinions here, but IMHO using registers for
arg passing isn't much of a win, especially on the x86 where there
are so few of them.  

Register args win when the callee doesn't have to use the registers the
args are in until they're needed.  On the x86, it's more likely that
the callee will need the registers and thus have to save the args somewhere
else (like on the stack...), and thus lose worse.

Another issue is stack unwinding; it's a real pain in the backside to
unwind a stack that includes calls to functions taking register args;
either the function saves the register args on the stack before the
return address before calling out the first time, or you live with not
being able to get the value of the arguments.

Either way, I don't think that the improvements would be significant
enough to be worth the effort.  YMMV, especially on the 68K and some
RISC targets where there are enough registers to make this worthwhile.

> Obviously this would require rewriting a bit of the system call
> dispatch code.  The next obvious step would be to change the
> system call structure so that copying a stack around wasn't necessary
> on most system calls.

Um, I don't actually think that the stack is 'copied around' in the first
place, and you'd still have to keep most of it because not all your
syscall args are going to fit in your registers.

]] Mike Smith, Software Engineer             [[
]] Genesis Software                       [[
]] High-speed data acquisition and      (GSM mobile)     0411-222-496   [[
]] realtime instrument control.         (ph)          +61-8-8267-3493   [[
]] Unix hardware collector.             "Where are your PEZ?" The Tick  [[