[kaffe] PS2/Linux patch take 3

Dylan Schell dylans at xs4all.nl
Sun Jun 16 11:41:06 PDT 2002


There is a linux crosscompiler on the www.playstation2-linux.com site

http://playstation2-linux.com/projects/ps2stuff

Hope this helps

I'm trying to figure this one out myself as well since config.guess
comes up with mipsel-pc-linux-gnu, BUT it does not conform to the
standard O32 ABI. the PS2 passes doubles in 2 general purpose registers.

It might be possible to check for PS2 specific header files though. I'd
much prefer it would work without a switch as well. And if you want me
to try something on my machine, let me know.

Greetings,
Dylan Schell
dylans at xs4all.nl

Jim Pick wrote:
> Thanks,
> 
> I'll put your changes in, but I want to play around with it a bit more
> before I put it in.
> 
> I'd like to take a look at the toolchain for the PS2 to see if perhaps
> the configure script can figure out for itself that it needs these
> changes, without having to do the --enable-ps2linux switch.  Where can I
> download it?
> 
> Cheers,
> 
>  - Jim
> 
> On Sun, 2002-06-16 at 03:44, Dylan Schell wrote:
> 
>>Grrr, in order to keep my patch clean I removed some of the
>>code that I thought was not needed. So here is version 3
>>
>>tested this time :-)
>>
>>Notes:
>>
>>- Is the #include <sigcontext.h> in config/mips/linux/md.h correct?
>>On all the systems where I tried this, (i386/2.2.1, i386/2.4.18)
>><sigcontext.h> stops compilation and complains sigcontext should never
>>be included directly, and that I should include <signal.h> instead.
>>
>>- I added maxArgs and isStatic to config/mips/mips.c to keep the
>>linker happy, is there some header file i should be including instead?
>>----
>>
> 
> 
>>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 11:09:29 2002
>>***************
>>*** 40,45 ****
>>--- 40,48 ----
>>  #endif /* NEED_sysdepCallMethod */
>>  
>>  
>>+ #ifdef HAVE_PS2_LINUX
>>+ #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 11:06:05 2002
>>***************
>>*** 21,26 ****
>>--- 21,31 ----
>>  #define	SP_OFFSET	1
>>  #define	FP_OFFSET	10
>>  
>>+ #ifdef HAVE_PS2_LINUX
>>+ #undef	FP_OFFSET
>>+ #define	FP_OFFSET	36
>>+ #endif
>>+ 
>>  #if defined(TRANSLATOR)
>>  #include "jit-md.h"
>>  #endif
>>***************
>>*** 28,34 ****
>>--- 33,43 ----
>>  /**/
>>  /* Signal handling */
>>  /**/
>>+ #ifdef HAVE_PS2_LINUX
>>+ #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 12:29:00 2002
>>***************
>>*** 20,25 ****
>>--- 20,30 ----
>>  #include "support.h"
>>  #include "../../kaffe/kaffevm/thread.h"
>>  
>>+ #ifdef HAVE_PS2_LINUX
>>+ #  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 11:06:05 2002
>>***************
>>*** 103,110 ****
>>--- 103,120 ----
>>      register ARG_TYPE a2 asm("$6");
>>      register ARG_TYPE a3 asm("$7");
>>  
>>+ #ifdef HAVE_PS2_LINUX
>>+     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 HAVE_PS2_LINUX
>>+           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 HAVE_PS2_LINUX
>>+           /* 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 HAVE_PS2_LINUX
>>+     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 11:06:05 2002
>>***************
>>*** 27,32 ****
>>--- 27,37 ----
>>  #define	THREADSTACKSIZE		(32 * 1024)
>>  #endif
>>  
>>+ #ifdef HAVE_PS2_LINUX
>>+ #undef THREADSTACKSIZE
>>+ #define THREADSTACKSIZE		(128 * 1024)
>>+ #endif
>>+ 
>>  /*
>>   * Stack offset.
>>   * This is the offset into the setjmp buffer where the stack pointer is
>>diff -r -c3 kaffe-1.0.7-rc1/configure.in kaffe-1.0.7-rc1-ps2/configure.in
>>*** kaffe-1.0.7-rc1/configure.in	Sun Jun  2 07:03:49 2002
>>--- kaffe-1.0.7-rc1-ps2/configure.in	Sun Jun 16 11:06:05 2002
>>***************
>>*** 831,836 ****
>>--- 831,849 ----
>>  dnl -------------------------------------------------------------------------
>>  
>>  dnl =========================================================================
>>+ dnl Compile specifically for PS2/Linux
>>+ dnl -------------------------------------------------------------------------
>>+ 
>>+ AC_ARG_ENABLE(ps2linux, [  --enable-ps2linux       Compile Specifically For PS2])
>>+ AC_MSG_CHECKING([whether to enable PS2/Linux Specific patches])
>>+ AC_MSG_RESULT($enable_ps2linux)
>>+ if test "x$enable_ps2linux" = "xyes"; then
>>+     AC_DEFINE([HAVE_PS2_LINUX], 1, [Enable PS2 Linux patches])
>>+ fi
>>+ 
>>+ dnl -------------------------------------------------------------------------
>>+ 
>>+ dnl =========================================================================
>>  dnl Checks for typedefs, structures, and compiler characteristics.
>>  dnl -------------------------------------------------------------------------
>>  
> 
> 
> 
> 
> _______________________________________________
> kaffe mailing list
> kaffe at kaffe.org
> http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
> 
> 






More information about the kaffe mailing list