aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Zissulescu <claziss@synopsys.com>2018-04-30 15:16:24 +0200
committerClaudiu Zissulescu <claziss@gcc.gnu.org>2018-04-30 15:16:24 +0200
commit6fe3b9fdd591ea8c5590c87bb5aecd922ada6072 (patch)
tree1acc205e28c49df026350216419425c894c681fa
parente0be3321b908443c46b69c888c53b3fddc4cf797 (diff)
downloadgcc-6fe3b9fdd591ea8c5590c87bb5aecd922ada6072.zip
gcc-6fe3b9fdd591ea8c5590c87bb5aecd922ada6072.tar.gz
gcc-6fe3b9fdd591ea8c5590c87bb5aecd922ada6072.tar.bz2
[ARC] Clear the instruction cache using syscalls.
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. From-SVN: r259764
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/arc/linux.h14
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e2afb1f..4560dd8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2018-04-30 Claudiu Zissulescu <claziss@synopsys.com>
+ * config/arc/linux.h (CLEAR_INSN_CACHE): Define.
+
+2018-04-30 Claudiu Zissulescu <claziss@synopsys.com>
+
* config/arc/arc-protos.h (prepare_extend_operands): Remove.
(small_data_pattern): Likewise.
(arc_rewrite_small_data): Likewise.
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)); \
+}