From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KNvUc-0003Sf-OK for qemu-devel@nongnu.org; Tue, 29 Jul 2008 16:08:22 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KNvUc-0003Rn-4F for qemu-devel@nongnu.org; Tue, 29 Jul 2008 16:08:22 -0400 Received: from [199.232.76.173] (port=46030 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KNvUb-0003Rk-Vo for qemu-devel@nongnu.org; Tue, 29 Jul 2008 16:08:22 -0400 Received: from savannah.gnu.org ([199.232.41.3]:55020 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KNvUb-00012c-Jt for qemu-devel@nongnu.org; Tue, 29 Jul 2008 16:08:21 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KNvUY-0005Df-4Y for qemu-devel@nongnu.org; Tue, 29 Jul 2008 20:08:18 +0000 Received: from malc by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KNvUX-0005Db-Vz for qemu-devel@nongnu.org; Tue, 29 Jul 2008 20:08:18 +0000 MIME-Version: 1.0 Errors-To: malc Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: malc Message-Id: Date: Tue, 29 Jul 2008 20:08:18 +0000 Subject: [Qemu-devel] [4974] On ppc32 make tb_set_jmp_target1 behave like it does on a ppc64 Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4974 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4974 Author: malc Date: 2008-07-29 20:08:17 +0000 (Tue, 29 Jul 2008) Log Message: ----------- On ppc32 make tb_set_jmp_target1 behave like it does on a ppc64 Avoids nasty warnings about flush_icache_range from gcc4 and inability to compile [cpu-]exec.c with gcc3 and -O, also the function is much too large to be candidate for inlining anyway. Modified Paths: -------------- trunk/exec-all.h trunk/tcg/ppc/tcg-target.c Modified: trunk/exec-all.h =================================================================== --- trunk/exec-all.h 2008-07-29 20:00:31 UTC (rev 4973) +++ trunk/exec-all.h 2008-07-29 20:08:17 UTC (rev 4974) @@ -191,43 +191,8 @@ #if defined(USE_DIRECT_JUMP) #if defined(__powerpc__) -#if defined(__powerpc64__) extern void ppc_tb_set_jmp_target(unsigned long jmp_addr, unsigned long addr); #define tb_set_jmp_target1 ppc_tb_set_jmp_target -#else -static inline void flush_icache_range(unsigned long start, unsigned long stop); -static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr) -{ - /* This must be in concord with INDEX_op_goto_tb inside tcg_out_op */ - uint32_t *ptr; - long disp = addr - jmp_addr; - unsigned long patch_size; - - ptr = (uint32_t *)jmp_addr; - - if ((disp << 6) >> 6 != disp) { - ptr[0] = 0x3c000000 | (addr >> 16); /* lis 0,addr@ha */ - ptr[1] = 0x60000000 | (addr & 0xffff); /* la 0,addr@l(0) */ - ptr[2] = 0x7c0903a6; /* mtctr 0 */ - ptr[3] = 0x4e800420; /* brctr */ - patch_size = 16; - } else { - /* patch the branch destination */ - if (disp != 16) { - *ptr = 0x48000000 | (disp & 0x03fffffc); /* b disp */ - patch_size = 4; - } else { - ptr[0] = 0x60000000; /* nop */ - ptr[1] = 0x60000000; - ptr[2] = 0x60000000; - ptr[3] = 0x60000000; - patch_size = 16; - } - } - /* flush icache */ - flush_icache_range(jmp_addr, jmp_addr + patch_size); -} -#endif #elif defined(__i386__) || defined(__x86_64__) static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr) { Modified: trunk/tcg/ppc/tcg-target.c =================================================================== --- trunk/tcg/ppc/tcg-target.c 2008-07-29 20:00:31 UTC (rev 4973) +++ trunk/tcg/ppc/tcg-target.c 2008-07-29 20:08:17 UTC (rev 4974) @@ -1015,6 +1015,37 @@ tcg_out_bc (s, (BC | BI (7, CR_EQ) | BO_COND_TRUE), label_index); } +void ppc_tb_set_jmp_target (unsigned long jmp_addr, unsigned long addr) +{ + uint32_t *ptr; + long disp = addr - jmp_addr; + unsigned long patch_size; + + ptr = (uint32_t *)jmp_addr; + + if ((disp << 6) >> 6 != disp) { + ptr[0] = 0x3c000000 | (addr >> 16); /* lis 0,addr@ha */ + ptr[1] = 0x60000000 | (addr & 0xffff); /* la 0,addr@l(0) */ + ptr[2] = 0x7c0903a6; /* mtctr 0 */ + ptr[3] = 0x4e800420; /* brctr */ + patch_size = 16; + } else { + /* patch the branch destination */ + if (disp != 16) { + *ptr = 0x48000000 | (disp & 0x03fffffc); /* b disp */ + patch_size = 4; + } else { + ptr[0] = 0x60000000; /* nop */ + ptr[1] = 0x60000000; + ptr[2] = 0x60000000; + ptr[3] = 0x60000000; + patch_size = 16; + } + } + /* flush icache */ + flush_icache_range(jmp_addr, jmp_addr + patch_size); +} + static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args, const int *const_args) {