Re: Kernel Calling Conventions



Kroll <spamtrap@xxxxxxxxxx> wrote in part:
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.

IMHO, "bias" is too mild a word :)

Regs vs stack is a much closer argument for userspace
lib calls. For kernel transitions, registers are _much_
easier: when transitioning from ring3 (userland) to ring0
(kernelspace), a stack switch is done. At the very least,
the old pointer would have to be recalled to fetch the params.
And some work with the LDT may be necessary to recover the
process' memory mapping. I don't recall whether these are
reset on transition.

The main advantage of stack params is that many more
can be passed.

-- Robert

.



Relevant Pages

  • WTB: Standalone Digital-to-analog converter
    ... Someone here was selling a stack of Lucid gear that I seem to recall ... included a D-A converter, ...
    (rec.audio.pro)
  • Re: HP49G Sysrpl help with recalling contents of pointers
    ... I wish to recall the contents of e.g. C%SIN to the stack ... during runtime (in order to modify the composite) and then use it. ... Where PTR 0FEDA splits a C% into two extended reals. ... In this case I already have two extended reals on the stack, ...
    (comp.sys.hp48)
  • Re: debugging a multi-threaded program on linux.
    ... > If you use GNU C I'm certain there is a way to get a sort of stack ... > trace. ... I recall a thread about it. ...
    (comp.unix.programmer)
  • Re: Variable number of arguments
    ... Richard Maine wrote: ... It messes up the ... stack or some such thing. ... I recall having problems with that on some Sun ...
    (comp.lang.fortran)
  • Re: How can I get MM 2.1 back?!?
    ... Plus doesn't contain MM - just some effects and transitions as I recall. ... idiot, went and installed an old copy of Plus! ... How can I fix this? ...
    (microsoft.public.windowsxp.moviemaker)