m68k/{linux,netbsd} integration

Kiyo Inaba inaba at src.ricoh.co.jp
Thu Mar 25 05:28:51 PST 1999


Hi,

With attached patch, m68k/linux ports can be used with jit again.
I am now testing, and it passed the first 9 tests as of now.

Kiyo
-------------------------------------------------------------------
diff -cr kaffe-snap-0325/ChangeLog /tmp/kaffe-snap-0325/ChangeLog
*** kaffe-snap-0325/ChangeLog	Thu Mar 25 16:56:07 1999
--- /tmp/kaffe-snap-0325/ChangeLog	Thu Mar 25 22:22:46 1999
***************
*** 1,5 ****
--- 1,12 ----
  Wed Mar 25 22:30:00 1999  Kiyo Inaba <inaba at src.ricoh.co.jp>
  
+ 	* config/m68k/common.h: sysdepCallMethod for linux.
+ 	Jit support for linux comes back.
+ 	* config/m68k/linux/config.frag: eliminate the use of -O
+ 	flag to evading jit bug.
+ 
+ Wed Mar 25 16:40:00 1999  Kiyo Inaba <inaba at src.ricoh.co.jp>
+ 
  	* config/m68k/linux/md.h: define SP_OFFSET.
  	* config/alpha/jit.h, config/m68k/jit.h, config/m68k/openbsd2/jit.h
  	remove obsolete macros as THREAD_CTX, RETURN_INT, etc.
diff -cr kaffe-snap-0325/config/m68k/common.h /tmp/kaffe-snap-0325/config/m68k/common.h
*** kaffe-snap-0325/config/m68k/common.h	Thu Aug 20 09:50:12 1998
--- /tmp/kaffe-snap-0325/config/m68k/common.h	Thu Mar 25 21:58:07 1999
***************
*** 24,29 ****
--- 24,30 ----
  #define ALIGNMENT_OF_SIZE(S)    (((S>1)?2:1))
  
  #if defined(__linux__)
+ #ifdef	USE_ASM		/* Old and obsolete... */
  #define	sysdepCallMethod(CALL)					       \
                 asm volatile ("                                       \n\
         1:                                                            \n\
***************
*** 66,71 ****
--- 67,113 ----
                 asm volatile ("                                       \n\
                 add.w %0,%%sp                                         \n\
          " : : "r" ((CALL)->argsize * sizeof(jint)) : "cc")
+ #else	/* USE_ASM */
+ #define sysdepCallMethod(CALL) do {				\
+ 	int extraargs[(CALL)->nrargs];				\
+ 	register int d0 asm ("d0");				\
+ 	register int d1 asm ("d1");				\
+ 	register double f0d asm ("fp0");			\
+ 	register float f0f asm ("fp0");				\
+ 	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@\n"				\
+ 	 : "=r" (d0), "=r" (d1)					\
+ 	 : "a" ((CALL)->function)				\
+ 	 : "cc", "memory");					\
+ 	if ((CALL)->retsize != 0) {				\
+ 		res = (int *)(CALL)->ret;			\
+ 	switch((CALL)->retsize) {				\
+ 	case 2:							\
+ 	  if ((CALL)->rettype == 'D')				\
+ 	    *(double*)res = f0d;				\
+ 	  else {						\
+ 		res[1] = d1;					\
+ 		res[0] = d0;					\
+ 	  }							\
+ 	  break;						\
+ 	case 1:							\
+ 	  if ((CALL)->rettype == 'F')				\
+ 	    *(double*)res = f0f;				\
+ 	  else							\
+ 		res[0] = d0;					\
+ 	  break;						\
+ 	}							\
+ 	}							\
+ } while (0)
+ #endif	/* USE_ASM */
  #else	/* defined(__linux__) */
  
  #define sysdepCallMethod(CALL) do {				\
***************
*** 83,90 ****
  	}							\
  	asm volatile ("jsr	%2@\n"				\
  	 : "=r" (d0), "=r" (d1)					\
! 	 : "a" ((CALL)->function),				\
! 	   "r" ((CALL)->nrargs * sizeof(int))			\
  	 : "cc", "memory");					\
  	if ((CALL)->retsize != 0) {				\
  		res = (int *)(CALL)->ret;			\
--- 125,131 ----
  	}							\
  	asm volatile ("jsr	%2@\n"				\
  	 : "=r" (d0), "=r" (d1)					\
! 	 : "a" ((CALL)->function)				\
  	 : "cc", "memory");					\
  	if ((CALL)->retsize != 0) {				\
  		res = (int *)(CALL)->ret;			\
diff -cr kaffe-snap-0325/config/m68k/linux/config.frag /tmp/kaffe-snap-0325/config/m68k/linux/config.frag
*** kaffe-snap-0325/config/m68k/linux/config.frag	Thu Mar 25 09:48:47 1999
--- /tmp/kaffe-snap-0325/config/m68k/linux/config.frag	Thu Mar 25 21:27:38 1999
***************
*** 3,9 ****
  #
  host_cpu=m68k
  host_os=linux
! CFLAGS="-g -O -fno-omit-frame-pointer"
  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'}
--- 3,10 ----
  #
  host_cpu=m68k
  host_os=linux
! CFLAGS="-g -fno-omit-frame-pointer"
! #CFLAGS="-g -O -fno-omit-frame-pointer"
  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'}


More information about the kaffe mailing list