Received: from eggs.gnu.org ([208.118.235.92]:38543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SaM1M-0001sD-MX for qemu-devel@nongnu.org; Fri, 01 Jun 2012 03:11:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SaM1J-0008F7-AF for qemu-devel@nongnu.org; Fri, 01 Jun 2012 03:11:40 -0400 Received: from nm16-vm4.bullet.mail.tp2.yahoo.com ([203.188.201.141]:38201) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1SaM1H-0008A0-Vw for qemu-devel@nongnu.org; Fri, 01 Jun 2012 03:11:37 -0400 Message-ID: <1338534688.11726.YahooMailClassic@web92415.mail.cnh.yahoo.com> Date: Fri, 1 Jun 2012 15:11:28 +0800 (CST) From: =?utf-8?B?5ZC05pmT55CzICA=?= In-Reply-To: <20120531092141.GA80622@cs.nctu.edu.tw> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-302095473-1409795464-1338534688=:11726" Subject: Re: [Qemu-devel] general question List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: chenwj@iis.sinica.edu.tw Cc: jcmvbkbc@gmail.com, qemu-devel@nongnu.org ---302095473-1409795464-1338534688=:11726 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable My code calls the following macro, but nothing happens. #define invlpg_asm(pageaddr) do{\=09asm volatile("invlpg %0\n\t" \=09=09=09= :\=09=09=09:"m"(pageaddr)); \}while(0) pageaddr is the virtual address that needs to be invalidated. It is said that cup before i486 does not support "invlpg", how can I know t= he cupmodel of my emulator. Does my code go wrong, or the cpu of my emulator fail to support this instr= uction?=C2=A0 --- 12=E5=B9=B45=E6=9C=8831=E6=97=A5=EF=BC=8C=E5=91=A8=E5=9B=9B, =E9=99=B3= =E9=9F=8B=E4=BB=BB (Wei-Ren Chen) =E5=86=99=E9= =81=93=EF=BC=9A =E5=8F=91=E4=BB=B6=E4=BA=BA: =E9=99=B3=E9=9F=8B=E4=BB=BB (Wei-Ren Chen) =E4=B8=BB=E9=A2=98: Re: [Qemu-devel] general question =E6=94=B6=E4=BB=B6=E4=BA=BA: "Max Filippov" =E6=8A=84=E9=80=81: "=EF=BF=BD=EF=BF=BD=EF=BF=BDf=E4=BB=BB (Wei-Ren Chen)" = , "=E5=90=B4=E6=99=93=E7=90=B3" , qemu-devel@nongnu.org =E6=97=A5=E6=9C=9F: 2012=E5=B9=B45=E6=9C=8831=E6=97=A5,=E5=91=A8=E5=9B=9B,= =E4=B8=8B=E5=8D=885:21 > Hmmm, does it? >=20 > void helper_invlpg(target_ulong addr) > { >=C2=A0 =C2=A0=C2=A0=C2=A0helper_svm_check_intercept_param(SVM_EXIT_INVLPG,= 0); >=C2=A0 =C2=A0=C2=A0=C2=A0tlb_flush_page(env, addr); > } =C2=A0 I would be wrong, so let the code speak. ;) --- void tlb_flush_page(CPUArchState *env, target_ulong addr) { =C2=A0 =C2=A0 if ((addr & env->tlb_flush_mask) =3D=3D env->tlb_flush_addr) = { =C2=A0 =C2=A0 =C2=A0 =C2=A0 tlb_flush(env, 1); --- (1) =C2=A0 =C2=A0 =C2=A0 =C2=A0 return; =C2=A0 =C2=A0 } =C2=A0 =C2=A0 ... snip ... =C2=A0 =C2=A0 addr &=3D TARGET_PAGE_MASK; =C2=A0 =C2=A0 i =3D (addr >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1); =C2=A0 =C2=A0 for (mmu_idx =3D 0; mmu_idx < NB_MMU_MODES; mmu_idx++) { =C2=A0 =C2=A0 =C2=A0 =C2=A0 tlb_flush_entry(&env->tlb_table[mmu_idx][i], ad= dr); =C2=A0 =C2=A0 } =C2=A0 =C2=A0 tb_flush_jmp_cache(env, addr); } --- =C2=A0 The comment of tlb_flush (1) says, =C2=A0 =C2=A0 QEMU doesn't currently implement a global/not-global flag =C2=A0 =C2=A0 for tlb entries, at the moment tlb_flush() will also flush al= l =C2=A0 =C2=A0 tlb entries in the flush_global =3D=3D false case. That's why I get impression on QEMU flush the entire tlb. So it could flush particular tlb entry in tlb_flush_entry? Regards, chenwj --=20 Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj ---302095473-1409795464-1338534688=:11726 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
My code calls the following macro, but nothin= g happens.

#define invlpg_asm(pageaddr) do{\
<= div>=09asm = volatile("invlpg %0\n\t" \
=09=09=09:\
=09=09=09:"m"(pageaddr)); \
}while(0)

