[kaffe] [patch] parisc-linux port
Randolph Chung
tausq at debian.org
Sun Apr 21 12:34:30 PDT 2002
here's an initial patch for a parisc-linux port of kaffe. it really
doesn't do very much except lets you build it on parisc and pass some of
the simple test cases. i hope to do some more work on this soon.
if this looks ok, can someone please commit this to cvs?
thanks,
randolph
diff -uNr kaffe-1.0.6/config/parisc/common.h kaffe-1.0.6-hppa/config/parisc/common.h
--- kaffe-1.0.6/config/parisc/common.h Wed Sep 30 15:15:52 1998
+++ kaffe-1.0.6-hppa/config/parisc/common.h Sun Apr 21 12:20:00 2002
@@ -18,6 +18,14 @@
typedef jfloat f4int_f (int, int, int, int);
typedef jlong j4int_f (int, int, int, int);
+#define NEED_STACK_ALIGN
+#define STACK_ALIGN(p) ((((unsigned long)(p)) & 15) ^ (unsigned long)(p))
+
+#if NEED_sysdepCallMethod
+/* FIXME: this doesn't work for parisc-linux, because on parisc-linux
+ * there is no fparg relocation, so we cannot just pass everything in
+ * general purpose registers
+ */
#define sysdepCallMethod(CALL) \
do { \
int argidx; \
@@ -52,5 +60,27 @@
(CALL)->ret->j = \
((j4int_f *) ((CALL)->function)) (sa[0], sa[-1], sa[-2], sa[-3]); \
} while (0);
+#endif
+
+/*
+ * Do an atomic compare and exchange. The address 'A' is checked against
+ * value 'O' and if they match it's exchanged with value 'N'.
+ * We return '1' if the exchange is sucessful, otherwise 0.
+ *
+ * pa doesn't have an atomic compare-and-exchange instruction. we use
+ * a C version a la MIPS for now. Might not be SMP safe.
+ */
+#define COMPARE_AND_EXCHANGE(A,O,N) \
+({ \
+ int ret = 0; \
+ jthread_suspendall(); \
+ \
+ if (*(A) == (O)) { \
+ *(A) = (N); \
+ ret = 1; \
+ } \
+ jthread_unsuspendall(); \
+ ret; \
+})
#endif
diff -uNr kaffe-1.0.6/config/parisc/linux/config.frag kaffe-1.0.6-hppa/config/parisc/linux/config.frag
--- kaffe-1.0.6/config/parisc/linux/config.frag Wed Dec 31 16:00:00 1969
+++ kaffe-1.0.6-hppa/config/parisc/linux/config.frag Sun Apr 21 09:20:38 2002
@@ -0,0 +1,5 @@
+#
+# Parisc/linux configuration.
+#
+Khost_cpu=parisc
+Khost_os=linux
diff -uNr kaffe-1.0.6/config/parisc/linux/md.c kaffe-1.0.6-hppa/config/parisc/linux/md.c
--- kaffe-1.0.6/config/parisc/linux/md.c Wed Dec 31 16:00:00 1969
+++ kaffe-1.0.6-hppa/config/parisc/linux/md.c Sun Apr 21 09:27:44 2002
@@ -0,0 +1,88 @@
+/*
+ * parisc/linux/md.c
+ * Linux PArisc specific functions.
+ *
+ * Copyright (c) 1996, 1997
+ * Transvirtual Technologies, Inc. All rights reserved.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file.
+ */
+
+ asm(".text
+ .align 4
+ .EXPORT parisc_threadswitch,ENTRY,PRIV_LEV=3,RTNVAL=GR
+parisc_threadswitch:
+ .PROC
+ .CALLINFO FRAME=192
+ .ENTRY
+ ldo 192(%r30),%r30
+ stw %r2,-180(0,%r30)
+ stw %r2,-176(0,%r30)
+ stw %r3,-172(0,%r30)
+ stw %r4,-168(0,%r30)
+ stw %r5,-164(0,%r30)
+ stw %r6,-160(0,%r30)
+ stw %r7,-156(0,%r30)
+ stw %r8,-152(0,%r30)
+ stw %r9,-148(0,%r30)
+ stw %r10,-144(0,%r30)
+ stw %r11,-140(0,%r30)
+ stw %r12,-136(0,%r30)
+ stw %r13,-132(0,%r30)
+ stw %r14,-128(0,%r30)
+ stw %r15,-124(0,%r30)
+ stw %r16,-120(0,%r30)
+ stw %r17,-116(0,%r30)
+ stw %r18,-112(0,%r30)
+ ldo -104(%r30),%r1
+ fstds,ma %fr12,8(0,%r1)
+ fstds,ma %fr13,8(0,%r1)
+ fstds,ma %fr14,8(0,%r1)
+ fstds,ma %fr15,8(0,%r1)
+ fstds,ma %fr16,8(0,%r1)
+ fstds,ma %fr17,8(0,%r1)
+ fstds,ma %fr18,8(0,%r1)
+ fstds,ma %fr19,8(0,%r1)
+ fstds,ma %fr20,8(0,%r1)
+ fstds,ma %fr21,8(0,%r1)
+ stw %r30,0(0,%r26)
+ ldw 0(0,%r25),%r30
+ ldw -172(0,%r30),%r3
+ ldw -168(0,%r30),%r4
+ ldw -164(0,%r30),%r5
+ ldw -160(0,%r30),%r6
+ ldw -156(0,%r30),%r7
+ ldw -152(0,%r30),%r8
+ ldw -148(0,%r30),%r9
+ ldw -144(0,%r30),%r10
+ ldw -140(0,%r30),%r11
+ ldw -136(0,%r30),%r12
+ ldw -132(0,%r30),%r13
+ ldw -128(0,%r30),%r14
+ ldw -124(0,%r30),%r15
+ ldw -120(0,%r30),%r16
+ ldw -116(0,%r30),%r17
+ ldw -112(0,%r30),%r18
+ ldo -104(%r30),%r1
+ fldds,ma 8(0,%r1),%fr12
+ fldds,ma 8(0,%r1),%fr13
+ fldds,ma 8(0,%r1),%fr14
+ fldds,ma 8(0,%r1),%fr15
+ fldds,ma 8(0,%r1),%fr16
+ fldds,ma 8(0,%r1),%fr17
+ fldds,ma 8(0,%r1),%fr18
+ fldds,ma 8(0,%r1),%fr19
+ fldds,ma 8(0,%r1),%fr20
+ fldds,ma 8(0,%r1),%fr21
+ ldw -180(0,%r30),%r2
+ comib,<> 0,%r2,__nodyncall
+ nop
+ ldw -176(0,%r30),%r22
+ ldo -192(%r30),%r30
+ b,n $$dyncall
+__nodyncall:
+ bv 0(%r2)
+ ldo -192(%r30),%r30
+ .EXIT
+ .PROCEND");
diff -uNr kaffe-1.0.6/config/parisc/linux/md.h kaffe-1.0.6-hppa/config/parisc/linux/md.h
--- kaffe-1.0.6/config/parisc/linux/md.h Wed Dec 31 16:00:00 1969
+++ kaffe-1.0.6-hppa/config/parisc/linux/md.h Sun Apr 21 12:02:58 2002
@@ -0,0 +1,23 @@
+/*
+ * parisc/linux/md.h
+ * Linux PARISC configuration information.
+ *
+ * Copyright (c) 1996, 1997
+ * Transvirtual Technologies, Inc. All rights reserved.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file.
+ */
+
+#ifndef __parisc_linux_md_h
+#define __parisc_linux_md_h
+
+#include "parisc/common.h"
+#include "parisc/threads.h"
+
+#define LIBRARYPATH "SHLIB_PATH"
+#undef SP_OFFSET
+#define SP_OFFSET 19
+
+
+#endif
More information about the kaffe
mailing list