Direct Linux syscalls

From: Beth (BethStone21_at_hotmail.NOSPICEDHAM.com)
Date: 12/18/04


Date: Sat, 18 Dec 2004 03:20:23 GMT

Hi,

    I presume I've got the right place to ask for this...kind of "low
level" stuff, though...

Anyway...basically, programming Linux with assembly language using the "int
80h" interface directly, I'm confused by lots of different accounts of how
it works on different webpages all over the 'Net...

Apparently, with the 2.4 kernel (at least, I think it was that version
number...if not, which one was it? ;), the EBP register was added as
another register available for passing parameters to the "int 80h" system
call...

And what's confusing me is, with a 6 parameter call like "mmap", does it
now use the EBP register for the 6th parameter...OR does it still use the
old non-EBP calling style for "backwards compatibility"? Some pages I read
on the 'Net seem to "suggest" one, some the other (and none actually
address the issue directly...hence, asking around here, on the off-chance
someone might know :)...

When EBP was added as another useable register for "INT 80h", was this a
"retroactive" addition (that is, _all_ syscalls now go by the new EBP
interface) or was it only a new thing for post-2.4 syscalls (a "backwards
compatible" thing that older calls stay with the older interface but all
the newer calls have been "updated" with the new style interface)?

In other words, with a post-2.4 kernel, should I be putting the parameters
into registers including EBP for "mmap"...or is it still "stick it in
memory and pass a pointer to it in EBX", despite the changes to add EBP?

If it is the case that older calls use the older interface and newer calls
use the newer interface then the question that stems from that is, of
course, where is it documented with which kernel versions various syscalls
were added? You know, so that I can work out which syscalls need the new
interface and which are still on the old interface...

Although, in fact, any reference which explains which syscalls were added
with which kernel version would be a useful thing anyway (you know, to know
what syscalls are valid for which kernels and such more generally :)...

Just trying to compose some NASM include files and macros which can
"automate" making the system calls, you see...but it's actually rather
difficult to get useful information on this "low level" aspect because so
many people just stick with using the C interface (and, no, I don't need
the lecture on why you should use the C interface for "portability"...what
I need to do is _specific_ to Linux so "portability" is simply NOT an issue
and it's in assembly language for assembly language...so, I do understand
the benefits of the C interface but it's just "not applicable" in this
particular case :)...

Beth :)


Quantcast