[kaffe] COMPARE_AND_EXCHANGE with m68k
Mon Feb 24 20:15:01 2003
I've been playing with the m68k Amiga version of kaffe. There is a proble=
with the 1.0.7 release for the Amiga m68k (for Linux m68k also):
The COMPARE_AND_EXCHANGE macro as defined in /config/m68k/common.h uses t=
"casl" instruction to perform an atomic compare and exchange - this requi=
res the old and new
data to be in data registers. There are three calls to this macro, all in=
/kaffevm/locks.c: two of them use constants as macro arguments, the third=
The compiler optimisation generates code using data registers for the fir=
two calls, which work OK. However, the compiler uses address registers in=
third macro expansion, with the result that the assembler throws a tantru=
with an "illegal address mode".
To get over the problem, I tried casting the pointers to uint32, but the
compiler still left the addresses in data registers. To get it running, I=
then split up the macro into two macros of different names, to be used in=
the two contexts. I defined two macros in the m68k config only.
Clearly this can not be put into the source tree, and with Dalibor snappi=
at my heels to post my patches, I am asking for help. I can see two ways =
of this, can anyone suggest the best way?
(1) Alter the macro so that the arguments are always forced into data
registers. I have tried a couple of ways, but the compiler seems to
re-allocate registers as it sees fit.
(2) Alter the macro calls (perhaps with a function prototype?) so that th=
compiler is expecting a uint in the macro argument. This ought to be "siz=
(void *)" and is then non-portable because of differing address sizes on =