From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO8qi-0007RL-JR for qemu-devel@nongnu.org; Fri, 15 Jul 2016 15:32:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bO8qe-0003KM-DA for qemu-devel@nongnu.org; Fri, 15 Jul 2016 15:32:35 -0400 Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]:33550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bO8qe-0003KF-54 for qemu-devel@nongnu.org; Fri, 15 Jul 2016 15:32:32 -0400 Received: by mail-lf0-x22e.google.com with SMTP id b199so95011005lfe.0 for ; Fri, 15 Jul 2016 12:32:31 -0700 (PDT) References: <1462962111-32237-1-git-send-email-sergey.fedorov@linaro.org> <1462962111-32237-5-git-send-email-sergey.fedorov@linaro.org> <861bc603-772f-4f32-1f43-802eb85e4f42@weilnetz.de> From: Sergey Fedorov Message-ID: <57893A4D.7040602@gmail.com> Date: Fri, 15 Jul 2016 22:32:29 +0300 MIME-Version: 1.0 In-Reply-To: <861bc603-772f-4f32-1f43-802eb85e4f42@weilnetz.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 4/5] cpu-exec: Move TB execution stuff out of cpu_exec() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil , Sergey Fedorov , Richard Henderson Cc: QEMU Developer On 15/07/16 09:45, Stefan Weil wrote: > Hi, > > Am 11.05.2016 um 12:21 schrieb Sergey Fedorov: > [...] >> int cpu_exec(CPUState *cpu) >> @@ -516,8 +576,6 @@ int cpu_exec(CPUState *cpu) >> CPUArchState *env = &x86_cpu->env; >> #endif >> int ret; >> - TranslationBlock *tb, *last_tb; >> - int tb_exit = 0; > Here tb_exit was only once set to 0, ... > >> SyncClocks sc; >> >> /* replay_interrupt may need current_cpu */ >> @@ -544,6 +602,9 @@ int cpu_exec(CPUState *cpu) >> init_delay_params(&sc, cpu); >> >> for(;;) { >> + TranslationBlock *tb, *last_tb; >> + int tb_exit = 0; > ... while now it is zeroed in each iteration of the for loop. > I'm not sure whether the new code is still correct. That is okay because 'tb_exit' only makes sense when "last_tb != NULL". But we always reset 'last_tb' in this loop: last_tb = NULL; /* forget the last executed TB after exception */ > > If it is, ... > >> + >> /* prepare setjmp context for exception handling */ >> if (sigsetjmp(cpu->jmp_env, 0) == 0) { > ... the declaration of tb_exit could also be done here, after the sigsetjmp. > That would fix a compiler warning which I get when compiling with > -Wclobbered: > > > cpu-exec.c:603:13: warning: variable ‘tb_exit’ might be clobbered by > ‘longjmp’ or ‘vfork’ [-Wclobbered] I've sent the patch to fix this: Message-Id: <20160715193123.28113-1-sergey.fedorov@linaro.org> Thanks, Sergey