[Freemint-list] What's wrong with this code?

Thorsten Otto admin at tho-otto.de
Thu Aug 17 21:03:44 MSD 2017

On Donnerstag, 17. August 2017 14:10:09 CEST Miro Kropáček wrote:
> pc16550.c:1852:10: error: memory input 0 is not directly addressable

Those are because of the %0+4 etc in the asm, that does not work. The solution 
there would be to pass intr_iovar[0] etc instead of doing the arithmetic in 
the asm.

>pc16550.c:1852:28: error: memory input 1 is not directly addressable

Thats seems be a oversight in the m68k constraints. There is no constraint for 
specifying symbolic references for calls, like in other backends. Whatever i 
try, i either get that error or output like "bsr #_pc16550_int" which is 
nonsense of course. Could be solved by loading the address of the function 
into a register first, and passing that as input.

Your patch wouldn't have worked anyway. The functions are interrupt functions, 
and the declaration of the input parameters might generate code that loads 
those values into registers first (generating code to save/restore these), but 
the inline asm does a rte already.

I have attached a patch that should solve this (relative to your patch since 
it was already applied to master). It also gets rids of that hackish 
pc16550_intx function whose only purpose was to hide the other functions.


PS.: i think most of the asm stuff can be totally eliminated.  There is no 
need to save/restore d2/a2 in the interrupt handler, because that will be done 
also in the called function. But i cannot test this, so i left it as it is.

PPS: some day someone should go and translate all those german comments, also 
in a lot of other source files...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pc16550.patch
Type: text/x-patch
Size: 4133 bytes
Desc: not available
Url : http://mail.atariforge.org/pipermail/freemint-list/attachments/20170817/426429ef/attachment.bin 

More information about the Freemint-list mailing list