Hi,

As I reported this morning (JST), I made patches needed to make
NetBSD/m68k work again. For the time being it can only used with
gcc option '-O0', and with engine 'jit'. And even though it works
with 'HelloWorldApp.class' by directly invoking kaffe-bin, I can
not make the regression test work.

But, I hope this is still much better than nothing...

Kiyo
P.S. I made this patch against 1.1.5 tag because this is the base
     for me to make this mod. Some minor patch mismatch may occur
     if someone applies this to the CVS-head.

-------------------------------------------------------------------
diff -Naur kaffe-1.1.5-rc1.orig/ChangeLog kaffe-1.1.5-rc1/ChangeLog
--- kaffe-1.1.5-rc1.orig/ChangeLog      Sun May  2 18:53:50 2004
+++ kaffe-1.1.5-rc1/ChangeLog   Mon Jun 21 16:22:14 2004
@@ -1,3 +1,15 @@
+2004-06-27  Kiyo Inaba <[EMAIL PROTECTED]>
+       * config/m68k/common.h: ALIGNMENT_OF_SIZE is moved to each
+       ports.
+       * config/m68k/jit.h: packed attributes are added to fields of
+       _methodTrampoline.
+       * config/m68k/linux/md.h: ALIGNMENT_OF_SIZE is added. Some
+       comments are revised.
+       * config/m68k/netbsd1/config.frag: compiling option -O0 is
+       added, because O2 does not work for the time being.
+       * config/m68k/netbsd1/md.h: ALIGNMENT_OF_SIZE is added.
+       sysddepCallMethod macro for netbsd was added.
+
 2004-04-30  Guilhem Lavaux <[EMAIL PROTECTED]>
 
        Reported by Emil Mikulic <[EMAIL PROTECTED]>
diff -Naur kaffe-1.1.5-rc1.orig/config/m68k/common.h 
kaffe-1.1.5-rc1/config/m68k/common.h
--- kaffe-1.1.5-rc1.orig/config/m68k/common.h   Sat Dec 13 00:58:51 2003
+++ kaffe-1.1.5-rc1/config/m68k/common.h        Mon Jun 21 16:04:58 2004
@@ -27,16 +27,10 @@
 #include "atomicity.h"
 
 /*
- * Alignment in structure is 2 bytes packed.
- */
-#define ALIGNMENT_OF_SIZE(S)    (((S>1)?2:1))
-
-/*
  * Do an atomic compare and exchange.  The address 'A' is checked against
  * value 'O' and if they match it's exchanged with value 'N'.
  * We return '1' if the exchange is successful, otherwise 0.
  */
-
 
 #define COMPARE_AND_EXCHANGE(A, O, N)  (compare_and_swap((long int*) A, (long int) O, 
(long int) N)) 
 
diff -Naur kaffe-1.1.5-rc1.orig/config/m68k/jit.h kaffe-1.1.5-rc1/config/m68k/jit.h
--- kaffe-1.1.5-rc1.orig/config/m68k/jit.h      Tue Mar 16 02:37:04 2004
+++ kaffe-1.1.5-rc1/config/m68k/jit.h   Thu Jun 17 10:34:00 2004
@@ -52,9 +52,9 @@
 
 typedef struct _methodTrampoline {
         unsigned short call;
-       int fixup;
-       struct _methods* meth;
-       void** where;
+       int fixup __attribute__ ((packed));
+       struct _methods* meth __attribute__ ((packed));
+       void** where __attribute__ ((packed));
 } methodTrampoline;
 
 extern void m68k_do_fixup_trampoline(void);
diff -Naur kaffe-1.1.5-rc1.orig/config/m68k/linux/md.h 
kaffe-1.1.5-rc1/config/m68k/linux/md.h
--- kaffe-1.1.5-rc1.orig/config/m68k/linux/md.h Thu Apr 29 02:03:55 2004
+++ kaffe-1.1.5-rc1/config/m68k/linux/md.h      Mon Jun 21 16:16:02 2004
@@ -1,6 +1,6 @@
 /*
  * m68k/linux/md.h
- * Linux m68k configuration information.
+ * Linux/m68k configuration information.
  *
  * Copyright (c) 1996, 1997
  *     Transvirtual Technologies, Inc.  All rights reserved.
@@ -17,9 +17,15 @@
 #include "support.h"
 
 /*
- * Redefine stack pointer offset.
+ * Alignment in structure is 2 bytes packed.
+ */
+#define ALIGNMENT_OF_SIZE(S)    (((S>1)?2:1))
+
+/*
+ * Stack offset.
+ * This is the offset into the setjmp buffer where the stack pointer is
+ * stored.
  */
-#undef  SP_OFFSET
 #define SP_OFFSET      14
 
 /**/
@@ -43,14 +49,8 @@
 /*
  * sysdepCallMethod supports:
  *
- *     Calling sequences for linux and netbsd1 are same, except for
- *     the place of return values. The float/double values are in
- *     fp0 (linux) or d0/d1 (netbsd1).
- *
- *     Still I do not understand 'asm' statement well, and the
- *     statement below is a 'because it works' version.
+ *     Linux version
  */
-//     Linux version
 #define sysdepCallMethod(CALL) do {                            \
        int extraargs[(CALL)->nrargs];                          \
        register int d0 asm ("d0");                             \
