[kaffe] m68k cache flushing

Dalibor Topic robilad at kaffe.org
Sun Mar 14 14:33:03 PST 2004

Hi Tony, hi Kiyo,

sorry about the checking in the patch to fix the compiler warning on 
m68k-linux wrt __clear_cache without consulting with you guys first. I 
was confused since FLUSH_DCACHE was using __clear_cache, which is an 
internal function from libgcc2. I didn't realize the code was linux 
specific, since it was the only definition of CLEAR_INSN_CACHE for m68k 
in gcc's current sources.

After looking through the gcc sources, I found that __clear_cache was 
only exported through libgcc2.h, which apparently doesn't get installed 
by gcc. So we were delegating to a function that may not necessarily be 
a part of the interface exported by gcc.

Instead, as we need (according to the old comment) to rely on the help 
of the OS for this anyway, I'd propose moving the cache-flushing 
handling on m68k to the os-dependant jit-md.h files, like it's done for 
m68k-netbsd now. So I'd propose doing the following:

* define FLUSH_DCACHE to '?' in the general case

* move current definition and clear-cache.h to config/m68k/linux, since 
it only works on linux anyway.

* Change AmigaOS definition of FLUSH_DCACHE to use CacheClearU from 
exec.library.[1] [2] [3]. since I'm not really familliar with AmigaOS 
programming (any more), I hope Tony can try that out.

* A-UX, NextStep : Support for A-UX and NextStep has been removed from 
gcc, so __clear_cache should be defined as CLEAR_INSN_CACHE was in gcc 
[4], [5]. On the other hand, NextStep doesn't have support for jit 
anyway, so that probably doesn't matter.

* OpenBSD: no idea. There seems to be no such thing as CLEAR_INSN_CACHE 
in the sources, and they don't have a m68k_sync_icache function like 
NetBSD has. We can leave it as __clear_cache there, which is what's 
there anyway.

* SunOS4: doesn't have a jit port either, so that doesn't matter much, I 
guess. I couldn't find the corresponding gcc m68k config files for it, 

dalibor topic

[1] http://www.mways.co.uk/amiga/howtocode/text/generalguidelines.php
[2] http://amiga.nvg.org/amiga/reference/AmigaMail_Vol2_guide/node0083.html
[3] http://amiga.nvg.org/amiga/reference/AmigaMail_Vol2_guide/node0086.html

More information about the kaffe mailing list