[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OS calls.

Before I start this one, I'd like to point out that I'd never have landed m
current job (writing satellite telemetry systems, and working on
communications RTU's) if it wasn't for my trusty STe and MiNT. They're the
closest in design to the systems that we're working with, and the ST on my
desk at work enables us to test a lot of the code that we're working with
before we transfer it to the embedded system on the RTU.

Now, we're using an mc68360 for the core processor, and speed is an issue.
We've gotten a lot of good ideas from MiNT about how best to keep up with
hundreds (and occasionally thousands) of digital and analogue
state-changes per second. While AMX actually provides the core, MiNT
concepts have provided usable front-ends to many AMX functions, and we've
completely replaced large chunks of AMX with our own code.

Post development comparison was quite enlightening. Given the same basic
problems, it was nice to see that MiNT and AOS (our own kernel) generated
fundamentally similar solutions to the same basic problems. Without
actually using any MiNT code, the results are still distinctly similar.
This suggests that there are many things about the solutions that are in
some way optimal, with certain preconditions.

One thing that was an issue was the speed of the call-gates. Even with a
fixed stack-frame size (while the '360 is pretty much an '020, the stack
frame is the size of an '030 frame), trap calls became quite expensive to
run, especially on heavy use. We hacked away at this for several days, and
finally came up with a call-gate using the line-A vector (and some stack
processing magic) that improved the speed _considerably_, and reduced the
code-size required per syscall. (Note: The '360 does not have line-F, as
those are used for the table opcodes).

Now, I'm toying with a draft 'fastcall' spec, which would allow
fastcall-aware programs to drastically cut the overhead of system calls if
a fastcall driver was installed. It would really only work with the line-A
or line-F vectors (due to some of the heavenly things that Motorola did
with their design). Line-A is still in use (though it was intended to be
long gone by now), but what about line-F? Is it actually used for anything

Support for fastcalls could be easily patched into the mintlibs, and a
simple test and branch used to access fastcalls over slowcalls.
Alternatively, a fastcall-only program would be smaller and faster than a
slowcall program.