m68k netbsd port works

Kiyo Inaba kaffe@rufus.w3.org
Mon, 20 Jul 1998 12:05:35 +0900


Following patch makes port to m68k-netbsd work.
For the time being, I just run HelloWorldApp class, but it should be OK
because the mod are so similar to m68k-sunos4 patch.

Configuration I used to test is
	--with-staticlib --with-engine=intrp --with-threads=unix-internal

Kiyo
------------------------------------------------------------------------
diff -cr kaffe-snap/config/m68k/netbsd1/config.frag kaffe-snap-new/config/m68k/netbsd1/config.frag
*** kaffe-snap/config/m68k/netbsd1/config.frag	Wed Apr  1 04:10:53 1998
--- kaffe-snap-new/config/m68k/netbsd1/config.frag	Mon Jul 20 10:15:48 1998
***************
*** 6,8 ****
--- 6,20 ----
  PIC=-fpic
  LIBSHARE=-Bshareable
  LIBEXT=.so
+ if [ "$cross_compiling" = yes ]; then
+ # if we use cross environment, following values may not be detected.
+   ac_cv_alignmentof_voidp=${ac_cv_alignmentof_voidp='2'}
+   ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'}
+   ac_cv_sizeof___int64=${ac_cv_sizeof___int64='0'}
+   ac_cv_sizeof_int=${ac_cv_sizeof_int='4'}
+   ac_cv_sizeof_long=${ac_cv_sizeof_long='4'}
+   ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long='8'}
+   ac_cv_sizeof_short=${ac_cv_sizeof_short='2'}
+   ac_cv_sizeof_voidp=${ac_cv_sizeof_voidp='4'}
+ fi
+ 
diff -cr kaffe-snap/config/m68k/netbsd1/md.h kaffe-snap-new/config/m68k/netbsd1/md.h
*** kaffe-snap/config/m68k/netbsd1/md.h	Wed Apr  1 04:10:53 1998
--- kaffe-snap-new/config/m68k/netbsd1/md.h	Mon Jul 20 08:49:38 1998
***************
*** 20,25 ****
--- 20,61 ----
  
  #include "m68k/threads.h"
  
+ /*
+  * Redefine stack pointer offset.
+  */
+ #undef  SP_OFFSET
+ #define SP_OFFSET       2
+ 
+ /*
+  * Alignment in structure is 2 bytes packed.
+  */
+ #define ALIGNMENT_OF_SIZE(S)    (((S>1)?2:1))
+ 
+ #define sysdepCallMethod(CALL) do {                                     \
+         int extraargs[(CALL)->nrargs];                                  \
+         register int d0 asm ("d0");                                     \
+         register int d1 asm ("d1");                                     \
+         int *res;                                                       \
+         int *args = extraargs;                                          \
+         int argidx;                                                     \
+         for(argidx = 0; argidx < (CALL)->nrargs; ++argidx) {            \
+             if ((CALL)->callsize[argidx])                               \
+                 *args++ = (CALL)->args[argidx].i;                       \
+             else                                                        \
+                 *args++ = (CALL)->args[argidx-1].j;                     \
+         }                                                               \
+         asm volatile ("jsr     %2@\naddw    %3,sp\n"                    \
+          : "=r" (d0), "=r" (d1)                                         \
+          : "a" ((CALL)->function),                                      \
+            "r" ((CALL)->nrargs * sizeof(int))                           \
+          : "cc", "memory");                                             \
+         if ((CALL)->retsize != 0) {                                     \
+                 res = (int *)(CALL)->ret;                               \
+                 res[1] = d1;                                            \
+                 res[0] = d0;                                            \
+         }                                                               \
+ } while (0)
+ 
  #if defined(TRANSLATOR)
  #include "jit-md.h"
  #endif
diff -cr kaffe-snap/include/java_lang_ThreadGroup.h kaffe-snap-new/include/java_lang_ThreadGroup.h
*** kaffe-snap/include/java_lang_ThreadGroup.h	Wed Apr  1 04:10:53 1998
--- kaffe-snap-new/include/java_lang_ThreadGroup.h	Mon Jul 20 10:06:48 1998
***************
*** 16,22 ****
    jint maxPriority;
    jbool destroyed;
    jbool daemon;
-   jbool vmAllowSuspension;
    jint nthreads;
    HArrayOfObject* threads;
    jint ngroups;
--- 16,21 ----
diff -cr kaffe-snap/kaffe/kaffevm/thread.c kaffe-snap-new/kaffe/kaffevm/thread.c
*** kaffe-snap/kaffe/kaffevm/thread.c	Tue Jul 14 23:02:09 1998
--- kaffe-snap-new/kaffe/kaffevm/thread.c	Mon Jul 20 10:07:27 1998
***************
*** 64,70 ****
  	unhand(standardGroup)->maxPriority = java_lang_Thread_MAX_PRIORITY;
  	unhand(standardGroup)->destroyed = 0;
  	unhand(standardGroup)->daemon = 0;
- 	unhand(standardGroup)->vmAllowSuspension = 0;
  	unhand(standardGroup)->nthreads = 0;
  	unhand(standardGroup)->threads = (HArrayOfObject*)newArray(ThreadClass, 0);
  	unhand(standardGroup)->ngroups = 0;
--- 64,69 ----