Received: from eggs.gnu.org ([2001:4830:134:3::10]:39478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMBgT-00063D-4y for qemu-devel@nongnu.org; Tue, 26 Aug 2014 04:01:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMBgL-0002Ze-LH for qemu-devel@nongnu.org; Tue, 26 Aug 2014 04:00:53 -0400 Received: from mail.ispras.ru ([83.149.199.45]:34807) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMBgL-0002ZY-Df for qemu-devel@nongnu.org; Tue, 26 Aug 2014 04:00:45 -0400 From: "Pavel Dovgaluk" References: <20140731125321.1600.46604.stgit@PASHA-ISP.novsu.ac.ru> <20140731125452.1600.364.stgit@PASHA-ISP.novsu.ac.ru> <87lhr9ik6p.fsf@linaro.org> In-Reply-To: <87lhr9ik6p.fsf@linaro.org> Date: Tue, 26 Aug 2014 12:00:41 +0400 Message-ID: <000901cfc103$d611b0e0$823512a0$@Dovgaluk@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: ru Subject: Re: [Qemu-devel] [RFC PATCH v3 15/49] softmmu: fixing usage of cpu_st/ld* from helpers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?'Alex_Benn=C3=A9e'?= Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, mark.burton@greensocs.com, qemu-devel@nongnu.org, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, real@ispras.ru, pbonzini@redhat.com, afaerber@suse.de, fred.konrad@greensocs.com > From: Alex Benn=C3=A9e [mailto:alex.bennee@linaro.org] > Pavel Dovgalyuk writes: >=20 > > MMU helper functions are called from generated code and other helper > > functions. In both cases they try to get function's return address = for > > using it while restoring virtual CPU state. > > > > When MMU helper is called from some other helper function > > (like helper_maskmov_xmm) through cpu_st* function, the return = address > > will point to that helper. That is why CPU state cannot be restored = in > > the case of MMU fault. > > > > This patch introduces several inline helpers to load return address > > which points to the right place. > > > >=20 > OK I find it fairly hard to follow all the glue magic (not your fault > ;-) we have in QEMU. However wouldn't it be simpler for the helper > pre-amble code to ensure the subject pc is updated in the CPU > environment? Then I'll need to rewrite all helper calls or change their structure by adding code which restores the PC. > Can QEMU only rectify the processor state from a TranlationBlock tc = address? Current guest PC is not known during execution of the TB. When memory = access exception occurs, helpers have to evaluate guest PC using the host one. Host PC should point to the translated block and this patch eliminates = reading wrong host PC value during such recovery. Pavel Dovgalyuk