mips: implement flush_cache, fixing segfaults on actual hardware
authorGuillaume Emont <guijemont@igalia.com>
Wed, 28 Nov 2012 19:15:26 +0000 (20:15 +0100)
committerGuillaume Emont <guijemont@igalia.com>
Fri, 28 Dec 2012 14:17:46 +0000 (15:17 +0100)
orc/orcprogram-mips.c

index ed85bf4..f5d8cb9 100644 (file)
@@ -11,6 +11,8 @@ void orc_compiler_orc_mips_assemble (OrcCompiler *compiler);
 
 const char * orc_compiler_orc_mips_get_asm_preamble (void);
 
+void orc_mips_flush_cache (OrcCode *code);
+
 /* in orcrules-mips.c */
 void orc_compiler_orc_mips_register_rules (OrcTarget *target);
 
@@ -28,6 +30,9 @@ static OrcTarget orc_mips_target = {
   { { 0 } },
   0,
   orc_compiler_orc_mips_get_asm_preamble,
+  NULL,
+  NULL,
+  orc_mips_flush_cache,
 };
 
 enum {
@@ -652,3 +657,10 @@ usual_case:
   orc_mips_emit_epilogue (compiler, stack_size);
 }
 
+void
+orc_mips_flush_cache  (OrcCode *code)
+{
+#ifdef HAVE_MIPSEL
+  __clear_cache (code->code, code->code + code->code_size);
+#endif
+}