[kaffe] CVS kaffe (dalibor): Fixes for cache handling for XScale
Kaffe CVS
cvs-commits at kaffe.org
Tue Mar 9 09:39:02 PST 2004
PatchSet 4495
Date: 2004/03/09 17:35:45
Author: dalibor
Branch: HEAD
Tag: (none)
Log:
Fixes for cache handling for XScale
2004-03-09 Gerard Basler <gerard.basler at starticket.ch>
Fixes for XScale.
* config/arm/linux/md.c,
config/arm/jit.h:
(flush_dcache()) Replaced array digging with a kernel call to
cacheflush()
Should work with 2.6 (untested).
Members:
ChangeLog:1.2075->1.2076
config/arm/jit.h:1.13->1.14
config/arm/linux/md.c:1.3->1.4
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2075 kaffe/ChangeLog:1.2076
--- kaffe/ChangeLog:1.2075 Tue Mar 9 16:59:44 2004
+++ kaffe/ChangeLog Tue Mar 9 17:35:45 2004
@@ -1,3 +1,13 @@
+2004-03-09 Gerard Basler <gerard.basler at starticket.ch>
+
+ Fixes for XScale.
+
+ * config/arm/linux/md.c,
+ config/arm/jit.h:
+ (flush_dcache()) Replaced array digging with a kernel call to
+ cacheflush()
+ Should work with 2.6 (untested).
+
2004-03-09 Dalibor Topic <robilad at kaffe.org>
Merged in a fix from NetBSD, PR pkg/22437.
Index: kaffe/config/arm/jit.h
diff -u kaffe/config/arm/jit.h:1.13 kaffe/config/arm/jit.h:1.14
--- kaffe/config/arm/jit.h:1.13 Mon Jan 19 17:48:01 2004
+++ kaffe/config/arm/jit.h Tue Mar 9 17:35:47 2004
@@ -302,9 +302,8 @@
/* Wrap up a native call for the JIT */
#define KAFFEJIT_TO_NATIVE(M)
-/* For now, ignore BEG and END since we flush the complete I&D cache FIXME */
-extern void flush_dcache(void);
-#define FLUSH_DCACHE(BEG, END) flush_dcache()
+extern void flush_dcache(void *start, void *end);
+#define FLUSH_DCACHE(BEG, END) flush_dcache(BEG, END)
#if defined(JIT3)
/*
Index: kaffe/config/arm/linux/md.c
diff -u kaffe/config/arm/linux/md.c:1.3 kaffe/config/arm/linux/md.c:1.4
--- kaffe/config/arm/linux/md.c:1.3 Sat Oct 19 11:04:41 2002
+++ kaffe/config/arm/linux/md.c Tue Mar 9 17:35:48 2004
@@ -12,6 +12,14 @@
#include "config.h"
#include <malloc.h>
#include <sched.h>
+#include <asm/unistd.h>
+
+/* If VM_EXEC is not defined, use definition from
+ * linux/mm.h.
+ */
+#if !defined(VM_EXEC)
+long VM_EXEC = 0x00000004;
+#endif /* !defined(VM_EXEC) */
void
init_md(void)
@@ -21,18 +29,17 @@
#endif
}
-#define CACHE_SIZE (32 * 1024)
-#define LINE_SIZE sizeof(int)
-#define CACHE_LINES (CACHE_SIZE / LINE_SIZE)
-
-static volatile int flusher[CACHE_LINES];
-
-void
-flush_dcache(void)
-{
- int i;
- for (i = 0; i < CACHE_LINES; i++) {
- flusher[i]++;
- }
- sched_yield();
+/**
+ * Shamelessly stolen from parrot... ([perl]/parrot/jit/arm/jit_emit.h arm_sync_d_i_cache)
+ *
+ * r2 should be zero for 2.4 (but it's ignored) so passing VM_EXEC (needed for 2.6) should be okay.
+ */
+void flush_dcache(void *start, void *end) {
+ __asm __volatile ("mov r0, %0\n"
+ "mov r1, %1\n"
+ "mov r2, #VM_EXEC\n"
+ "swi " __sys1(__ARM_NR_cacheflush) "\n"
+ : /* no return value */
+ : "r" ((long)start), "r" ((long)end)
+ : "r0","r1","r2");
}
More information about the kaffe
mailing list