This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH 5/5] [ARC] Clear the instruction cache using syscalls.
committed. Thank you for your review,
Claudiu
________________________________________
From: Andrew Burgess [andrew.burgess@embecosm.com]
Sent: Friday, April 27, 2018 11:40 PM
To: Claudiu Zissulescu
Cc: gcc-patches@gcc.gnu.org; Francois.Bedard@synopsys.com
Subject: Re: [PATCH 5/5] [ARC] Clear the instruction cache using syscalls.
* Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com> [2018-04-06 11:00:14 +0200]:
> Clear the instruction cache from `beg' to `end'. This makes an inline
> system call to SYS_cacheflush.
>
> gcc/
> 2017-03-28 Claudiu Zissulescu <claziss@synopsys.com>
>
> * config/arc/linux.h (CLEAR_INSN_CACHE): Define.
Looks good.
Thanks,
Andrew
> ---
> gcc/config/arc/linux.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/gcc/config/arc/linux.h b/gcc/config/arc/linux.h
> index 4e87dfe..96d548e 100644
> --- a/gcc/config/arc/linux.h
> +++ b/gcc/config/arc/linux.h
> @@ -109,3 +109,17 @@ along with GCC; see the file COPYING3. If not see
> /* Build attribute: procedure call standard. */
> #undef ATTRIBUTE_PCS
> #define ATTRIBUTE_PCS 3
> +
> +/* Clear the instruction cache from `beg' to `end'. This makes an
> + inline system call to SYS_cacheflush. */
> +#undef CLEAR_INSN_CACHE
> +#define CLEAR_INSN_CACHE(beg, end) \
> +{ \
> + register unsigned long _beg __asm ("r0") = (unsigned long) (beg); \
> + register unsigned long _end __asm ("r1") = (unsigned long) (end); \
> + register unsigned long _xtr __asm ("r2") = 0; \
> + register unsigned long _scno __asm ("r8") = 244; \
> + __asm __volatile ("trap_s 0 ; sys_cache_sync" \
> + : "=r" (_beg) \
> + : "0" (_beg), "r" (_end), "r" (_xtr), "r" (_scno)); \
> +}
> --
> 1.9.1
>