pageaddr is the virtual address that n= eeds to be invalidated.

It is said that cup before= i486 does not support "invlpg", how can I know the cup
model of = my emulator.

Does my code go wrong, or the cpu of = my emulator fail to support this instruction? 



--- 12=E5=B9=B45=E6=9C=8831=E6=97=A5=EF=BC=8C=E5=91=A8=E5=9B= =9B, =E9=99=B3=E9=9F=8B=E4=BB=BB (Wei-Ren Chen) <chenwj@iis.sinica.edu.tw> =E5=86=99=E9=81=93=EF=BC=9A

=E5=8F=91=E4=BB=B6=E4=BA=BA: =E9=99=B3=E9=9F= =8B=E4=BB=BB (Wei-Ren Chen) <chenwj@iis.sinica.edu.tw>
=E4=B8=BB= =E9=A2=98: Re: [Qemu-devel] general question
=E6=94=B6=E4=BB=B6=E4=BA=BA= : "Max Filippov" <jcmvbkbc@gmail.com>
=E6=8A=84=E9=80=81: "=EF=BF= =BD=EF=BF=BD=EF=BF=BDf=E4=BB=BB (Wei-Ren Chen)" <chenwj@iis.sinica.edu.t= w>, "=E5=90=B4=E6=99=93=E7=90=B3" <venusrobo@yahoo.cn>, qemu-devel= @nongnu.org
=E6=97=A5=E6=9C=9F: 2012=E5=B9=B45=E6=9C=8831=E6=97=A5,=E5= =91=A8=E5=9B=9B,=E4=B8=8B=E5=8D=885:21

>= Hmmm, does it?
>
> void helper_invlpg(target_ulong addr)
&= gt; {
>     helper_svm_check_intercept_param(SVM_= EXIT_INVLPG, 0);
>     tlb_flush_page(env, addr);=
> }

  I would be wrong, so let the code speak. ;)
---
void tlb_flush_page(CPUArchState *env, target_ulong addr)
{
&= nbsp;   if ((addr & env->tlb_flush_mask) =3D=3D env->tlb_flush_addr) {
    =     tlb_flush(env, 1); --- (1)
        ret= urn;
    }

    ... snip ...

  &nb= sp; addr &=3D TARGET_PAGE_MASK;
    i =3D (addr >> T= ARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
    for (mmu_idx = =3D 0; mmu_idx < NB_MMU_MODES; mmu_idx++) {
      &nbs= p; tlb_flush_entry(&env->tlb_table[mmu_idx][i], addr);
  &nb= sp; }

    tb_flush_jmp_cache(env, addr);
}
---
  The comment of tlb_flush (1) says,

    QEMU doesn= 't currently implement a global/not-global flag
    for tlb en= tries, at the moment tlb_flush() will also flush all
    tlb e= ntries in the flush_global =3D=3D false case.

That's why I get impre= ssion on QEMU flush the entire tlb. So it could flush
particular tlb ent= ry in tlb_flush_entry?

Regards,
chenwj

--
Wei-Ren Chen (=E9= =99=B3=E9=9F=8B=E4=BB=BB)
Computer Systems Lab, Institute of Information= Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667<= br>Homepage: http://people.cs.nctu.edu.tw/~chenwj
<= /div>
---302095473-1409795464-1338534688=:11726--