Calls to Neutrino from x86 Assembly

I need to make some calls to Neutrino from x86 assembly
language (developing a set of library routines). Is there
any documentation on this?
Thanks,
Randy Hyde

Randall Hyde <randall.nospam.hyde@ustraffic.net> wrote:

I need to make some calls to Neutrino from x86 assembly
language (developing a set of library routines). Is there
any documentation on this?
Thanks,
Randy Hyde

Write a C routine that does what you want to do in ASM code and
disassemble it.

I’d be real careful about what, if any, registers will be preserved
for you.


Bill Caroselli – Q-TPS Consulting
1-(626) 824-7983
qtps@earthlink.net

The ABI for the architecture should provide you the information you require
(register useage etc).

-Adam

Bill Caroselli <qtps@earthlink.net> wrote in message
news:b40bon$mr3$2@inn.qnx.com

Randall Hyde <> randall.nospam.hyde@ustraffic.net> > wrote:
I need to make some calls to Neutrino from x86 assembly
language (developing a set of library routines). Is there
any documentation on this?
Thanks,
Randy Hyde

Write a C routine that does what you want to do in ASM code and
disassemble it.

I’d be real careful about what, if any, registers will be preserved
for you.


Bill Caroselli – Q-TPS Consulting
1-(626) 824-7983
qtps@earthlink.net

“Bill Caroselli” <qtps@earthlink.net> wrote in message
news:b40bon$mr3$2@inn.qnx.com

Randall Hyde <> randall.nospam.hyde@ustraffic.net> > wrote:
I need to make some calls to Neutrino from x86 assembly
language (developing a set of library routines). Is there
any documentation on this?
Thanks,
Randy Hyde

Write a C routine that does what you want to do in ASM code and
disassemble it.

I’d be real careful about what, if any, registers will be preserved
for you.

Maybe I should have been more specific:
I’m writing the library routines.
Calling C (or any other HLL code) is out of the question.
Obviously, this can be done because the C libraries have to do it at some
point.
Indeed, kercalls.h provides a small amount of tantalizing info, but
without knowing what the KC (kernel call?) macro does, it’s hard
to determine what the calls should be.
Randy Hyde

There’s mkkercalls.c that apparently generates assembler code from
kercalls.h

– igor

“Randall Hyde” <randall.nospam.hyde@ustraffic.net> wrote in message
news:b40lp9$595$1@inn.qnx.com

“Bill Caroselli” <> qtps@earthlink.net> > wrote in message
news:b40bon$mr3$> 2@inn.qnx.com> …
Randall Hyde <> randall.nospam.hyde@ustraffic.net> > wrote:
I need to make some calls to Neutrino from x86 assembly
language (developing a set of library routines). Is there
any documentation on this?
Thanks,
Randy Hyde

Write a C routine that does what you want to do in ASM code and
disassemble it.

I’d be real careful about what, if any, registers will be preserved
for you.


Maybe I should have been more specific:
I’m writing the library routines.
Calling C (or any other HLL code) is out of the question.
Obviously, this can be done because the C libraries have to do it at some
point.
Indeed, kercalls.h provides a small amount of tantalizing info, but
without knowing what the KC (kernel call?) macro does, it’s hard
to determine what the calls should be.
Randy Hyde

Randall Hyde <randall.nospam.hyde@ustraffic.net> wrote:

“Bill Caroselli” <> qtps@earthlink.net> > wrote in message
news:b40bon$mr3$> 2@inn.qnx.com> …
Randall Hyde <> randall.nospam.hyde@ustraffic.net> > wrote:
I need to make some calls to Neutrino from x86 assembly
language (developing a set of library routines). Is there
any documentation on this?
Thanks,
Randy Hyde

Write a C routine that does what you want to do in ASM code and
disassemble it.

I’d be real careful about what, if any, registers will be preserved
for you.



Maybe I should have been more specific:
I’m writing the library routines.
Calling C (or any other HLL code) is out of the question.
Obviously, this can be done because the C libraries have to do it at some
point.

Yes, he’s not suggesting you call the C code. He’s suggesting you
write a C function, compile it, then look at how our compiler generates
assembly to call the kernel function, and clone that into your
assembly.

It might be easier to see, of course, if you compiled with
optimisation disabled, too.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

I’m answering on the interpretation that you are writing a set of
assembly-language library routines that will need to use QNX Neutrino
services (kernel calls, proc services, pathname lookup, resource manager
services,…?), and that for whatever reason you may not call C language
code from your library.

The short answer is no, we do not supply a documented assembly-language API
for QNX Neutrino. QNX Neutrino uses a C language API.

This is probably something you already know, but just a word of warning in
case you don’t: kernel calls will be simple enough from assembly language,
but many library routines (e.g. open()) are much more than stubs for just a
kernel call or two. Just using the services provided by resource managers
involves a lot of library code, even though the communication between
service provider and application does eventually distill to an exchange of
data through kernel calls. Things like pathname resolution are embodied in
the library, and while the volume of code is not that large, it is somewhat
tricky. A starting point might be to look at
http://cvs.qnx.com/cgi-bin/cvsweb.cgi/lib/c for clues. This C source code is
now out-of-date, but is the closest thing we have to documentation on this
subject, and beats reverse-engineering.

Hope I interpreted your question correctly. %-)

  • Eric

p.s. if you’re curious about pathname resolution, check out the _connect*
functions in the support lib.


“Randall Hyde” <randall.nospam.hyde@ustraffic.net> wrote in message
news:b40lp9$595$1@inn.qnx.com

“Bill Caroselli” <> qtps@earthlink.net> > wrote in message
news:b40bon$mr3$> 2@inn.qnx.com> …
Randall Hyde <> randall.nospam.hyde@ustraffic.net> > wrote:
I need to make some calls to Neutrino from x86 assembly
language (developing a set of library routines). Is there
any documentation on this?
Thanks,
Randy Hyde

Write a C routine that does what you want to do in ASM code and
disassemble it.

I’d be real careful about what, if any, registers will be preserved
for you.

Maybe I should have been more specific:
I’m writing the library routines.
Calling C (or any other HLL code) is out of the question.
Obviously, this can be done because the C libraries have to do it at some
point.
Indeed, kercalls.h provides a small amount of tantalizing info, but
without knowing what the KC (kernel call?) macro does, it’s hard
to determine what the calls should be.
Randy Hyde