Re: Don't save registers during system calls

Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
17 Apr 1998 11:48:33 +0200


Alexander Kjeldaas <astor@guardian.no> writes:

|> There is currently an interesting thread on comp.arch discussing
|> whether we really need to save registers during system calls. It seems
|> that this is not requires and could save a few % on RISCs.

|> In Linux, it seems like this means moving the register-saving from
|> arch/*/kernel/entry.S to include/asm-*/system.h and the switch_to
|> macro. In addition, you have to scramble clobber registers on exit
|> from the kernel in entry.S, but that's a very fast operation. You only
|> save registers when you switch the currently runnig task on a
|> processor, not when crossing the kernel<->user-level boundary. This is
|> only beneficial if the number of switches inside the kernel is lower
|> than the number of system-calls which I assume is true. This isn't
|> much point in doing on x86, but for RISCs and merced it could be
|> interesting.

FWIW, the m68k port already essentially does this. On kernel entry it
only saves the registers that are call-clobbered in C (plus the registers
that contain the syscall arguments so that they can be accessed through
the normal C argument passing), the rest are only implicitly saved in the
normal stack frames and during context switch. Since the m68k has many
more registers than the ix86 this is a real win.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.informatik.uni-dortmund.de              completely different"
schwab@gnu.org

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu