From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56970) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cfpLq-0001kZ-4C for qemu-devel@nongnu.org; Mon, 20 Feb 2017 09:54:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cfpLn-0006tA-KL for qemu-devel@nongnu.org; Mon, 20 Feb 2017 09:54:06 -0500 Received: from mail-yb0-x243.google.com ([2607:f8b0:4002:c09::243]:36064) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cfpLn-0006t5-Ft for qemu-devel@nongnu.org; Mon, 20 Feb 2017 09:54:03 -0500 Received: by mail-yb0-x243.google.com with SMTP id d128so885866ybh.3 for ; Mon, 20 Feb 2017 06:54:03 -0800 (PST) From: Pranith Kumar Date: Mon, 20 Feb 2017 09:53:35 -0500 Message-Id: <20170220145335.591-1-bobby.prani@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH] mttcg: Set jmp_env to handle exit from tb_gen_code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: alex.bennee@linaro.org Cc: qemu-devel@nongnu.org, rth@twiddle.net tb_gen_code() can exit execution using cpu_exit_loop() when it cannot allocate new tb's. To handle this, we need to properly set the jmp_env pointer ahead of calling tb_gen_code(). CC:Alex Bennée CC: Richard Henderson Signed-off-by: Pranith Kumar --- cpu-exec.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 97d79612d9..4b70988b24 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -236,23 +236,22 @@ static void cpu_exec_step(CPUState *cpu) cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); tb_lock(); - tb = tb_gen_code(cpu, pc, cs_base, flags, - 1 | CF_NOCACHE | CF_IGNORE_ICOUNT); - tb->orig_tb = NULL; - tb_unlock(); - - cc->cpu_exec_enter(cpu); - if (sigsetjmp(cpu->jmp_env, 0) == 0) { + tb = tb_gen_code(cpu, pc, cs_base, flags, + 1 | CF_NOCACHE | CF_IGNORE_ICOUNT); + tb->orig_tb = NULL; + tb_unlock(); + + cc->cpu_exec_enter(cpu); /* execute the generated code */ trace_exec_tb_nocache(tb, pc); cpu_tb_exec(cpu, tb); - } + cc->cpu_exec_exit(cpu); - cc->cpu_exec_exit(cpu); - tb_lock(); - tb_phys_invalidate(tb, -1); - tb_free(tb); + tb_lock(); + tb_phys_invalidate(tb, -1); + tb_free(tb); + } tb_unlock(); } -- 2.11.0