Re: Kernel Calling Conventions
- From: spamtrap@xxxxxxxxxx
- Date: 22 Mar 2006 20:13:54 -0800
Kroll wrote:
Greetings all,
I was reading the "FreeBSD Assembly Language Programming" tutorial
(http://www.int80h.org/bsdasm/), when I came across something that
piqued my curiosity.
The C calling convention is touted as being more convenient, and
superior to the calling convention used by linux and microsoft of
passing arguments within registers. I was wondering if this is just a
bias on the part of the writer or what.
What are the actual advantages of popping the arguments onto to the
stack as opposed to passing them via registers?
Thanks in advance, :)
Kyle
None have mentioned that passing arguments on the stack allows
recursive function calls - each iteration has its own stack frame.
This concept extends to reentrant procedures as each invocation also
maintains its state in each stack frame. Another way to put it is:
what is the scope of register variables? Register variables are
preferred for speed but only if you can prove they won't lose scope.
The stack is an abstract data type which can be implemented on nearly
all processor platforms, so passing parameters on the stack lends to
portability. Registers' type, size and use; are platform specific and
thus don't lend themselves to portability across platforms.
.
- References:
- Kernel Calling Conventions
- From: Kroll
- Kernel Calling Conventions
- Prev by Date: Re: ld dynamic linker x86-64 ?!
- Next by Date: Re: ld dynamic linker x86-64 ?!
- Previous by thread: Re: Kernel Calling Conventions
- Next by thread: Re: Kernel Calling Conventions
- Index(es):
Relevant Pages
|