From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkyiK-0001eG-Lp for qemu-devel@nongnu.org; Thu, 15 May 2014 12:41:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wkyi8-0005gy-F1 for qemu-devel@nongnu.org; Thu, 15 May 2014 12:41:00 -0400 Received: from mail-qg0-x234.google.com ([2607:f8b0:400d:c04::234]:46773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wkyi1-0005g3-4J for qemu-devel@nongnu.org; Thu, 15 May 2014 12:40:47 -0400 Received: by mail-qg0-f52.google.com with SMTP id a108so2203931qge.11 for ; Thu, 15 May 2014 09:40:40 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Thu, 15 May 2014 09:39:43 -0700 Message-Id: <1400171983-6015-12-git-send-email-rth@twiddle.net> In-Reply-To: <1400171983-6015-1-git-send-email-rth@twiddle.net> References: <1400171983-6015-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PULL 11/11] tcg-s390: Implement direct chaining of TBs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 9 +++++++++ tcg/s390/tcg-target.c | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 444b4d9..8bc2eb6 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -131,6 +131,7 @@ static inline void tlb_flush(CPUState *cpu, int flush_global) #if defined(__arm__) || defined(_ARCH_PPC) \ || defined(__x86_64__) || defined(__i386__) \ || defined(__sparc__) || defined(__aarch64__) \ + || defined(__s390x__) \ || defined(CONFIG_TCG_INTERPRETER) #define USE_DIRECT_JUMP #endif @@ -232,6 +233,14 @@ static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr) stl_le_p((void*)jmp_addr, addr - (jmp_addr + 4)); /* no need to flush icache explicitly */ } +#elif defined(__s390x__) +static inline void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr) +{ + /* patch the branch destination */ + intptr_t disp = addr - (jmp_addr - 2); + stl_be_p((void*)jmp_addr, disp / 2); + /* no need to flush icache explicitly */ +} #elif defined(__aarch64__) void aarch64_tb_set_jmp_target(uintptr_t jmp_addr, uintptr_t addr); #define tb_set_jmp_target1 aarch64_tb_set_jmp_target diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c index e235130..07164e5 100644 --- a/tcg/s390/tcg-target.c +++ b/tcg/s390/tcg-target.c @@ -1703,7 +1703,9 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc, case INDEX_op_goto_tb: if (s->tb_jmp_offset) { - tcg_abort(); + tcg_out16(s, RIL_BRCL | (S390_CC_ALWAYS << 4)); + s->tb_jmp_offset[args[0]] = tcg_current_code_size(s); + s->code_ptr += 2; } else { /* load address stored at s->tb_next + args[0] */ tcg_out_ld_abs(s, TCG_TYPE_PTR, TCG_TMP0, s->tb_next + args[0]); -- 1.9.0