kaffe0.10.x on mips-netbsd

Kiyo Inaba inaba at src.ricoh.co.jp
Fri Jun 19 00:24:22 PDT 1998


Hi,

It looks like the port to mips-netbsd start to work. For the time
being, I'm not so sure whether there are some other people working
with different operating system for mips, and I put the definition
of sysdepCallMethod into machine and OS specific header file.
If someone else is working for different OS, please let me know.

By the way, since kaffe-0.10.0 is too old, and kaffe-0.10.1 is
too young, I selected the base for this port as June/4's snap.
I hope the released version becomes stabilized soon.

Kiyo
-------------------------------------------------------------------
diff -cr kaffe-snap/config/mips/netbsd1/md.h kaffe-snap-new/config/mips/netbsd1/md.h
*** kaffe-snap/config/mips/netbsd1/md.h	Wed Apr  1 04:10:53 1998
--- kaffe-snap-new/config/mips/netbsd1/md.h	Fri Jun 19 14:26:49 1998
***************
*** 12,17 ****
--- 12,94 ----
  #ifndef __mips_netbsd1_md_h
  #define __mips_netbsd1_md_h
  
+ /*
+  * The calling convention is such that the first four 32 bit values are
+  * passed in $4-$7, and the remainder goes on the stack.
+  * Floating point should be tested later.
+  *
+  * Return values are stored in $2 or $2 and $3 combination.
+  */
+ 
+ #define	sysdepCallMethod(CALL) do {					\
+   int extraargs[((CALL)->nrargs>4)?((CALL)->nrargs-4):0];		\
+   switch((CALL)->nrargs) {						\
+     register int r2 asm("$2");						\
+     register int r3 asm("$3");						\
+     register int r4 asm("$4");						\
+     register int r5 asm("$5");						\
+     register int r6 asm("$6");						\
+     register int r7 asm("$7");						\
+     int *res;								\
+   default:								\
+     {									\
+       int *args = extraargs;						\
+       int argidx = 4; 							\
+       if ((CALL)->callsize[3] == 2) args++;				\
+       for(; argidx < (CALL)->nrargs; ++argidx) {			\
+ 	if ((CALL)->callsize[argidx]) { 				\
+ 	  *args++ = (CALL)->args[argidx].i;				\
+ 	  if ((CALL)->callsize[argidx] == 2) 				\
+ 	    *args++ = ((CALL)->args[argidx].j) >> 32;			\
+ 	} 								\
+       }									\
+     }									\
+   case 4:								\
+     if ((CALL)->callsize[3]) {						\
+       r7 = (CALL)->args[3].i;						\
+       if ((CALL)->callsize[3] == 2)					\
+         *extraargs = ((CALL)->args[3].j) >> 32; 			\
+     }									\
+   case 3:								\
+     if ((CALL)->callsize[2]) {						\
+       r6 = (CALL)->args[2].i;						\
+       if ((CALL)->callsize[2] == 2)					\
+         r7 = ((CALL)->args[2].j) >> 32; 				\
+     }									\
+   case 2:								\
+     if ((CALL)->callsize[1]) {						\
+       r5 = (CALL)->args[1].i;						\
+       if ((CALL)->callsize[1] == 2)					\
+         r6 = ((CALL)->args[1].j) >> 32; 				\
+     }									\
+   case 1:								\
+     if ((CALL)->callsize[0]) {						\
+       r4 = (CALL)->args[0].i;						\
+       if ((CALL)->callsize[0] == 2)					\
+         r5 = ((CALL)->args[0].j) >> 32; 				\
+     }									\
+   case 0:								\
+     asm ("move $25, %2\n						\
+ 	  jal $31, $25\n"						\
+         : "=r" (r2), "=r" (r3)						\
+ 	: "r" ((CALL)->function),					\
+ 	  "r" (r4), "r" (r5), "r" (r6), "r" (r7) 			\
+ 	: "cc"				 				\
+ 	);								\
+     res = (int *)(CALL)->ret; 						\
+     res[0] = r2; 							\
+     res[1] = r3; 							\
+     break;								\
+   }									\
+ } while (0)								\
+ 
  #include "mips/threads.h"
+ 
+ /*
+  * Redefine stack pointer offset.
+  *	maybe 32 or 33.
+  */
+ #undef  SP_OFFSET
+ #define SP_OFFSET       32
  
  #endif


More information about the kaffe mailing list