[aarch64-port-dev ] RFR: merge cache flush

Edward Nevill edward.nevill at linaro.org
Wed Aug 21 07:28:41 PDT 2013


Hi,

The following patch merges in the ICache flush code from the Linux kernel sources,

Ok to push?
Ed.

--- CUT HERE ---
exporting patch:
# HG changeset patch
# User Edward Nevill ed at camswl.com
# Date 1377094905 -3600
# Node ID 02f6ac42d4400f5e88c79436784e048656e8ca74
# Parent  468a6eecbf46148c67103161ed28da590b7bebb8
Merged in icache flush code from Linux kernel

diff -r 468a6eecbf46 -r 02f6ac42d440 src/cpu/aarch64/vm/assembler_aarch64.hpp
--- a/src/cpu/aarch64/vm/assembler_aarch64.hpp  Wed Aug 21 13:41:18 2013 +0100
+++ b/src/cpu/aarch64/vm/assembler_aarch64.hpp  Wed Aug 21 15:21:45 2013 +0100
@@ -930,6 +930,14 @@
     rf(rt, 0);
   }

+  void dc(Register Rt) {
+    system(0b01, 0b011, 0b0111, 0b1011, 0b001, Rt);
+  }
+
+  void ic(Register Rt) {
+    system(0b01, 0b011, 0b0111, 0b0101, 0b001, Rt);
+  }
+
   void hint(int imm) {
     system(0b00, 0b011, 0b0010, imm, 0b000);
   }
diff -r 468a6eecbf46 -r 02f6ac42d440 src/cpu/aarch64/vm/icache_aarch64.cpp
--- a/src/cpu/aarch64/vm/icache_aarch64.cpp     Wed Aug 21 13:41:18 2013 +0100
+++ b/src/cpu/aarch64/vm/icache_aarch64.cpp     Wed Aug 21 15:21:45 2013 +0100
@@ -63,6 +63,35 @@
   // and a memory and data synchronization barrier but we will find
   // out when we get real hardware :-)

+#ifndef BUILTIN_SIM
+  Label l99, l1, l2;
+
+  __ cmp(r1, zr);
+  __ br(Assembler::EQ, l99);
+
+  __ mov(r4, r0);
+  __ mov(r3, r1);
+
+__ bind(l1);
+  __ dc(r4);
+  __ add(r4, r4, ICache::line_size);
+  __ subs(r3, r3, 1);
+  __ br(Assembler::NE, l1);
+
+  __ dsb(Assembler::SY);
+
+  __ mov(r4, r0);
+  __ mov(r3, r1);
+
+__ bind(l2);
+  __ ic(r4);
+  __ add(r4, r4, ICache::line_size);
+  __ subs(r3, r3, 1);
+  __ br(Assembler::NE, l2);
+
+__ bind(l99);
+#endif
+
   // n.b. SY means a system wide barrier which is the overkill option

   address loop = __ pc();
diff -r 468a6eecbf46 -r 02f6ac42d440 src/share/vm/runtime/icache.cpp
--- a/src/share/vm/runtime/icache.cpp   Wed Aug 21 13:41:18 2013 +0100
+++ b/src/share/vm/runtime/icache.cpp   Wed Aug 21 15:21:45 2013 +0100
@@ -55,8 +55,8 @@
   static int magic = 0xbaadbabe;

   int auto_magic = magic; // Make a local copy to avoid race condition
-  // int r = (*_flush_icache_stub)(start, lines, auto_magic);
-  // guarantee(r == auto_magic, "flush stub routine did not execute");
+  int r = (*_flush_icache_stub)(start, lines, auto_magic);
+  guarantee(r == auto_magic, "flush stub routine did not execute");
   ++magic;
 }






More information about the aarch64-port-dev mailing list