--- kaffe/kaffevm/support.c.orig	Tue Mar 23 20:47:08 1999
+++ kaffe/kaffevm/support.c	Wed Aug 18 14:07:16 1999
@@ -25,9 +25,11 @@
 #include "stringSupport.h"
 #include "lookup.h"
 #include "exception.h"
+#include "support.h"
+#define NEED_sysdepCallMethod 1
+#include "classMethod.h"
 #include "slots.h"
 #include "machine.h"
-#include "support.h"
 #include "md.h"
 #include "itypes.h"
 #include "external.h"
--- config/i386/common.h.orig	Sat Dec 12 03:23:58 1998
+++ config/i386/common.h	Wed Aug 18 14:01:33 1999
@@ -22,6 +22,7 @@
  *  This function is mandatory for both JIT and Interpreter (since stubs
  *  have now been deprecated).
  */
+#if 0
 /* Jason <jbaker@cs.utah.edu> notes that we must not use %ebx because it's
  * used for shared lib support on ELF systems (Linux, FreeBSD3.0) and gcc
  * will not save it before it uses it again, despite what we say in asm().
@@ -64,4 +65,44 @@
 	asm volatile ("							\n\
 		subl %0,%%esp						\n\
 	" : : "r" ((CALL)->argsize * sizeof(jint)) : "cc")
+#else
+#if NEED_sysdepCallMethod
+static inline void sysdepCallMethod(callMethodInfo *call) {
+  unsigned args = call->nrargs;
+
+  /* Push all arguments into the stack, in last-to-first order.  This
+     assumes that the second 32bit-word of longs and doubles is
+     available as an additional int argument, as callMethod[AV]() do.  */
+  while (args > 0)
+    asm volatile ("pushl %0" : : "m" (call->args[--args].i) : "sp");
+
+  switch(call->retsize) {
+  case 0:
+    /* Must be void.  */
+    ((void (*)(void))(call->function))();
+    break;
+
+  case 1:
+    if (call->rettype == 'F')
+      call->ret->f = ((jfloat (*)(void))(call->function))();
+    else /* Must be 32-bit or smaller int.  */
+      call->ret->i = ((jint (*)(void))(call->function))();
+    break;
+
+  default:
+    /* It could've been `case 2;', but then we'd get an additional cmp
+     * that we don't really need.  */
+    if (call->rettype == 'D')
+      call->ret->d = ((jdouble (*)(void))(call->function))();
+    else /* Must be jlong.  */
+      call->ret->j = ((jlong (*)(void))(call->function))();
+    break;
+  }
+
+  /* Adjust the stack pointer.  */
+  asm volatile ("addl %0,%%esp" : :
+		"r" (call->argsize * sizeof(jint)) : "cc", "sp");
+}
+#endif
+#endif
 #endif
