All of lore.kernel.org
 help / color / mirror / Atom feed
* Valgrind : Unhanded instructions mfatbu and mfatbl
@ 2012-01-13  5:43 Bansal Aneesh-B39320
  2012-01-13  7:34 ` Khem Raj
  0 siblings, 1 reply; 4+ messages in thread
From: Bansal Aneesh-B39320 @ 2012-01-13  5:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Garg Vakul-B16394


[-- Attachment #1.1: Type: text/plain, Size: 1714 bytes --]

Hello,

PowerPC uses two alternate time base registers which are read from user space
by using PPC instructions mfatbu and mfatbl . However these instructions are
not supported by Valgrind.
CPU : e500mc
Here are the logs when an application executing such instruction is executed
with Valgrind 3.7.0:

dis_proc_ctl(ppc)(mfspr,SPR)(0x20F)
disInstr(ppc): unhandled instruction: 0x7C0F82A6
                 primary 31(0x1F), secondary 678(0x2A6)
==2204== valgrind: Unrecognized instruction at address 0x10003dfc.
==2204==    at 0x10003DFC: ??? (in /usr/bin/simple_crypto)
==2204==    by 0x1000181B: ??? (in /usr/bin/simple_crypto)
==2204==    by 0xFE179E7: ??? (in /lib/libpthread-2.13.so)
==2204==    by 0x40EEA9B: ??? (in /lib/libc-2.13.so)
==2204== Your program just tried to execute an instruction that Valgrind
==2204== did not recognise.  There are two possible reasons for this.
==2204== 1. Your program has a bug and erroneously jumped to a non-code
==2204==    location.  If you are running Memcheck and you just saw a
==2204==    warning about a bad jump, it's probably your program's fault.
==2204== 2. The instruction is legitimate but Valgrind doesn't handle it,
==2204==    i.e. it's Valgrind's fault.  If you think this is the case or
==2204==    you are not sure, please let us know and we'll try to fix it.
==2204== Either way, Valgrind will now raise a SIGILL signal which will
==2204== probably kill your program.


We have developed a patch to fix the issue and submitted the patch upstream to Valgrind community for processing.


Regards,
Aneesh Bansal
[cid:image001.jpg@01CCD1E4.693FCF80]
Plot No. - 18 | Sector-16 A, Noida - 201301
Phone  : 0120395 x3320


[-- Attachment #1.2: Type: text/html, Size: 7916 bytes --]

[-- Attachment #2: image001.jpg --]
[-- Type: image/jpeg, Size: 1078 bytes --]

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

* Re: Valgrind : Unhanded instructions mfatbu and mfatbl
  2012-01-13  5:43 Valgrind : Unhanded instructions mfatbu and mfatbl Bansal Aneesh-B39320
@ 2012-01-13  7:34 ` Khem Raj
  2012-01-16  5:42   ` Bansal Aneesh-B39320
  0 siblings, 1 reply; 4+ messages in thread
From: Khem Raj @ 2012-01-13  7:34 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Garg Vakul-B16394

[-- Attachment #1: Type: text/plain, Size: 2514 bytes --]

On Thu, Jan 12, 2012 at 9:43 PM, Bansal Aneesh-B39320
<B39320@freescale.com>wrote:

>  Hello,****
>
> ** **
>
> PowerPC uses two alternate time base registers which are read from user
> space****
>
> by using PPC instructions mfatbu and mfatbl . However these instructions
> are****
>
> not supported by Valgrind.****
>
> CPU : e500mc****
>
> Here are the logs when an application executing such instruction is
> executed****
>
> with Valgrind 3.7.0:****
>
> ** **
>
> dis_proc_ctl(ppc)(mfspr,SPR)(0x20F)****
>
> disInstr(ppc): unhandled instruction: 0x7C0F82A6****
>
>                  primary 31(0x1F), secondary 678(0x2A6)****
>
> ==2204== valgrind: Unrecognized instruction at address 0x10003dfc.****
>
> ==2204==    at 0x10003DFC: ??? (in /usr/bin/simple_crypto)****
>
> ==2204==    by 0x1000181B: ??? (in /usr/bin/simple_crypto)****
>
> ==2204==    by 0xFE179E7: ??? (in /lib/libpthread-2.13.so)****
>
> ==2204==    by 0x40EEA9B: ??? (in /lib/libc-2.13.so)****
>
> ==2204== Your program just tried to execute an instruction that Valgrind**
> **
>
> ==2204== did not recognise.  There are two possible reasons for this.****
>
> ==2204== 1. Your program has a bug and erroneously jumped to a non-code***
> *
>
> ==2204==    location.  If you are running Memcheck and you just saw a****
>
> ==2204==    warning about a bad jump, it's probably your program's fault.*
> ***
>
> ==2204== 2. The instruction is legitimate but Valgrind doesn't handle it,*
> ***
>
> ==2204==    i.e. it's Valgrind's fault.  If you think this is the case or*
> ***
>
> ==2204==    you are not sure, please let us know and we'll try to fix it.*
> ***
>
> ==2204== Either way, Valgrind will now raise a SIGILL signal which will***
> *
>
> ==2204== probably kill your program.****
>
> ** **
>
> ** **
>
> We have developed a patch to fix the issue and submitted the patch
> upstream to Valgrind community for processing.
>


how about you also submit the patch to oe-core as well
so we can use it until the upstream patch lands in a release
that we will use


> ****
>
> ** **
>
> ** **
>
> Regards,****
>
> *Aneesh Bansal*
>
> **
>
> Plot No. – 18 | Sector-16 A, Noida – 201301****
>
> Phone  : 0120395 x3320****
>
> ** **
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
>

[-- Attachment #2: Type: text/html, Size: 6494 bytes --]

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

* Re: Valgrind : Unhanded instructions mfatbu and mfatbl
  2012-01-13  7:34 ` Khem Raj
