diff -ruN powerpc.orig/jit.h powerpc/jit.h
--- powerpc.orig/jit.h	2004-12-05 14:50:35.356884096 +0200
+++ powerpc/jit.h	2004-12-03 18:27:38.000000000 +0200
@@ -94,8 +94,8 @@
  * Call a jitted java exception handler.
  */
 #define CALL_KAFFE_EXCEPTION(frame, handler, object) \
-	asm volatile ("mr r1, %0\n" \
-		      "\tmr r3, %1\n" \
+	asm volatile ("mr 1, %0\n" \
+		      "\tmr 3, %1\n" \
 		      "\tmtctr %2\n" \
 		      "\tbctr\n" \
 		      : : "r" (frame), "r" (object), "r" (handler) : "r3")
diff -ruN powerpc.orig/linux/jit3-md.h powerpc/linux/jit3-md.h
--- powerpc.orig/linux/jit3-md.h	1970-01-01 02:00:00.000000000 +0200
+++ powerpc/linux/jit3-md.h	2004-12-05 14:52:48.115701688 +0200
@@ -0,0 +1,39 @@
+/*
+ * powerpc/linux/jit3-md.h
+ * Linux i386 JIT 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.
+ *
+ * Shamelessly copied from the darwin version in the hope that it works
+ */
+
+#include "powerpc/linux/jit-md.h"
+
+#define FLUSH_DCACHE linux_flush_cache
+static inline void linux_flush_cache(void *code_start, void *code_end)
+{
+        /*
+	 *          * The size of a block in the cache, we need to align the flushed
+	 *                   * addresses to these blocks.
+	 *                            */
+	static int cache_block_size = 32; // bytes
+	uintp curr, last;
+	
+	curr = (uintp)code_start;
+	last = (uintp)code_end;
+	curr = (curr - cache_block_size) & ~(cache_block_size - 1);
+	last = (last + cache_block_size) & ~(cache_block_size - 1);
+	for( ; curr < last; curr += cache_block_size )
+	{
+		asm("dcbst 0, %0\n"
+		   "sync\n"
+		   "icbi 0, %0\n"
+		   "sync\n"
+		   "isync\n" : : "r" (curr));
+	}
+}
+
diff -ruN powerpc.orig/linux/jit-md.h powerpc/linux/jit-md.h
--- powerpc.orig/linux/jit-md.h	1970-01-01 02:00:00.000000000 +0200
+++ powerpc/linux/jit-md.h	2004-12-03 17:52:31.000000000 +0200
@@ -0,0 +1,20 @@
+/*
+ * powerpc/linux/jit-md.h
+ * Linux i386 JIT 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 __powerpc_linux_jit_md_h
+#define __powerpc_linux_jit_md_h
+
+/**/
+/* Include common information. */
+/**/
+#include "powerpc/jit.h"
+
+#endif
diff -ruN powerpc.orig/trampolines.c powerpc/trampolines.c
--- powerpc.orig/trampolines.c	2004-12-05 14:50:35.938795632 +0200
+++ powerpc/trampolines.c	2004-12-03 19:06:37.000000000 +0200
@@ -3,93 +3,114 @@
  *
  */
 
+#if defined(TRAMPOLINE_FUNCTION)
+/*
+ *  * If we have an explit function defined then use that.
+ *   */
+TRAMPOLINE_FUNCTION()
+
+#else
+	/*
+	 *  * Otherwise we'll try to construct one.
+	 *   */
+#if !defined(START_ASM_FUNC)
+#define START_ASM_FUNC() ".text\n\t.align 2\n\t.global "
+#endif
+#if !defined(END_ASM_FUNC)
+#define END_ASM_FUNC() ""
+#endif
+#if defined(HAVE_UNDERSCORED_C_NAMES)
+#define C_FUNC_NAME(FUNC) "_" #FUNC
+#else
+#define C_FUNC_NAME(FUNC) #FUNC
+#endif
+
 asm(
-	""
-	".text								\n"
-	".align  2							\n"
-	".globl _powerpc_do_fixup_trampoline				\n"
-	"								\n"
-"_powerpc_do_fixup_trampoline:						\n"
+	START_ASM_FUNC() C_FUNC_NAME(powerpc_do_fixup_trampoline) "	\n"
+C_FUNC_NAME(powerpc_do_fixup_trampoline) ": 				\n"
 	"								\n"
 	"# Function prologue: establish a minimum stack frame. We don't	\n"
-	"# save lr - it was already saved at 8(r1) by the trampoline	\n"
-	"# code. However, we must save r3 and r4, as we will use them	\n"
+	"# save lr - it was already saved at 8(1) by the trampoline	\n"
+	"# code. However, we must save 3 and 4, as we will use them	\n"
 	"# to call soft_fixup_trampoline().				\n"
-	"stwu r1, -192(r1)						\n"
-	"stw  r3, 56(r1)						\n"
-	"stw  r4, 60(r1)						\n"
-	"stw  r5, 64(r1)						\n"
-	"stw  r6, 68(r1)						\n"
-	"stw  r7, 72(r1)						\n"
-	"stw  r8, 76(r1)						\n"
-	"stw  r9, 80(r1)						\n"
-	"stw  r10, 84(r1)						\n"
-	"								\n"
-	"stfd  f1, 88(r1)						\n"
-	"stfd  f2, 96(r1)						\n"
-	"stfd  f3, 104(r1)						\n"
-	"stfd  f4, 112(r1)						\n"
-	"stfd  f5, 120(r1)						\n"
-	"stfd  f6, 128(r1)						\n"
-	"stfd  f7, 136(r1)						\n"
-	"stfd  f8, 144(r1)						\n"
-	"stfd  f9, 152(r1)						\n"
-	"stfd  f10, 160(r1)						\n"
-	"stfd  f11, 168(r1)						\n"
-	"stfd  f12, 176(r1)						\n"
-	"stfd  f13, 184(r1)						\n"
+	"stwu 1, -192(1)						\n"
+	"stw  3, 56(1)							\n"
+	"stw  4, 60(1)							\n"
+	"stw  5, 64(1)							\n"
+	"stw  6, 68(1)							\n"
+	"stw  7, 72(1)							\n"
+	"stw  8, 76(1)							\n"
+	"stw  9, 80(1)							\n"
+	"stw  10, 84(1)							\n"
+	"								\n"
+	"stfd  1, 88(1)							\n"
+	"stfd  2, 96(1)							\n"
+	"stfd  3, 104(1)						\n"
+	"stfd  4, 112(1)						\n"
+	"stfd  5, 120(1)						\n"
+	"stfd  6, 128(1)						\n"
+	"stfd  7, 136(1)						\n"
+	"stfd  8, 144(1)						\n"
+	"stfd  9, 152(1)						\n"
+	"stfd  10, 160(1)						\n"
+	"stfd  11, 168(1)						\n"
+	"stfd  12, 176(1)						\n"
+	"stfd  13, 184(1)						\n"
 	"								\n"
 	"# Build function call to soft_fixup_trampoline(). This function\n"
 	"# requires two arguments: a 'Method *m' and a 'void **where'.	\n"
 	"# They can be found immediately after the trampoline code which\n"
 	"# took us here - that is, at (lr) and 4(lr)			\n"
-	"mflr r4							\n"
-	"lwz  r3, 0(r4)							\n"
-	"lwz  r4, 4(r4)							\n"
+	"mflr 4								\n"
+	"lwz  3, 0(4)							\n"
+	"lwz  4, 4(4)							\n"
 	"								\n"
 	"# Call soft_fixup_trampoline(). Return value will be in r3, 	\n"
 	"# which is the address of the translated native code.		\n"
 	"								\n"
-	"bl _soft_fixup_trampoline					\n"
+	"bl " C_FUNC_NAME(soft_fixup_trampoline) "			\n"
 	"								\n"
 	"# Save return value in ctr, so that we can jump there at the	\n"
 	"# end of this function						\n"
-	"mtctr r3							\n"
+	"mtctr 3							\n"
 	"								\n"
 	"# Restore r3 and r4 (the original arguments to the native	\n"
 	"# method that we overwrote to call soft_fixup_trampoline)	\n"
-	"lwz  r3, 56(r1)						\n"
-	"lwz  r4, 60(r1)						\n"
-	"lwz  r5, 64(r1)						\n"
-	"lwz  r6, 68(r1)						\n"
-	"lwz  r7, 72(r1)						\n"
-	"lwz  r8, 76(r1)						\n"
-	"lwz  r9, 80(r1)						\n"
-	"lwz  r10, 84(r1)						\n"
-	"								\n"
-	"lfd  f1, 88(r1)						\n"
-	"lfd  f2, 96(r1)						\n"
-	"lfd  f3, 104(r1)						\n"
-	"lfd  f4, 112(r1)						\n"
-	"lfd  f5, 120(r1)						\n"
-	"lfd  f6, 128(r1)						\n"
-	"lfd  f7, 136(r1)						\n"
-	"lfd  f8, 144(r1)						\n"
-	"lfd  f9, 152(r1)						\n"
-	"lfd  f10, 160(r1)						\n"
-	"lfd  f11, 168(r1)						\n"
-	"lfd  f12, 176(r1)						\n"
-	"lfd  f13, 184(r1)						\n"
+	"lwz  3, 56(1)							\n"
+	"lwz  4, 60(1)							\n"
+	"lwz  5, 64(1)							\n"
+	"lwz  6, 68(1)							\n"
+	"lwz  7, 72(1)							\n"
+	"lwz  8, 76(1)							\n"
+	"lwz  9, 80(1)							\n"
+	"lwz  10, 84(1)							\n"
+	"								\n"
+	"lfd  1, 88(1)							\n"
+	"lfd  2, 96(1)							\n"
+	"lfd  3, 104(1)							\n"
+	"lfd  4, 112(1)							\n"
+	"lfd  5, 120(1)							\n"
+	"lfd  6, 128(1)							\n"
+	"lfd  7, 136(1)							\n"
+	"lfd  8, 144(1)							\n"
+	"lfd  9, 152(1)							\n"
+	"lfd  10, 160(1)						\n"
+	"lfd  11, 168(1)						\n"
+	"lfd  12, 176(1)						\n"
+	"lfd  13, 184(1)						\n"
 	"								\n"
 	"# Restore previous stack pointer				\n"
-	"addi r1, r1, 192						\n"
+	"addi 1, 1, 192							\n"
 	"								\n"
 	"# Restore Link Register before invoking native method, so that	\n"
 	"# it returns to the right place.				\n"
-	"lwz  r0, 8(r1)							\n"
-	"mtlr r0							\n"
+	"lwz  0, 8(1)							\n"
+	"mtlr 0								\n"
 	"								\n"
 	"# Jump to the native method address that we obtained as a	\n"
 	"# return value of soft_fixup_trampoline()			\n"
 	"bctr"
+	END_ASM_FUNC()
 );
+
+#endif
