"Kilbane, Stephen" <stephen.kilb...@analog.com> writes:

> I'm trying to add support to 4.3 for cache flushing when setting up a 
> trampoline.
> Reading around, it looks like I should be defining CLEAR_INSN_CACHE:
>
> To clear the instruction cache when a trampoline is initialized, define the 
> following macro.
>    CLEAR_INSN_CACHE (beg, end)
>
> but I can't see anywhere that this macro gets used during trampoline 
> creation. I can see
> that it provides an implementation for __clear_cache() in libgcc, but nothing 
> that would
> invoke that routine, either, short of an explicit call in the source file 
> being compiled.
>
> Am I missing something?

No.  You do need to arrange to flush the cache yourself, typically by
generating the appropriate instructions in the TARGET_TRAMPOLINE_INIT
target hook.  On targets which need to clear the cache, that hook will
often emit a call to __clear_cache, as in

  emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__clear_cache"),
                     LCT_NORMAL, VOIDmode, 2, a_tramp, Pmode,
                     plus_constant (a_tramp, TRAMPOLINE_SIZE), Pmode);

where a_tramp is the address of the trampoline.  The CLEAR_INSN_CACHE
macro will then provide the body of the __clear_cache function.  Of
course, if clearing the cache is reasonably simple, the instructions can
be emitted inline by TARGET_TRAMPOLINE_INIT; e.g., that's what the MIPS
target does.

Ian

Reply via email to