Skip to contentSkip to conversation

[4629] support of long calls for PPC (malc)

Qemu-devel Fabrice Bellard 1 participant 1 message May 30, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 4629

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4629
Author:   bellard
Date:     2008-05-30 20:56:52 +0000 (Fri, 30 May 2008)

Log Message:
-----------
support of long calls for PPC (malc)

Modified Paths:
--------------
trunk/exec-all.h
trunk/tcg/ppc/tcg-target.c
trunk/tcg/tcg.h

Modified: trunk/exec-all.h
===================================================================

exec-all.h +14 -3
@@ -187,12 +187,23 @@
 static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr)
 {
     uint32_t val, *ptr;
+    long disp = addr - jmp_addr;
 
-    /* patch the branch destination */
     ptr = (uint32_t *)jmp_addr;
     val = *ptr;
-    val = (val & ~0x03fffffc) | ((addr - jmp_addr) & 0x03fffffc);
-    *ptr = val;
+
+    if ((disp << 6) >> 6 != disp) {
+        uint16_t *p1;
+
+        p1 = (uint16_t *) ptr;
+        *ptr = (val & ~0x03fffffc) | 4;
+        p1[3] = addr >> 16;
+        p1[5] = addr & 0xffff;
+    } else {
+        /* patch the branch destination */
+        val = (val & ~0x03fffffc) | (disp & 0x03fffffc);
+        *ptr = val;
+    }
     /* flush icache */
     asm volatile ("dcbst 0,%0" : : "r"(ptr) : "memory");
     asm volatile ("sync" : : : "memory");

Modified: trunk/tcg/ppc/tcg-target.c
===================================================================

tcg/ppc/tcg-target.c +63 -31

189 lines not on this page · raw message

Modified: trunk/tcg/tcg.h
===================================================================

tcg/tcg.h +5 -0
@@ -410,4 +410,9 @@
 uint64_t tcg_helper_remu_i64(uint64_t arg1, uint64_t arg2);
 
 extern uint8_t code_gen_prologue[];
+#ifdef __powerpc__
+#define tcg_qemu_tb_exec(tb_ptr) \
+    ((long REGPARM __attribute__ ((longcall)) (*)(void *))code_gen_prologue)(tb_ptr)
+#else
 #define tcg_qemu_tb_exec(tb_ptr) ((long REGPARM (*)(void *))code_gen_prologue)(tb_ptr)
+#endif