All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-stable@nongnu.org
Cc: qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] target-i386: fix disassembly with PAE=1, PG=0
Date: Fri, 30 Aug 2013 12:05:05 +0200	[thread overview]
Message-ID: <52206E51.4090502@redhat.com> (raw)
In-Reply-To: <1377856725-32644-1-git-send-email-pbonzini@redhat.com>

Il 30/08/2013 11:58, Paolo Bonzini ha scritto:
> CR4.PAE=1 will not enable paging if CR0.PG=0, but the "if" chain
> in x86_cpu_get_phys_page_debug says otherwise.  Check CR0.PG
> before everything else.
> 
> Fixes "-d in_asm" for a code section at the beginning of OVMF.
> 
> Cc: Richard Henderson <rth@twiddle.net>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  target-i386/helper.c | 34 ++++++++++++++++------------------
>  1 file changed, 16 insertions(+), 18 deletions(-)
> 
> diff --git a/target-i386/helper.c b/target-i386/helper.c
> index bf3e2ac..7f74e5d 100644
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -894,7 +894,10 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
>      uint32_t page_offset;
>      int page_size;
>  
> -    if (env->cr[4] & CR4_PAE_MASK) {
> +    if (!(env->cr[0] & CR0_PG_MASK)) {
> +        pte = addr & env->a20_mask;
> +        page_size = 4096;
> +    } else if (env->cr[4] & CR4_PAE_MASK) {
>          target_ulong pdpe_addr;
>          uint64_t pde, pdpe;
>  
> @@ -952,26 +955,21 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
>      } else {
>          uint32_t pde;
>  
> -        if (!(env->cr[0] & CR0_PG_MASK)) {
> -            pte = addr;
> -            page_size = 4096;
> +        /* page directory entry */
> +        pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & 0xffc)) & env->a20_mask;
> +        pde = ldl_phys(pde_addr);
> +        if (!(pde & PG_PRESENT_MASK))
> +            return -1;
> +        if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) {
> +            pte = pde & ~0x003ff000; /* align to 4MB */
> +            page_size = 4096 * 1024;
>          } else {
>              /* page directory entry */
> -            pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & 0xffc)) & env->a20_mask;
> -            pde = ldl_phys(pde_addr);
> -            if (!(pde & PG_PRESENT_MASK))
> +            pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & env->a20_mask;
> +            pte = ldl_phys(pte_addr);
> +            if (!(pte & PG_PRESENT_MASK))
>                  return -1;
> -            if ((pde & PG_PSE_MASK) && (env->cr[4] & CR4_PSE_MASK)) {
> -                pte = pde & ~0x003ff000; /* align to 4MB */
> -                page_size = 4096 * 1024;
> -            } else {
> -                /* page directory entry */
> -                pte_addr = ((pde & ~0xfff) + ((addr >> 10) & 0xffc)) & env->a20_mask;
> -                pte = ldl_phys(pte_addr);
> -                if (!(pte & PG_PRESENT_MASK))
> -                    return -1;
> -                page_size = 4096;
> -            }
> +            page_size = 4096;
>          }
>          pte = pte & env->a20_mask;
>      }
> 

Should also go in qemu-stable.

Paolo

  reply	other threads:[~2013-08-30 10:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-30  9:58 [Qemu-devel] [PATCH] target-i386: fix disassembly with PAE=1, PG=0 Paolo Bonzini
2013-08-30 10:05 ` Paolo Bonzini [this message]
2013-08-30 17:50 ` Richard Henderson
2013-08-30 18:03 ` Max Filippov
2013-09-12 17:53 ` [Qemu-devel] ping " Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52206E51.4090502@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.