[kaffe] kaffe on oskit patches

Timothy Stack stack@cs.utah.edu
Wed Feb 12 10:49:01 2003


--%--multipart-mixed-boundary-1.6697.1045075778--%
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


hi,

I've attached some patches that fix the kaffe on oskit build.  The first 
file contains the necessary bits.  The second file contains a small 
(untested!) patch for using zip to make the jar file, which is needed when 
cross-compiling since the kaffe executable won't work.  The second patch 
is based on what is done in the JanosVM so it "should" work, or atleast 
come real close.

2003-02-12 Timothy S Stack <stack@cs.utah.edu>

	* config/i386/oskit/mkimage.sh:
	Fix the paths used to build the kernel image.
	(e.g. libexec/Kaffe -> jre/bin/kaffe-bin)

	* kaffe/kaffevm/systems/oskit-pthreads/jthread.h:
	Add jthread_relaxstack() function.

	* configure.in:
	Add AM_CONDITIONAL(HAVE_ZIP, ...) so make files can
	use a regular zip if its available.

	* libraries/javalib/Makefile.am:
	Use detected zip executable to build the JAR file,
	needed to work in a cross-compile environment.


thanks,

tim

--%--multipart-mixed-boundary-1.6697.1045075778--%
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Description: ASCII M4 macro language pre-processor text
Content-Disposition: attachment; filename="ok2.patch"

Index: configure.in
===================================================================
RCS file: /cvs/kaffe/kaffe/configure.in,v
retrieving revision 1.182
diff -u -r1.182 configure.in
--- configure.in	11 Feb 2003 21:58:42 -0000	1.182
+++ configure.in	12 Feb 2003 18:39:54 -0000
@@ -509,6 +509,8 @@
 AC_PROG_MAKE_SET
 AC_CHECK_PROG(ZIP, zip, zip)
 
+AM_CONDITIONAL(HAVE_ZIP, test x"$ZIP" != x"")
+
 dnl If symlink is overridden then don't bother with the test.
 if test x"$LN_S" = x"" ; then
 	AC_PROG_LN_S
Index: libraries/javalib/Makefile.am
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/Makefile.am,v
retrieving revision 1.94
diff -u -r1.94 Makefile.am
--- libraries/javalib/Makefile.am	11 Feb 2003 21:58:54 -0000	1.94
+++ libraries/javalib/Makefile.am	12 Feb 2003 18:40:19 -0000
@@ -2272,6 +2272,14 @@
 .PHONY: bootstrap
 bootstrap: $(srcdir)/Klasses.jar.bootstrap
 
+if HAVE_ZIP
+JAR_CMD1 = (cd $(srcdir) && $(ZIP) -r rt.tmp.jar META-INF) ; mv $(srcdir)/rt.tmp.jar rt.jar
+JAR_CMD2 = (cd $(LIBDIR) && $(ZIP) -DX -r ../rt.jar $(SRCDIRS))
+else
+JAR_CMD1 = $(JAR) -cvf rt.jar -C $(LIBDIR) $(SRCDIRS)
+JAR_CMD2 = $(JAR) -uvf rt.jar -C $(srcdir) META-INF/
+endif
+
 .PHONY: jar-classes
 jar-classes rt.jar: $(LIBDIR)/stamp
 	cp $(srcdir)/kaffe/lang/unicode.idx $(srcdir)/kaffe/lang/unicode.tbl $(LIBDIR)/kaffe/lang
@@ -2279,8 +2287,8 @@
 	for i in $(serialized_converters) ; do cp $(srcdir)/$$i $(LIBDIR)/$$i ; done
 	for i in $(gnu_regexp_message_bundles) ; do cp $(srcdir)/$$i $(LIBDIR)/$$i ; done
 	rm -f rt.jar
-	$(JAR) -cvf rt.jar -C $(LIBDIR) $(SRCDIRS)
-	$(JAR) -uvf rt.jar -C $(srcdir) META-INF/
+	$(JAR_CMD1)
+	$(JAR_CMD2)
 
 .PHONY: build-classes Klasses
 build-classes Klasses: rt.jar

