[lldb-dev] [Bug 32986] New: Incorrect ROR_C implementation.

via lldb-dev lldb-dev at lists.llvm.org
Wed May 10 03:23:02 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=32986

            Bug ID: 32986
           Summary: Incorrect ROR_C implementation.
           Product: lldb
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: andrea at inversepath.com
                CC: llvm-bugs at lists.llvm.org

Hi.

It appears that the ROR_C function, within the common utilities for the
ARM/Thumb Instruction Set Architecture, is incorrectly implemented.

>From lldb/source/Plugins/Process/Utility/ARMUtils.h:

static inline uint32_t ROR_C(const uint32_t value, const uint32_t amount,
                             uint32_t &carry_out, bool *success) {
...
  carry_out = Bit32(value, 31);
...

However according to the ARMv6-M Architecture Reference Manual (page A2-34)
ROR_C is implemented as follows in relation to the carry_out:

...
 m = shift MOD N;
 result = LSR(x,m) OR LSL(x,N-m);
 carry_out = result<N-1>;
...

Therefore I believe that the ROR_C function in ARMUtils.h should use the
result, rather than the value, when setting carry_out:

  carry_out = Bit32(result, 31);

A comparable fix was effective in passing tests in another project I
contributed:

https://github.com/abarisani/ARMv6m_Simulator/commit/36e73fb1924edada7d75b15dcf51aa4683f0d729

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20170510/19d06c09/attachment.html>


More information about the lldb-dev mailing list