Przeglądaj źródła

[libcpu][c906] fix the bug where the cache is optimized

jasonhu 4 lat temu
rodzic
commit
dfa191f9ae
1 zmienionych plików z 9 dodań i 0 usunięć
  1. 9 0
      libcpu/risc-v/t-head/c906/cache.c

+ 9 - 0
libcpu/risc-v/t-head/c906/cache.c

@@ -16,6 +16,15 @@
 
 
 #define L1_CACHE_BYTES (64)
 #define L1_CACHE_BYTES (64)
 
 
+/**
+ * GCC version not support t-head cache flush, so we use fixed code to achieve.
+ * The following function cannot be optimized.
+ */
+static void dcache_wb_range(unsigned long start, unsigned long end) __attribute__((optimize("O0")));
+static void dcache_inv_range(unsigned long start, unsigned long end) __attribute__((optimize("O0")));
+static void dcache_wbinv_range(unsigned long start, unsigned long end) __attribute__((optimize("O0")));
+static void icache_inv_range(unsigned long start, unsigned long end) __attribute__((optimize("O0")));
+
 static void dcache_wb_range(unsigned long start, unsigned long end)
 static void dcache_wb_range(unsigned long start, unsigned long end)
 {
 {
     unsigned long i = start & ~(L1_CACHE_BYTES - 1);
     unsigned long i = start & ~(L1_CACHE_BYTES - 1);