Patchwork x86: Filter out garbage from segment flags dump

login
register
mail settings
Submitter Jan Kiszka
Date Dec. 27, 2010, 2:52 p.m.
Message ID <4D18A828.2040801@web.de>
Download mbox | patch
Permalink /patch/76788/
State New
Headers show

Comments

Jan Kiszka - Dec. 27, 2010, 2:52 p.m.
From: Jan Kiszka <jan.kiszka@siemens.com>

Only bits 8..23 of the segment flags contain valid data, so only dump
those when printing the CPU state.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 target-i386/helper.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Aurelien Jarno - Dec. 27, 2010, 9:03 p.m.
On Mon, Dec 27, 2010 at 03:52:24PM +0100, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Only bits 8..23 of the segment flags contain valid data, so only dump
> those when printing the CPU state.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  target-i386/helper.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Thanks, applied.

> diff --git a/target-i386/helper.c b/target-i386/helper.c
> index 26ea1e5..25a3e36 100644
> --- a/target-i386/helper.c
> +++ b/target-i386/helper.c
> @@ -175,12 +175,12 @@ cpu_x86_dump_seg_cache(CPUState *env, FILE *f, fprintf_function cpu_fprintf,
>  #ifdef TARGET_X86_64
>      if (env->hflags & HF_CS64_MASK) {
>          cpu_fprintf(f, "%-3s=%04x %016" PRIx64 " %08x %08x", name,
> -                    sc->selector, sc->base, sc->limit, sc->flags);
> +                    sc->selector, sc->base, sc->limit, sc->flags & 0x00ffff00);
>      } else
>  #endif
>      {
>          cpu_fprintf(f, "%-3s=%04x %08x %08x %08x", name, sc->selector,
> -                    (uint32_t)sc->base, sc->limit, sc->flags);
> +                    (uint32_t)sc->base, sc->limit, sc->flags & 0x00ffff00);
>      }
>  
>      if (!(env->hflags & HF_PE_MASK) || !(sc->flags & DESC_P_MASK))
> -- 
> 1.7.1
> 
>

Patch

diff --git a/target-i386/helper.c b/target-i386/helper.c
index 26ea1e5..25a3e36 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -175,12 +175,12 @@  cpu_x86_dump_seg_cache(CPUState *env, FILE *f, fprintf_function cpu_fprintf,
 #ifdef TARGET_X86_64
     if (env->hflags & HF_CS64_MASK) {
         cpu_fprintf(f, "%-3s=%04x %016" PRIx64 " %08x %08x", name,
-                    sc->selector, sc->base, sc->limit, sc->flags);
+                    sc->selector, sc->base, sc->limit, sc->flags & 0x00ffff00);
     } else
 #endif
     {
         cpu_fprintf(f, "%-3s=%04x %08x %08x %08x", name, sc->selector,
-                    (uint32_t)sc->base, sc->limit, sc->flags);
+                    (uint32_t)sc->base, sc->limit, sc->flags & 0x00ffff00);
     }
 
     if (!(env->hflags & HF_PE_MASK) || !(sc->flags & DESC_P_MASK))