Subject: Re: Flushing the I-cache from user mode?
To: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
From: Nyef <nyef@softhome.net>
List: port-mac68k
Date: 03/28/2001 11:31:22
On Wed, 28 Mar 2001, Hauke Fath wrote:

> At 5:38 Uhr +0200 28.3.2001, Nyef wrote:
> >Hello all,
> >
> >I'm considering writing a small amount of self-modifying code for a
> >project I'm working on. The problems with the I-cache on the '030 are
> >glaringly obvious, so I'd like to be able to flush it from within my
> >program. Does anyone know how to do this?
> 
> man 2 m68k_sync_icache

Well, it looks like the right function, and I think I'm calling it right,
but it's segfaulting every time I run it. I ended up static-linking the
binary so I could disassemble the code with GDB...:

Program terminated with signal 11, Segmentation fault.
#0  0xaef8 in m68k_sync_icache ()
(gdb) disas
Dump of assembler code for function m68k_sync_icache:
0xaef0 (m68k_sync_icache):      movel %sp@(8),%d1
0xaef4 (m68k_sync_icache+4):    moveal %sp@(4),%a1
0xaef8 (m68k_sync_icache+8):    movel 0x80000004,%d0
0xaefe (m68k_sync_icache+14):   trap #12
0xaf00 (m68k_sync_icache+16):   rts
0xaf02 (m68k_sync_icache+18):   orib #86,%d0
End of assembler dump.
(gdb)

The absolute address in the movel instruction at 0xaef8 kinda worries me,
since I don't know what it's doing... On the other paw, the entire
function looks like syscall magic anyway...

This is a 1.4.2 system on an IIcx.

---------------------------
All programming can be viewed as an exercise.
---------------------------
Alastair Bridgewater
e-mail: nyef@softhome.net