For the past couple of weeks I've been busy porting HLA (the High Level
Assembler) to FreeBSD. Actually, the assembler itself was more or less
ported a year ago, for the past couple of weeks I've been doing the *real*
work which was porting the HLA standard library to FreeBSD. That work is
almost complete and the library is currently passing all the unit tests,
I have a few questions about (native) API calls under FreeBSD. In
particular, I've yet to find any documentation that explains how to call API
functions (like lseek, pread, etc.) that have 64-bit arguments such as off_t
arguments. I did find the following cryptic message in the man page for
"The __syscall() form should be used when one or more of the arguments is a
64-bit argument to ensure that argument alignment is correct."
However, nowhere have I been able to find out what "argument alignment"
should be. By just sticking in arbitrary PUSH instructions, I've been able
to get lseek to function for me, but I've never been able to so the same
with pread (btw, I got lseek working by making a __syscall).
What I'd really like to learn here is how I have to set up the stack to make
calls to functions that have 64-bit parameters.
Three quick comments to save you some time:
1) Don't bother pointing me at the "FreeBSD Assembly HOWTO". It should be
pretty obvious that I've looked at that a *long* time ago and the basic
information it provides does not come close to addressing this issue.
2) Please don't suggest that I should go in and read FreeBSD source code to
figure this kind of stuff out. I have no desire to do this and I don't
believe that application/library developers should have to grok the inner
workings of the OS in order to do simple things like make OS API calls.
3) Please don't suggest that I call the C standard library to do this work.
*I'm* writing the library code for my own compiler and my calling sequences
and run-time environment are not particularly compatible with GNU's. So
making glib calls is out of the question.