[kaffe] PS2/Linux patch take 3 / PS2/Linux patch take 4

Dylan Schell dylans at xs4all.nl
Sun Jun 16 13:11:29 PDT 2002


That was what I was looking for!
Shame on me for not knowing how to check this stuff :-)

Anyway, I revised the patch again. This time the code just checks
for _R5900 ( This is the PS2 MIPS Core ).

Greetings,
Dylan Schell
dylans at xs4all.nl

Patrick Tullmann wrote:
> If you can find some pre-defined, ps2-specific cpp macros, that might
> be the best.  What's the output of:
> 	gcc -dM -E -x c /dev/null
> 
-------------- next part --------------
diff -r -c3 kaffe-1.0.7-rc1/config/mips/common.h kaffe-1.0.7-rc1-ps2/config/mips/common.h
*** kaffe-1.0.7-rc1/config/mips/common.h	Wed Mar  7 11:38:17 2001
--- kaffe-1.0.7-rc1-ps2/config/mips/common.h	Sun Jun 16 21:38:43 2002
***************
*** 40,45 ****
--- 40,48 ----
  #endif /* NEED_sysdepCallMethod */
  
  
+ #ifdef _R5900
+ #undef HAVE_MIPSII_INSTRUCTIONS
+ #endif
  #if defined(HAVE_MIPSII_INSTRUCTIONS)
  /*
   * Do an atomic compare and exchange.  The address 'A' is checked against
diff -r -c3 kaffe-1.0.7-rc1/config/mips/linux/md.h kaffe-1.0.7-rc1-ps2/config/mips/linux/md.h
*** kaffe-1.0.7-rc1/config/mips/linux/md.h	Mon Sep  6 23:44:39 1999
--- kaffe-1.0.7-rc1-ps2/config/mips/linux/md.h	Sun Jun 16 21:39:49 2002
***************
*** 21,26 ****
--- 21,31 ----
  #define	SP_OFFSET	1
  #define	FP_OFFSET	10
  
+ #ifdef _R5900
+ #undef	FP_OFFSET
+ #define	FP_OFFSET	36
+ #endif
+ 
  #if defined(TRANSLATOR)
  #include "jit-md.h"
  #endif
***************
*** 28,34 ****
--- 33,43 ----
  /**/
  /* Signal handling */
  /**/
+ #ifdef _R5900
+ #include <signal.h>
+ #else
  #include <sigcontext.h>
+ #endif
  
  /* Define the entry into a signal handler */
  #define EXCEPTIONPROTO  int sig, int c1, int c2, int c3, int c4, int c5, int c6, int c7, struct sigcontext ctx
diff -r -c3 kaffe-1.0.7-rc1/config/mips/mips.c kaffe-1.0.7-rc1-ps2/config/mips/mips.c
*** kaffe-1.0.7-rc1/config/mips/mips.c	Fri Oct 15 03:38:46 1999
--- kaffe-1.0.7-rc1-ps2/config/mips/mips.c	Sun Jun 16 21:40:26 2002
***************
*** 20,25 ****
--- 20,30 ----
  #include "support.h"
  #include "../../kaffe/kaffevm/thread.h"
  
+ #ifdef _R5900
+ #  include "jit.h"
+ int maxArgs;
+ int isStatic;
+ #endif
  extern int maxArgs;
  extern int isStatic;
  
diff -r -c3 kaffe-1.0.7-rc1/config/mips/o32-sysdepCallMethod.h kaffe-1.0.7-rc1-ps2/config/mips/o32-sysdepCallMethod.h
*** kaffe-1.0.7-rc1/config/mips/o32-sysdepCallMethod.h	Thu Apr 15 20:19:31 1999
--- kaffe-1.0.7-rc1-ps2/config/mips/o32-sysdepCallMethod.h	Sun Jun 16 21:39:32 2002
***************
*** 103,110 ****
--- 103,120 ----
      register ARG_TYPE a2 asm("$6");
      register ARG_TYPE a3 asm("$7");
  
+ #ifdef _R5900
+     union {
+         double d;
+         struct {
+             int hi;
+             int lo;
+         } fake_double;
+     } split;
+ #else
      register double d0 asm("$f12");
      register double d2 asm("$f14");
+ #endif
  
      register float f0 asm("$f12");
      register float f2 asm("$f14");
***************
*** 129,135 ****
--- 139,151 ----
        }
        
        if (calltype[2] == D) {
+ #ifdef _R5900
+           split.d = callargs[2].d;
+           a2 = split.fake_double.hi;
+           a3 = split.fake_double.lo;
+ #else
  	  d2 = callargs[2].d;
+ #endif
  	  goto alldouble_2;
        }
  
***************
*** 154,160 ****
--- 170,183 ----
    case 2:
        if (calltype[0] == D) {
        alldouble_2:
+ #ifdef _R5900
+           /* move double into a0/a1 */
+           split.d = callargs[0].d;
+           a0 = split.fake_double.hi;
+           a1 = split.fake_double.lo;
+ #else
  	  d0=callargs[0].d;
+ #endif
        } else {
        testfloat_2:
  	  if (calltype[0] != F) {
***************
*** 183,189 ****
--- 206,216 ----
    noargs:
  #endif
      /* Ensure that the assignments to f* registers won't be optimized away. */
+ #ifdef _R5900
+     asm ("" :: "f" (f0), "f" (f2));
+ #else
      asm ("" :: "f" (f0), "f" (f2), "f" (d0), "f" (d2));
+ #endif
  
      switch(call->retsize) {
      case 0:
diff -r -c3 kaffe-1.0.7-rc1/config/mips/threads.h kaffe-1.0.7-rc1-ps2/config/mips/threads.h
*** kaffe-1.0.7-rc1/config/mips/threads.h	Mon Mar 12 13:50:47 2001
--- kaffe-1.0.7-rc1-ps2/config/mips/threads.h	Sun Jun 16 21:41:07 2002
***************
*** 27,32 ****
--- 27,37 ----
  #define	THREADSTACKSIZE		(32 * 1024)
  #endif
  
+ #ifdef _R5900
+ #undef THREADSTACKSIZE
+ #define THREADSTACKSIZE		(128 * 1024)
+ #endif
+ 
  /*
   * Stack offset.
   * This is the offset into the setjmp buffer where the stack pointer is


More information about the kaffe mailing list