@ 2012-01-16  5:42   ` Bansal Aneesh-B39320
  2012-02-08 21:58     ` McClintock Matthew-B29882
  0 siblings, 1 reply; 4+ messages in thread
From: Bansal Aneesh-B39320 @ 2012-01-16  5:42 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Garg Vakul-B16394


[-- Attachment #1.1: Type: text/plain, Size: 2668 bytes --]

Please find the patch attached in the mail.

Regards,
Aneesh Bansal

From: openembedded-core-bounces@lists.openembedded.org [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of Khem Raj
Sent: Friday, January 13, 2012 1:04 PM
To: Patches and discussions about the oe-core layer
Cc: Garg Vakul-B16394
Subject: Re: [OE-core] Valgrind : Unhanded instructions mfatbu and mfatbl


On Thu, Jan 12, 2012 at 9:43 PM, Bansal Aneesh-B39320 <B39320@freescale.com<mailto:B39320@freescale.com>> wrote:
Hello,

PowerPC uses two alternate time base registers which are read from user space
by using PPC instructions mfatbu and mfatbl . However these instructions are
not supported by Valgrind.
CPU : e500mc
Here are the logs when an application executing such instruction is executed
with Valgrind 3.7.0:

dis_proc_ctl(ppc)(mfspr,SPR)(0x20F)
disInstr(ppc): unhandled instruction: 0x7C0F82A6
                 primary 31(0x1F), secondary 678(0x2A6)
==2204== valgrind: Unrecognized instruction at address 0x10003dfc.
==2204==    at 0x10003DFC: ??? (in /usr/bin/simple_crypto)
==2204==    by 0x1000181B: ??? (in /usr/bin/simple_crypto)
==2204==    by 0xFE179E7: ??? (in /lib/libpthread-2.13.so<http://libpthread-2.13.so>)
==2204==    by 0x40EEA9B: ??? (in /lib/libc-2.13.so<http://libc-2.13.so>)
==2204== Your program just tried to execute an instruction that Valgrind
==2204== did not recognise.  There are two possible reasons for this.
==2204== 1. Your program has a bug and erroneously jumped to a non-code
==2204==    location.  If you are running Memcheck and you just saw a
==2204==    warning about a bad jump, it's probably your program's fault.
==2204== 2. The instruction is legitimate but Valgrind doesn't handle it,
==2204==    i.e. it's Valgrind's fault.  If you think this is the case or
==2204==    you are not sure, please let us know and we'll try to fix it.
==2204== Either way, Valgrind will now raise a SIGILL signal which will
==2204== probably kill your program.


We have developed a patch to fix the issue and submitted the patch upstream to Valgrind community for processing.


how about you also submit the patch to oe-core as well
so we can use it until the upstream patch lands in a release
that we will use



Regards,
Aneesh Bansal
Error! Filename not specified.
Plot No. – 18 | Sector-16 A, Noida – 201301
Phone  : 0120395 x3320


_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org<mailto:Openembedded-core@lists.openembedded.org>
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core


[-- Attachment #1.2: Type: text/html, Size: 12186 bytes --]

[-- Attachment #2: 0001-add-mfatbu-mfatbl-instructions-support-in-Valgrind.patch --]
[-- Type: application/octet-stream, Size: 5264 bytes --]

From 71cd76583abf819de5adc7b66951453ff1962875 Mon Sep 17 00:00:00 2001
From: Aneesh Bansal <aneesh.bansal@freescale.com>
Date: Thu, 12 Jan 2012 17:02:39 +0530
Subject: [PATCH] add mfatbu/mfatbl instructions support in Valgrind
Valgrind does not support alternate time base registers used by PPC instructions mfatbu and mfatbl.

Upstream Status : Pending

---
 ...upport-for-PPC-instructions-mfatbu-mfatbl.patch |   94 ++++++++++++++++++++
 meta/recipes-devtools/valgrind/valgrind_3.7.0.bb   |    3 +-
 2 files changed, 96 insertions(+), 1 deletions(-)
 create mode 100644 meta/recipes-devtools/valgrind/valgrind-3.7.0/Added-support-for-PPC-instructions-mfatbu-mfatbl.patch

diff --git a/meta/recipes-devtools/valgrind/valgrind-3.7.0/Added-support-for-PPC-instructions-mfatbu-mfatbl.patch b/meta/recipes-devtools/valgrind/valgrind-3.7.0/Added-support-for-PPC-instructions-mfatbu-mfatbl.patch
new file mode 100644
index 0000000..ca66bc7
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind-3.7.0/Added-support-for-PPC-instructions-mfatbu-mfatbl.patch
@@ -0,0 +1,94 @@
+From 0bf4b0ac18d1ea41b32ad781d214b295ca1998f3 Mon Sep 17 00:00:00 2001
+From: Aneesh Bansal <aneesh.bansal@freescale.com>
+Date: Mon, 21 Nov 2011 17:31:39 +0530
+Subject: [PATCH] Added support for PPC instructions mfatbu, mfatbl.
+
+Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
+---
+Currently Valgrind 3.7.0 does not have support for PPC instructions mfatbu and mfatbl. When we run a USDPAA application with VALGRIND, the following error is given by valgrind :
+dis_proc_ctl(ppc)(mfspr,SPR)(0x20F)
+disInstr(ppc): unhandled instruction: 0x7C0F82A6
+
+
+ VEX/priv/guest_ppc_defs.h    |    2 ++
+ VEX/priv/guest_ppc_helpers.c |   18 ++++++++++++++++++
+ VEX/priv/guest_ppc_toIR.c    |   22 ++++++++++++++++++++++
+ 3 files changed, 42 insertions(+), 0 deletions(-)
+
+diff --git a/VEX/priv/guest_ppc_defs.h b/VEX/priv/guest_ppc_defs.h
+index dd3c62e..11a34aa 100644
+--- a/VEX/priv/guest_ppc_defs.h
++++ b/VEX/priv/guest_ppc_defs.h
+@@ -146,6 +146,8 @@ extern UInt ppc32g_dirtyhelper_MFSPR_268_269 ( UInt );
+ 
+ extern UInt ppc32g_dirtyhelper_MFSPR_287 ( void );
+ 
++extern UInt ppc32g_dirtyhelper_MFSPR_526_527 ( UInt );
++
+ extern void ppc32g_dirtyhelper_LVS ( VexGuestPPC32State* gst,
+                                      UInt vD_idx, UInt sh,
+                                      UInt shift_right );
+diff --git a/VEX/priv/guest_ppc_helpers.c b/VEX/priv/guest_ppc_helpers.c
+index 11aa428..b49ea3f 100644
+--- a/VEX/priv/guest_ppc_helpers.c
++++ b/VEX/priv/guest_ppc_helpers.c
+@@ -119,6 +119,24 @@ UInt ppc32g_dirtyhelper_MFSPR_287 ( void )
+ #  endif
+ }
+ 
++/* CALLED FROM GENERATED CODE */
++/* DIRTY HELPER (non-referentially transparent) */
++UInt ppc32g_dirtyhelper_MFSPR_526_527 ( UInt r527 )
++{
++#  if defined(__powerpc__) || defined(_AIX)
++   UInt spr;
++   if (r527) {
++      __asm__ __volatile__("mfspr %0,527" : "=b"(spr));
++   } else {
++      __asm__ __volatile__("mfspr %0,526" : "=b"(spr));
++   }
++   return spr;
++#  else
++   return 0;
++#  endif
++}
++
++
+ 
+ /* CALLED FROM GENERATED CODE */
+ /* DIRTY HELPER (reads guest state, writes guest mem) */
+diff --git a/VEX/priv/guest_ppc_toIR.c b/VEX/priv/guest_ppc_toIR.c
+index f8d220d..37c8974 100644
+--- a/VEX/priv/guest_ppc_toIR.c
++++ b/VEX/priv/guest_ppc_toIR.c
+@@ -5657,6 +5657,28 @@ static Bool dis_proc_ctl ( VexAbiInfo* vbi, UInt theInstr )
+          break;
+       }
+ 
++
++      case 526 /* 0x20E */:
++      case 527 /* 0x20F */: {
++         UInt     arg  = SPR==526 ? 0 : 1;
++         IRTemp   val  = newTemp(Ity_I32);
++         IRExpr** args = mkIRExprVec_1( mkU32(arg) );
++         IRDirty* d    = unsafeIRDirty_1_N(
++                            val,
++                            0/*regparms*/,
++                            "ppc32g_dirtyhelper_MFSPR_526_527",
++                            fnptr_to_fnentry
++                               (vbi, &ppc32g_dirtyhelper_MFSPR_526_527),
++                            args
++                         );
++         /* execute the dirty call, dumping the result in val. */
++         stmt( IRStmt_Dirty(d) );
++         putIReg( rD_addr,
++                  mkWidenFrom32(ty, mkexpr(val), False/*unsigned*/) );
++         DIP("mfspr r%u,%u", rD_addr, (UInt)SPR);
++         break;
++      }
++
+       default:
+          vex_printf("dis_proc_ctl(ppc)(mfspr,SPR)(0x%x)\n", SPR);
+          return False;
+-- 
+1.7.0.4
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.7.0.bb b/meta/recipes-devtools/valgrind/valgrind_3.7.0.bb
index d2c4467..858bf3d 100644
--- a/meta/recipes-devtools/valgrind/valgrind_3.7.0.bb
+++ b/meta/recipes-devtools/valgrind/valgrind_3.7.0.bb
@@ -14,7 +14,8 @@ SRC_URI = "http://www.valgrind.org/downloads/valgrind-${PV}.tar.bz2 \
            file://fix_unsupporting_kernel_3.patch \
            file://fixed-perl-path.patch \
            file://fix_for_automake_1.11.2.patch \
-           file://configure-fix.patch"
+           file://configure-fix.patch \
+           file://Added-support-for-PPC-instructions-mfatbu-mfatbl.patch"
 
 SRC_URI[md5sum] = "a855fda56edf05614f099dca316d1775"
 SRC_URI[sha256sum] = "5d62c0330f1481fe2c593249192fa68ff454c19c34343978cc9ce91aa324cbf6"
-- 
1.7.0.4


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

* Re: Valgrind : Unhanded instructions mfatbu and mfatbl
  2012-01-16  5:42   ` Bansal Aneesh-B39320
@ 2012-02-08 21:58     ` McClintock Matthew-B29882
  0 siblings, 0 replies; 4+ messages in thread
From: McClintock Matthew-B29882 @ 2012-02-08 21:58 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Garg Vakul-B16394

Aneesh,

Can you resubmit this patch using git-send-email?

-M

On Sun, Jan 15, 2012 at 11:42 PM, Bansal Aneesh-B39320
<B39320@freescale.com> wrote:
> Please find the patch attached in the mail.
>
>
>
> Regards,
>
> Aneesh Bansal
>
>
>
> From: openembedded-core-bounces@lists.openembedded.org
> [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of Khem
> Raj
> Sent: Friday, January 13, 2012 1:04 PM
> To: Patches and discussions about the oe-core layer
> Cc: Garg Vakul-B16394
> Subject: Re: [OE-core] Valgrind : Unhanded instructions mfatbu and mfatbl
>
>
>
>
>
> On Thu, Jan 12, 2012 at 9:43 PM, Bansal Aneesh-B39320 <B39320@freescale.com>
> wrote:
>
> Hello,
>
>
>
> PowerPC uses two alternate time base registers which are read from user
> space
>
> by using PPC instructions mfatbu and mfatbl . However these instructions are
>
> not supported by Valgrind.
>
> CPU : e500mc
>
> Here are the logs when an application executing such instruction is executed
>
> with Valgrind 3.7.0:
>
>
>
> dis_proc_ctl(ppc)(mfspr,SPR)(0x20F)
>
> disInstr(ppc): unhandled instruction: 0x7C0F82A6
>
>                  primary 31(0x1F), secondary 678(0x2A6)
>
> ==2204== valgrind: Unrecognized instruction at address 0x10003dfc.
>
> ==2204==    at 0x10003DFC: ??? (in /usr/bin/simple_crypto)
>
> ==2204==    by 0x1000181B: ??? (in /usr/bin/simple_crypto)
>
> ==2204==    by 0xFE179E7: ??? (in /lib/libpthread-2.13.so)
>
> ==2204==    by 0x40EEA9B: ??? (in /lib/libc-2.13.so)
>
> ==2204== Your program just tried to execute an instruction that Valgrind
>
> ==2204== did not recognise.  There are two possible reasons for this.
>
> ==2204== 1. Your program has a bug and erroneously jumped to a non-code
>
> ==2204==    location.  If you are running Memcheck and you just saw a
>
> ==2204==    warning about a bad jump, it's probably your program's fault.
>
> ==2204== 2. The instruction is legitimate but Valgrind doesn't handle it,
>
> ==2204==    i.e. it's Valgrind's fault.  If you think this is the case or
>
> ==2204==    you are not sure, please let us know and we'll try to fix it.
>
> ==2204== Either way, Valgrind will now raise a SIGILL signal which will
>
> ==2204== probably kill your program.
>
>
>
>
>
> We have developed a patch to fix the issue and submitted the patch upstream
> to Valgrind community for processing.
>
>
>
> how about you also submit the patch to oe-core as well
> so we can use it until the upstream patch lands in a release
> that we will use
>
>
>
>
>
>
> Regards,
>
> Aneesh Bansal
>
> Error! Filename not specified.
>
> Plot No. – 18 | Sector-16 A, Noida – 201301
>
> Phone  : 0120395 x3320
>
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>



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

end of thread, other threads:[~2012-02-08 22:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-13  5:43 Valgrind : Unhanded instructions mfatbu and mfatbl Bansal Aneesh-B39320
2012-01-13  7:34 ` Khem Raj
2012-01-16  5:42   ` Bansal Aneesh-B39320
2012-02-08 21:58     ` McClintock Matthew-B29882

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.