[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [valgrind] [Bug 330622] New: Add test to regression suite for POWER instruction: dcbzl
From:       Anmol P. Paralkar <paralkar () freescale ! com>
Date:       2014-02-01 0:04:12
Message-ID: bug-330622-17878 () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=330622

            Bug ID: 330622
           Summary: Add test to regression suite for POWER instruction:
                    dcbzl
    Classification: Unclassified
           Product: valgrind
           Version: unspecified
          Platform: unspecified
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: vex
          Assignee: jseward@acm.org
          Reporter: paralkar@freescale.com

The fix for Bug 135264 -  "dcbzl instruction missing" (See:
https://bugs.kde.org/show_bug.cgi?id=135264 )
 provides a test case for the POWER instruction dcbzl (See:
http://bugsfiles.kde.org/attachment.cgi?id=42750 )

 However,

 0. The test segfaults (tested on a POWER 7 running fc16; compiled using GCC
4.6.3)

     Reason:

static inline void dcbzl(void *addr)
{
    asm volatile ("dcbzl %[addr], %[zero]"
                  : /*out*/
                  : [addr] "r" (addr), [zero] "r" (0) /*in*/
                  : "memory" /*clobber*/);
}

 is compiled to:

(gdb) disassemble 
Dump of assembler code for function dcbzl:
   0x00000000100006ec <+0>:     std     r31,-8(r1)
   0x00000000100006f0 <+4>:     stdu    r1,-64(r1)
   0x00000000100006f4 <+8>:     mr      r31,r1
   0x00000000100006f8 <+12>:    std     r3,112(r31)
   0x00000000100006fc <+16>:    ld      r0,112(r31)
   0x0000000010000700 <+20>:    li      r9,0
=> 0x0000000010000704 <+24>:    dcbzl   r0,r9
   0x0000000010000708 <+28>:    addi    r1,r31,64
   0x000000001000070c <+32>:    ld      r31,-8(r1)
   0x0000000010000710 <+36>:    blr
   0x0000000010000714 <+40>:    .long 0x0
   0x0000000010000718 <+44>:    .long 0x0
   0x000000001000071c <+48>:    lwz     r0,1(r1)
End of assembler dump.
(gdb) p/x $r9
$1 = 0x0
(gdb) 

 leading to an effective address of 0x0

 dcbzl RA, RB will result in an effective address: (RA|0)  + (RB)

 Because:

 RA = GPR0 and (GPR0) == addr, but because of (RA|0) semantics,
 the value 0 rather than the contents of GPR0

 RB = GPR9, but (GPR9) == 0x0

 thereby resulting in the observed SIGSEGV.

 1. The test hard codes the block size to be 128 but,
     per: coregrind/m_machine.c/find_ppc_dcbz_sz()
     the assertion:

     vg_assert(dcbzl_szB == 16 || dcbzl_szB == 32 || dcbzl_szB == 64 ||
dcbzl_szB == 128);

     holds true.

 2. The test is standalone C code, not part of the valgrind regression test
suite.



Reproducible: Always

-- 
You are receiving this mail because:
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic