Acorn Arcade forums: Programming: 32bit SWI handler
|
32bit SWI handler |
|
sirbod (17:51 13/5/2013) jeff-doggett (06:47 14/5/2013) sirbod (16:55 15/5/2013) jeff-doggett (06:54 16/5/2013) PaulV (14:19 16/5/2013)
|
|
Jon Abbott |
Message #122382, posted by sirbod at 17:51, 13/5/2013 |
Member
Posts: 563
|
Are there any examples of how to code a 32bit SWI handler for modules?
Does the RO SWI dispatcher for example handle resetting the flags? Or does the module have to store/restore CPSR and return direct to the caller?
The obvious way of doing it would be if RO called the module with SPSR and R14 set and the module exits with "MOVS PC, R14" making it both 26 and 32 bit compatible - I doubt it's that simple though! |
|
[ Log in to reply ] |
|
Jeff Doggett |
Message #122383, posted by jeff-doggett at 06:47, 14/5/2013, in reply to message #122382 |
Member
Posts: 21
|
SWI's no longer preserve the flags.
See http://www.iyonix.com/32bit/32bitTech.shtml
Jeff |
|
[ Log in to reply ] |
|
Jon Abbott |
Message #122386, posted by sirbod at 16:55, 15/5/2013, in reply to message #122383 |
Member
Posts: 563
|
Thanks, for 26/32bit compatibility I've gone with the following SWI exit code:
TEQ PC, PC MOVEQ PC, R14 MOVS PC, R14 |
|
[ Log in to reply ] |
|
Jeff Doggett |
Message #122387, posted by jeff-doggett at 06:54, 16/5/2013, in reply to message #122386 |
Member
Posts: 21
|
Personally, I wouldn't bother writing new modules to be 26 bit compatible, because no-one in their right mind would write 26 bit only code to call it these days, unless of course it's emulating legacy stuff.
[Edited by jeff-doggett at 07:55, 16/5/2013] |
|
[ Log in to reply ] |
|
Paul Vernon |
Message #122389, posted by PaulV at 14:19, 16/5/2013, in reply to message #122387 |
Member
Posts: 135
|
But when it's for a project that needs to support 26 and 32-bit hardware, it's a must do.
http://www.iconbar.co.uk/forums/viewthread.php?threadid=11919
Paul |
|
[ Log in to reply ] |
|
|
Acorn Arcade forums: Programming: 32bit SWI handler |