[kaffe] PS2/Linux patch take 5
Dylan Schell
dylans@xs4all.nl
Mon, 17 Jun 2002 01:43:38 +0200
This is a multi-part message in MIME format.
--------------070300040407090109060306
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Since the THREADSTACKSIZE using the default value is
seems to be reasonably normal (output of StackSizer)
Overflowed at 1239
Overflowed at 59
I removed the changes in config/mips/threads.h
(I was under the impression that this had to do
with register size, but apparantly the impact is
smaller than I initially thought. (and since the PS2
is limited to "only" 32 MB, memory is certainly at
a premium.
I also added a small comment to config/mips.common.h
explaining some of the PS2's "weirdness"
Hope this will be the last change for today :-)
Greetings,
Dylan Schell
dylans@xs4all.nl
--------------070300040407090109060306
Content-Type: text/plain;
name="kaffe-ps2-take5.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="kaffe-ps2-take5.patch"
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 Mon Jun 17 01:08:31 2002
***************
*** 15,20 ****
--- 15,32 ----
#ifndef __mips_common_h
#define __mips_common_h
+ /* The R5900 is the Mips Core in the PS2 (Playstation 2)
+ * It has most of the Mips III instructions set, some of the Mips IV
+ * instructions, it lacks the Mips II "ll" and "sc" instructions and
+ * it has 128 bit GP registers and 32 bit FPU registers. There is no
+ * FPU Emulation present in the default kernel. Since no 64 bit
+ * FPU registers exist, doubles are passed in 2 GP registers.
+ */
+ #ifdef _R5900
+ #define PS2LINUX
+ #undef HAVE_MIPSII_INSTRUCTIONS
+ #endif
+
#if NEED_sysdepCallMethod
#if !defined (_MIPS_SIM) || (_MIPS_SIM == _MIPS_SIM_ABI32)
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 Mon Jun 17 01:00:23 2002
***************
*** 21,26 ****
--- 21,31 ----
#define SP_OFFSET 1
#define FP_OFFSET 10
+ #ifdef PS2LINUX
+ #undef FP_OFFSET
+ #define FP_OFFSET 36
+ #endif
+
#if defined(TRANSLATOR)
#include "jit-md.h"
#endif
***************
*** 28,34 ****
--- 33,43 ----
/**/
/* Signal handling */
/**/
+ #ifdef PS2LINUX
+ #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 Mon Jun 17 00:59:46 2002
***************
*** 19,25 ****
--- 19,31 ----
#include "object.h"
#include "support.h"
#include "../../kaffe/kaffevm/thread.h"
+ #include "common.h"
+ #ifdef PS2LINUX
+ # 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 Mon Jun 17 00:57:44 2002
***************
*** 103,110 ****
--- 103,120 ----
register ARG_TYPE a2 asm("$6");
register ARG_TYPE a3 asm("$7");
+ #ifdef PS2LINUX
+ 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 PS2LINUX
+ 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 PS2LINUX
+ /* 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 PS2LINUX
+ asm ("" :: "f" (f0), "f" (f2));
+ #else
asm ("" :: "f" (f0), "f" (f2), "f" (d0), "f" (d2));
+ #endif
switch(call->retsize) {
case 0:
--------------070300040407090109060306--