From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMVL4-0006tY-Hm for qemu-devel@nongnu.org; Tue, 04 Aug 2015 02:04:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZMVL3-00020e-DU for qemu-devel@nongnu.org; Tue, 04 Aug 2015 02:04:38 -0400 Received: from mail-io0-x229.google.com ([2607:f8b0:4001:c06::229]:33868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMVL3-00020W-6I for qemu-devel@nongnu.org; Tue, 04 Aug 2015 02:04:37 -0400 Received: by ioea135 with SMTP id a135so7153120ioe.1 for ; Mon, 03 Aug 2015 23:04:36 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <878u9xhel1.fsf@linaro.org> From: Naman patel Date: Tue, 4 Aug 2015 11:34:16 +0530 Message-ID: Content-Type: multipart/alternative; boundary=001a113f8ef28fd09c051c760fc3 Subject: Re: [Qemu-devel] Call Trace for QEMU functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: =?UTF-8?B?QWxleCBCZW5uw6ll?= , QEMU Developers --001a113f8ef28fd09c051c760fc3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Jul 31, 2015 at 3:32 PM, Peter Maydell wrote: > On 31 July 2015 at 10:29, Naman patel wrote: > > Can someone explain me what happens when a guest OS calls "invlpg" on s= ay > > page swap out or a context switch? What exactly is the call flow and ho= w > > QEMU handles this instruction? > > When we see the instruction during translation, we emit code > which will > =E2=80=8BIn which function does the translation takes place?=E2=80=8B > * get the argument to invlpg (extracting it from the > relevant register, adding any constant offset required for > the addressing mode, etc) > =E2=80=8BWhere exactly is it done?=E2=80=8B > * make a call to helper_inlvpg(). > (target-i386/translate.c has the C code that does this codegen -- > search for invlpg) > =E2=80=8BThanks I got this function.=E2=80=8B > > Later when that generated code is run, we call the helper, which > does what it needs to do (in this case flush a page from QEMU's > TLB cache). When the call returns we'll carry on executing whatever > guest instruction comes next. > > > Also is there anyway QEMU can send some data > > back to the guest OS? > > =E2=80=8B=E2=80=8B > INVLPG is just an x86 instruction that performs an operation; > it doesn't modify any registers or flags. So there's no way > for it to tell the guest OS anything. > =E2=80=8BTrue that =E2=80=8B =E2=80=8B INVLPG only invalidates a TLB entry but in general how can one send a data structure(DS) back to guest OS from QEMU? I want to write my own function that can send a DS back to the guest OS. Are there any similar functions already present that sends back DS to guest? Or is it feasible? > > -- PMM > =E2=80=8BThanks a lot for this information. It helped a lot. Regards, Naman=E2=80=8B --001a113f8ef28fd09c051c760fc3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Fri, Jul 31, 2015 at 3:32 PM, Peter Maydell <peter.ma= ydell@linaro.org> wrote:
On 31 July 2015 at 10:29, Naman patel <naman321@gmail.com> wrote:
> Can someone explain me what happens when a guest OS calls "invlpg= " on say
> page swap out or a context switch? What exactly is the call flow and h= ow
> QEMU handles this instruction?

When we see the instruction during translation, we emit code
which will
=E2=80=8BIn which= function does the translation takes place?=E2=80=8B
=C2=A0
=C2=A0* get the argument to invlpg (extracting it from the
relevant register, adding any constant offset required for
the addressing mode, etc)
= =E2=80=8BWhere exactly is it done?=E2=80=8B
=C2=A0
=C2=A0* make a call to helper_inlvpg().
(target-i386/translate.c has the C code that does this codegen --
search for invlpg)
=E2=80= =8BThanks I got this function.=E2=80=8B
=C2=A0

Later when that generated code is run, we call the helper, which
does what it needs to do (in this case flush a page from QEMU's
TLB cache). When the call returns we'll carry on executing whatever
guest instruction comes next.

> Also is there anyway QEMU can send some data
> back to the guest OS?

=E2=80=8B=E2=80=8B
INVLPG is just an = x86 instruction that performs an operation;
it doesn't modify any registers or flags. So there's no way
for it to tell the guest OS anything.
=E2=80=8BTrue that =E2=80= =8B
=E2=80=8B
INVLPG only invalidates = a TLB entry but in general how can one send a data structure(DS) back to gu= est OS from QEMU? I want to write my own function that can send a DS back t= o the guest OS. Are there any similar functions already present that sends = back DS to guest? Or is it=C2=A0feasible?

-- PMM


=E2=80=8BThanks a lot for this information. It= helped a lot.

Regards,
Naman=E2=80= =8B

--001a113f8ef28fd09c051c760fc3--