[fpc-pascal] syscalls and fpc

Marco van de Voort marcov at stack.nl
Sat Feb 16 01:31:46 CET 2008

> On Feb 16, 2008 2:00 AM, Marco van de Voort <marcov at stack.nl> wrote:
> > > way it assumes the number of parameters and also the type of them, so
> > > as I asked before, how I can either call the syscall command without
> > > assembler, or how I can pass an array of const (prior to that I asked
> > > regarding array of TSysParam) to assembly if three is no other way to
> > > use syscall ?
> >
> > So we can write you up as volunteer to write up prototypes (and worse
> > maintain them) for about 300 calls per OS per arch?
> So what you are saying is, that because there are many commands that
> can be used by syscall, you prefer to give support only to the ones
> that actually in use by most programs, rather then to write something
> more general that will support everything, and will do it right ?

There is no need to support all of them in the first place, and with formal
typing and support, also maintaining the structs come into play, making a
testsuite etc. Nothing that supports everything is easy, and nothing is ever
exactly right once reality comes crashing in, except the helicopter view
before actually getting your hands wet.
> Sorry but I still don't understand... The problem is the
> design/approach of the way syscall is implemented in FPC, while you
> are saying that because there are so many OS/commands that each use it
> differently, you just want to leave it as-is because it works for you

No, because it works period. 

> So according to what you say, I can either mark that there is no
> support for syscall in FPC (half work for most of the times is not
> enough, it's just wrong desgin), or I don't understand whats going on.

I still haven't the faintest clue what your problem actually is, aside from
style issues. Sure it is not the neatest solution, but neither are syscalls
in general. 

gcc solves it slightly better with heaps of macros and custom calling
conventions, a luxury that we don't have. And different per OS-arch
combination too. Moreover, there are multiple teams involved there (the
respective kernel teams, glibc, kernel), and we have to do it ourselves.

Moreover since more and more subsystems use functionality in libc that is
more than a mere wrapper (unicode is getting more popular, the
authentication and resolving systems get increasingly complicated due to
security), and duplicating that on bare bones syscalls is both an awful lot
of hard to get right work, and a security risk.

But if you want me to get you of the "maintain calls" list, and put you onto
the "create custom calling conventions by having directives that can assign
each and other param to a precies reg" list, by all means, say so. I'd be
happy to. I can write you up for the native unicode list and to fix netdb
too if you wish.

More information about the fpc-pascal mailing list