Hi Belxjander,
Maybe I didn't describe it very well. The project is to convert 68k assembler into C that can be compiled on the A1 to native PPC code. But there are some other implied requirements, for example, it must run like greased lightning and be portable code that can be easily recompiled for the next platform that AOS is ported to.
I have translated most of the 68k assembler into ANSI C, and I use SAS/C to compile it into 68k binary. That binary runs on my A4000 and on the A1 (emulated) exactly the same way as the original assembler version. When the translation and debugging of the C version is complete, I will use GCC to compile it for PPC on the A1.
The 68k code depends on a2, a3, a6 always pointing to particular structures. That makes it quick to call a function, because those registers do not have to be set up before the call. In C, though, I have to pass the pointers as function arguments each time. I *could* define a proto that uses 68k registers, but that would be useless when I recompile the C code for the PPC. Meantime I am stuck with having to load arguments onto the stack for the simplest function call, which in the 68k assembler case, might not have to load any registers at all. Bloody slow.
So the question is really: is there a platform-independent way to allocate some registers as permanent pointers, persistent over the whole program? Has this problem come up elsewhere in OS4? What have other developers done?
cheers