diff -Naur kaffe-1.1.5-rc1.orig/config/m68k/netbsd1/config.frag 
kaffe-1.1.5-rc1/config/m68k/netbsd1/config.frag
--- kaffe-1.1.5-rc1.orig/config/m68k/netbsd1/config.frag        Sat Jan  3 04:55:38 
2004
+++ kaffe-1.1.5-rc1/config/m68k/netbsd1/config.frag     Mon Jun 21 11:03:30 2004
@@ -1,7 +1,7 @@
 #
 # m68k/Netbsd1 configuration.
 #
-CFLAGS="$CFLAGS -fno-omit-frame-pointer"
+CFLAGS="$CFLAGS -O0 -fno-omit-frame-pointer"
 LDFLAGS="$LDFLAGS -lm68k"
 if [ "$cross_compiling" = yes ]; then
   ac_cv_c_char_unsigned=${ac_cv_c_char_unsigned='no'}
diff -Naur kaffe-1.1.5-rc1.orig/config/m68k/netbsd1/md.h 
kaffe-1.1.5-rc1/config/m68k/netbsd1/md.h
--- kaffe-1.1.5-rc1.orig/config/m68k/netbsd1/md.h       Sat Dec 13 00:58:53 2003
+++ kaffe-1.1.5-rc1/config/m68k/netbsd1/md.h    Mon Jun 21 16:16:30 2004
@@ -1,6 +1,6 @@
 /*
  * m68k/netbsd1/md.h
- * netbsd/m68k specific functions.
+ * netbsd/m68k configuration information.
  *
  * Copyright (c) 1996, 1997
  *     Transvirtual Technologies, Inc.  All rights reserved.
@@ -16,12 +16,17 @@
 
 #include "m68k/common.h"
 #include "m68k/threads.h"
-#include "m68k/sysdepCallMethod.h"
 
 /*
- * Redefine stack pointer offset.
+ * Alignment in structure is 4 bytes packed
+ */
+#define ALIGNMENT_OF_SIZE(S)    ((S) < 4 ? (S) : 4)
+
+/*
+ * Stack offset.
+ * This is the offset into the setjmp buffer where the stack pointer is
+ * stored.
  */
-#undef  SP_OFFSET
 #define SP_OFFSET       2
 
 /**/
@@ -38,4 +43,66 @@
 #include "jit-md.h"
 #endif
 
-#endif
+/*
+ * sysdepCallMethod supports:
+ *
+ *     NetBSD version
+ *     For NetBSD the 'extraargs' magic does not work, and I still
+ *     have to use fully asm version. Also, with optimization A2
+ *     register is contaminated when coming back from subroutine
+ *     sysdepCallMethod calls, and I split the code into two parts.
+ */
+
+#define        sysdepCallMethod(CALL)                                    \
+       asm volatile ("                                         \n\
+       1:                                                      \n\
+               cmp.l   #0,%0                                   \n\
+               beq     3f                                      \n\
+               subq.l  #1,%0                                   \n\
+               cmp.b   #0,(%2,%0.l)                            \n\
+               beq     1b                                      \n\
+               cmp.b   #1,(%2,%0.l)                            \n\
+               beq     2f                                      \n\
+               move.l  4(%1,%0.l*8),-(%/sp)                    \n\
+       2:                                                      \n\
+               move.l  (%1,%0.l*8),-(%/sp)                     \n\
+               jmp     1b                                      \n\
+       3:                                                      \n\
+               jsr     (%3)                                    \n\
+      " :                                                        \
+       : "r" ((CALL)->nrargs),                                   \
+         "a" ((CALL)->args),                                     \
+         "a" ((CALL)->callsize),                                 \
+         "a" ((CALL)->function)                                  \
+       : "d0", "d1", "fp0", "cc", "memory");                     \
+       asm volatile ("                                         \n\
+               cmp.b   #2,%0                                   \n\
+               bne     5f                                      \n\
+               cmp.b   #0x44,%1                                \n\
+               bne     4f                                      \n\
+               fmove.d %/fp0,(%2)                              \n\
+               jmp     7f                                      \n\
+       4:                                                      \n\
+               move.l  %/d1,4(%2)                              \n\
+               move.l  %/d0,(%2)                               \n\
+               jmp     7f                                      \n\
+       5:                                                      \n\
+               cmp.b   #1,%0                                   \n\
+               bne     7f                                      \n\
+               cmp.b   #0x46,%1                                \n\
+               bne     6f                                      \n\
+               fmove.s %/fp0,(%2)                              \n\
+               jmp     7f                                      \n\
+       6:                                                      \n\
+               move.l  %/d0,(%2)                               \n\
+       7:                                                        \
+      " :                                                        \
+       : "m" ((CALL)->retsize),                                  \
+         "m" ((CALL)->rettype),                                  \
+         "a" ((CALL)->ret)                                       \
+       : "d0", "d1", "fp0", "cc", "memory");                     \
+       asm volatile ("                                         \n\
+               add.w %0,%/sp                                   \n\
+       " : : "r" ((CALL)->argsize * sizeof(jint)) : "cc")
+
+#endif /* __m68k_netbsd1_md_h */

_______________________________________________
kaffe mailing list
[EMAIL PROTECTED]
http://kaffe.org/cgi-bin/mailman/listinfo/kaffe

Reply via email to