--%--multipart-mixed-boundary-1.6697.1045075778--%
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Description: ASCII English text
Content-Disposition: attachment; filename="ok1.patch"

Index: config/i386/oskit/mkimage.sh
===================================================================
RCS file: /cvs/kaffe/kaffe/config/i386/oskit/mkimage.sh,v
retrieving revision 1.4
diff -u -r1.4 mkimage.sh
--- config/i386/oskit/mkimage.sh	6 Mar 2000 18:20:32 -0000	1.4
+++ config/i386/oskit/mkimage.sh	12 Feb 2003 18:40:33 -0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (c) 1998, 1999 The University of Utah. All rights reserved.
+# Copyright (c) 1998, 1999, 2003 The University of Utah. All rights reserved.
 #
 # See the file "license.terms" for information on usage and redistribution
 # of this file.
@@ -134,7 +134,7 @@
 CPF="$CLASSPATHFILE:/etc/kaffe_classpath"
 
 # The Kaffe kernel
-KAFFE=$KAFFEDIR/libexec/Kaffe
+KAFFE=$KAFFEDIR/jre/bin/kaffe-bin
 
 if test ! -x $KAFFE; then
     echo "ERROR: $KAFFE is not an executable."
@@ -142,7 +142,7 @@
 fi
 
 # The directory with the minimum necessary class files.
-CLASSDIR=$KAFFEDIR/share/kaffe
+CLASSDIR=$KAFFEDIR/jre/lib
 
 # The final list of directories
 DIRS="$CLASSDIR $DIRS"
@@ -192,7 +192,7 @@
 		done
 	done
 
-	for FILE in $KAFFEDIR/lib/kaffe/*.la
+	for FILE in $KAFFEDIR/jre/lib/i386/*.la
 	do
 		echo "$FILE:/lib/"$(basename $FILE)
 	done
Index: kaffe/kaffevm/systems/oskit-pthreads/jthread.h
===================================================================
RCS file: /cvs/kaffe/kaffe/kaffe/kaffevm/systems/oskit-pthreads/jthread.h,v
retrieving revision 1.8
diff -u -r1.8 jthread.h
--- kaffe/kaffevm/systems/oskit-pthreads/jthread.h	10 Dec 1999 07:49:04 -0000	1.8
+++ kaffe/kaffevm/systems/oskit-pthreads/jthread.h	12 Feb 2003 18:40:42 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, 2000 The University of Utah. All rights reserved.
+ * Copyright (c) 1998, 1999, 2000, 2003 The University of Utah. All rights reserved.
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file.
@@ -50,6 +50,8 @@
 	unsigned char		flags; 		  /* Thread flags */
 } *jthread_t;
 
+#define JTHREAD_FLAG_RELAXED 0x80
+
 /*
  * Map the cookie and jthread to pthread_setspecific.
  * The cookie is the Java_lang_thread class structure for the current thread.
@@ -221,6 +223,21 @@
 
 #define	REDZONE	1024
 
+static inline void
+jthread_relaxstack(int yes)
+{
+	jthread_t jtid = GET_JTHREAD();
+	
+	if( yes )
+	{
+		jtid->flags |= JTHREAD_FLAG_RELAXED;
+	}
+	else
+	{
+		jtid->flags &= ~JTHREAD_FLAG_RELAXED;
+	}
+}
+
 static inline void*
 jthread_stacklimit(void)
 {
@@ -233,7 +250,14 @@
 #if defined(STACK_GROWS_UP)
 #error FIXME
 #else
-        return (void*)(((long)(ps.stackbase)) + REDZONE);
+	if( jtid->flags & JTHREAD_FLAG_RELAXED )
+	{
+		return (void*)(((long)(ps.stackbase)));
+	}
+	else
+	{
+		return (void*)(((long)(ps.stackbase)) + REDZONE);
+	}
 #endif
 }
 

--%--multipart-mixed-boundary-1.6697.1045075778--%--