qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] SH4: Added monitoring of TLBs
@ 2009-02-16 22:39 Lionel Landwerlin
  2009-03-03  6:12 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Lionel Landwerlin @ 2009-02-16 22:39 UTC (permalink / raw)
  To: qemu-devel

This patch might interest some people trying (as I try to do) to fix
some tlbs for kernel/user space data sharing.


Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
---
 monitor.c |   35 +++++++++++++++++++++++++++++++++--
 1 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/monitor.c b/monitor.c
index 745c335..a9d378c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1245,6 +1245,35 @@ static void mem_info(void)
 }
 #endif
 
+#if defined(TARGET_SH4)
+
+static void print_tlb(int idx, tlb_t *tlb)
+{
+    term_printf(" tlb%i:\t"
+                "asid=%hhu vpn=%x\tppn=%x\tsz=%hhu size=%u\t"
+                "v=%hhu shared=%hhu cached=%hhu prot=%hhu "
+                "dirty=%hhu writethrough=%hhu\n",
+                idx,
+                tlb->asid, tlb->vpn, tlb->ppn, tlb->sz, tlb->size,
+                tlb->v, tlb->sh, tlb->c, tlb->pr,
+                tlb->d, tlb->wt);
+}
+
+static void tlb_info(void)
+{
+    CPUState *env = mon_get_cpu();
+    int i;
+
+    term_printf ("ITLB:\n");
+    for (i = 0 ; i < ITLB_SIZE ; i++)
+        print_tlb (i, &env->itlb[i]);
+    term_printf ("UTLB:\n");
+    for (i = 0 ; i < UTLB_SIZE ; i++)
+        print_tlb (i, &env->utlb[i]);
+}
+
+#endif
+
 static void do_info_kqemu(void)
 {
 #ifdef USE_KQEMU
@@ -1542,9 +1571,11 @@ static const term_cmd_t info_cmds[] = {
       "", "show i8259 (PIC) state", },
     { "pci", "", pci_info,
       "", "show PCI info", },
-#if defined(TARGET_I386)
+#if defined(TARGET_I386) || defined(TARGET_SH4)
     { "tlb", "", tlb_info,
       "", "show virtual to physical memory mappings", },
+#endif
+#if defined(TARGET_I386)
     { "mem", "", mem_info,
       "", "show the active virtual memory mappings", },
     { "hpet", "", do_info_hpet,
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] SH4: Added monitoring of TLBs
  2009-02-16 22:39 [Qemu-devel] [PATCH] SH4: Added monitoring of TLBs Lionel Landwerlin
@ 2009-03-03  6:12 ` Aurelien Jarno
  0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2009-03-03  6:12 UTC (permalink / raw)
  To: Lionel Landwerlin; +Cc: qemu-devel

On Mon, Feb 16, 2009 at 11:39:14PM +0100, Lionel Landwerlin wrote:
> This patch might interest some people trying (as I try to do) to fix
> some tlbs for kernel/user space data sharing.
> 
> 
> Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>

Thanks applied.

> ---
>  monitor.c |   35 +++++++++++++++++++++++++++++++++--
>  1 files changed, 33 insertions(+), 2 deletions(-)
> 
> diff --git a/monitor.c b/monitor.c
> index 745c335..a9d378c 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1245,6 +1245,35 @@ static void mem_info(void)
>  }
>  #endif
>  
> +#if defined(TARGET_SH4)
> +
> +static void print_tlb(int idx, tlb_t *tlb)
> +{
> +    term_printf(" tlb%i:\t"
> +                "asid=%hhu vpn=%x\tppn=%x\tsz=%hhu size=%u\t"
> +                "v=%hhu shared=%hhu cached=%hhu prot=%hhu "
> +                "dirty=%hhu writethrough=%hhu\n",
> +                idx,
> +                tlb->asid, tlb->vpn, tlb->ppn, tlb->sz, tlb->size,
> +                tlb->v, tlb->sh, tlb->c, tlb->pr,
> +                tlb->d, tlb->wt);
> +}
> +
> +static void tlb_info(void)
> +{
> +    CPUState *env = mon_get_cpu();
> +    int i;
> +
> +    term_printf ("ITLB:\n");
> +    for (i = 0 ; i < ITLB_SIZE ; i++)
> +        print_tlb (i, &env->itlb[i]);
> +    term_printf ("UTLB:\n");
> +    for (i = 0 ; i < UTLB_SIZE ; i++)
> +        print_tlb (i, &env->utlb[i]);
> +}
> +
> +#endif
> +
>  static void do_info_kqemu(void)
>  {
>  #ifdef USE_KQEMU
> @@ -1542,9 +1571,11 @@ static const term_cmd_t info_cmds[] = {
>        "", "show i8259 (PIC) state", },
>      { "pci", "", pci_info,
>        "", "show PCI info", },
> -#if defined(TARGET_I386)
> +#if defined(TARGET_I386) || defined(TARGET_SH4)
>      { "tlb", "", tlb_info,
>        "", "show virtual to physical memory mappings", },
> +#endif
> +#if defined(TARGET_I386)
>      { "mem", "", mem_info,
>        "", "show the active virtual memory mappings", },
>      { "hpet", "", do_info_hpet,
> -- 
> 1.5.6.5
> 
> 
> 
> 
> 
> 

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-03  6:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-16 22:39 [Qemu-devel] [PATCH] SH4: Added monitoring of TLBs Lionel Landwerlin
2009-03-03  6:12 ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).