Hi John.
I'd like to take a stab at reimplementing the WindowManager module using
C/C++, in particular to make further development easier and while most of
its SWIs behave "function-like", i.e. return (directly) to their caller,
a
few do not, in particular those having to do with creating new tasks and
switching between them, such as Wimp_StartTask and Wimp_Poll.
Ambitious, but interesting and I like to hear how hear how it goes on.
Yeah, I've found as I've looked into it that it was way too ambitious
(especially as a first reimplementation project), so I'm currently gaining
experience by working on a proposed reimplementation of OS_SpriteOp, instead
(https://www.riscosopen.org/forum/forums/5/topics/731?page=2#posts-8365).
As side remark: I'm very much in favour to start using C for RISC OS
module development. Much more efficient concerning development times,
ease to refactor your code base when needed, easier to locate & fix
bugs, etc. On the other hand, such C based modules are larger than
their ARM coded counterparts but personally I don't think that should
be as relevant today as it was when we were dealing with 1M Archimedes
machines. RISC OS developer time is much more precious than runtime
memory usage IMHO.
I'm happy to hear that, and I completely agree.
FYI, Martin and I used GCCSDK 4 for our PS3 development using CMunge and
OSLib and we didn't regret it a single moment having made that choice.
Ah, interesting.
With CMunge, you define a C/C++ function to be called when a SWI is
called,
and when you return from the function, it returns from the SWI, as well.
However, in the case of Wimp_StartTask, the transfer of control is
something
like this:
(Current task) -> Wimp_StartTask ("e.g. *SomeWimpTask) (This probably
pages
out the "Current task" from &8000, sets up &8000 with the amount of money
specified in the "Next" slot, and issues the command, *SomeWimpTask) ->
SomeWimpTask -> OS_Exit/Wimp_Poll -> Set up original task context and
return
from Wimp_StartTask.
This doesn't look like a function call to me... :)
Does anyone have any ideas of how one might implement such SWIs, without
having to do them in ARM assembly, in order to store the return address,
set
up context for the new task, etc.?
CMunge's generated code does not really care about your function returning
or not. I.e. just realise that your C function is called using
SVC stack on which your local variables are being stored and feel free
to call any SWIs including OS_Exit (you can tag such function with
GCC's __attribute__ ((noreturn)) to tune the generate code).
<snip>
Thanks for the info and OSLib library tips, I'll check it out.
Regards,
Terje
_______________________________________________
GCCSDK mailing list [email protected]
Bugzilla: http://www.riscos.info/bugzilla/index.cgi
List Info: http://www.riscos.info/mailman/listinfo/gcc
Main Page: http://www.riscos.info/index.php/GCCSDK