Patchwork monitor: Prevent sign-extension of 32-bit addresses printed by info tlb

login
register
mail settings
Submitter Austin Clements
Date Aug. 21, 2011, 6:49 p.m.
Message ID <1313952585-32210-1-git-send-email-amdragon@mit.edu>
Download mbox | patch
Permalink /patch/110837/
State New
Headers show

Comments

Austin Clements - Aug. 21, 2011, 6:49 p.m.
This is the same fix that was recently applied to info mem.  Before
this change, info tlb output looked like:

ffffffffffffc000: 000000000fffc000 --------W
ffffffffffffd000: 000000000fffd000 --------W
ffffffffffffe000: 000000000fffe000 --------W
fffffffffffff000: 000000000ffff000 --------W

With this change, it looks like

00000000ffffc000: 000000000fffc000 --------W
00000000ffffd000: 000000000fffd000 --------W
00000000ffffe000: 000000000fffe000 --------W
00000000fffff000: 000000000ffff000 --------W

Signed-off-by: Austin Clements <amdragon@mit.edu>
---
 monitor.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Blue Swirl - Aug. 21, 2011, 7:51 p.m.
Thanks, applied.

On Sun, Aug 21, 2011 at 6:49 PM, Austin Clements <amdragon@mit.edu> wrote:
> This is the same fix that was recently applied to info mem.  Before
> this change, info tlb output looked like:
>
> ffffffffffffc000: 000000000fffc000 --------W
> ffffffffffffd000: 000000000fffd000 --------W
> ffffffffffffe000: 000000000fffe000 --------W
> fffffffffffff000: 000000000ffff000 --------W
>
> With this change, it looks like
>
> 00000000ffffc000: 000000000fffc000 --------W
> 00000000ffffd000: 000000000fffd000 --------W
> 00000000ffffe000: 000000000fffe000 --------W
> 00000000fffff000: 000000000ffff000 --------W
>
> Signed-off-by: Austin Clements <amdragon@mit.edu>
> ---
>  monitor.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index 249f845..001a42b 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2199,7 +2199,7 @@ static void print_pte(Monitor *mon, target_phys_addr_t addr,
>
>  static void tlb_info_32(Monitor *mon, CPUState *env)
>  {
> -    int l1, l2;
> +    unsigned int l1, l2;
>     uint32_t pgd, pde, pte;
>
>     pgd = env->cr[3] & ~0xfff;
> @@ -2227,7 +2227,7 @@ static void tlb_info_32(Monitor *mon, CPUState *env)
>
>  static void tlb_info_pae32(Monitor *mon, CPUState *env)
>  {
> -    int l1, l2, l3;
> +    unsigned int l1, l2, l3;
>     uint64_t pdpe, pde, pte;
>     uint64_t pdp_addr, pd_addr, pt_addr;
>
> --
> 1.7.5.4
>
>
>

Patch

diff --git a/monitor.c b/monitor.c
index 249f845..001a42b 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2199,7 +2199,7 @@  static void print_pte(Monitor *mon, target_phys_addr_t addr,
 
 static void tlb_info_32(Monitor *mon, CPUState *env)
 {
-    int l1, l2;
+    unsigned int l1, l2;
     uint32_t pgd, pde, pte;
 
     pgd = env->cr[3] & ~0xfff;
@@ -2227,7 +2227,7 @@  static void tlb_info_32(Monitor *mon, CPUState *env)
 
 static void tlb_info_pae32(Monitor *mon, CPUState *env)
 {
-    int l1, l2, l3;
+    unsigned int l1, l2, l3;
     uint64_t pdpe, pde, pte;
     uint64_t pdp_addr, pd_addr, pt_addr;