# New Ticket Created by  Jason Gloudon 
# Please include the string:  [perl #16237]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=16237 >



This provide register window flushing code for sparc, for both 32-bit and
64-bit CPUs.

-- 
Jason


-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/34016/27834/1633b3/flush.patch

diff -urN parrot/config/gen/makefiles/root.in parrot-flush/config/gen/makefiles/root.in
--- parrot/config/gen/makefiles/root.in Mon Aug 12 02:44:35 2002
+++ parrot-flush/config/gen/makefiles/root.in   Thu Aug 15 20:09:40 2002
@@ -93,7 +93,8 @@
                                 platform$(O) ${jit_o} resources$(O) rx$(O) 
rxstacks$(O) \
                                 embed$(O) warnings$(O) misc$(O) ${cg_o} \
                                 packout$(O) byteorder$(O) debug$(O) smallobject$(O) \
-                                headers$(O) dod$(O) method_util$(O)
+                                headers$(O) dod$(O) method_util$(O) \
+                                cpu_dep$(O)
 
 O_FILES = $(INTERP_O_FILES) \
              $(IO_O_FILES) \
@@ -336,6 +337,8 @@
 
 method_util$(O) : $(GENERAL_H_FILES)
 
+cpu_dep$(O) : $(GENERAL_H_FILES)
+ 
 string$(O) : $(GENERAL_H_FILES)
 
 chartype$(O) : $(GENERAL_H_FILES)
diff -urN parrot/cpu_dep.c parrot-flush/cpu_dep.c
--- parrot/cpu_dep.c    Wed Dec 31 19:00:00 1969
+++ parrot-flush/cpu_dep.c      Thu Aug 15 22:38:47 2002
@@ -0,0 +1,44 @@
+/* cpu_dep.c
+ *  Copyright: (When this is determined...it will go here)
+ *  CVS Info
+ *     $Id$
+ *  Overview:
+ *     CPU dependent functions
+ *  Data Structure and Algorithms:
+ *  History:
+ *  Notes:
+ *  References:
+ */
+
+#include "parrot/parrot.h"
+
+void flush_register_windows(void){
+
+#ifdef __sparc
+
+    static int initialized = 0;
+    static int insns[4] = {
+#ifdef __sparcv9
+                            0x81580000, /* flushw */
+#else
+                            0x91d02003, /* ta ST_FLUSH_WINDOWS */
+#endif
+                            0x81c3e008, /* retl */ 
+                            0x01000000  /* nop */
+    };
+    static double align_hack[2];
+    static void (*fn_ptr)(void) = (void (*)(void))&align_hack[0];
+
+    if(!initialized){
+        initialized = 1;
+       memcpy((void *)&align_hack[0], insns, sizeof(insns));
+    }
+
+    fn_ptr();
+
+#else
+
+    return;
+
+#endif
+}
diff -urN parrot/dod.c parrot-flush/dod.c
--- parrot/dod.c        Tue Aug 13 20:10:48 2002
+++ parrot-flush/dod.c  Thu Aug 15 20:01:36 2002
@@ -344,6 +344,9 @@
 
     if (!lo_var_ptr)
         return last;
+
+    /* Flush register windows if needed */
+    flush_register_windows();
     
     for (cur_var_ptr = lo_var_ptr;
          (ptrdiff_t)(cur_var_ptr * direction) < (ptrdiff_t)(hi_var_ptr * direction);
diff -urN parrot/include/parrot/dod.h parrot-flush/include/parrot/dod.h
--- parrot/include/parrot/dod.h Thu Jul 18 00:32:53 2002
+++ parrot-flush/include/parrot/dod.h   Thu Aug 15 18:58:53 2002
@@ -18,6 +18,7 @@
 #include "parrot/parrot.h"
 
 void Parrot_do_dod_run(struct Parrot_Interp *);
+void flush_register_windows(void);
 PMC *trace_system_stack(struct Parrot_Interp *, PMC *);
 
 /* Functions needed for custom DOD routines */

Reply via email to