[PATCH] Fix decoding of CBZ / CBNZ Thumb2 Instructions

Gordon Keiser gkeiser at arxan.com
Wed Mar 27 16:53:08 PDT 2013


Hi,

According to ARM DDI0406C, A8.8.29, the CBNZ / CBZ instructions can only branch forwards, and the immediate is zero extended.   The decode function (DecodeThumbCmpBROperand) was sign extending instead, producing incorrect results when the high bit of the immediate was set.

The attached patch fixes the issue and adds a test case which will trigger it in current code.

I don't have commit access yet, so if it looks good and you do have, feel free to commit.

Cheers,
Gordon Keiser
Software Development Engineer
Arxan Technologies
w:+1.765.889.4756   m:+1.765.237.4833
gkeiser at arxan.com<mailto:gkeiser at arxan.com>        www.arxan.com<http://www.arxan.com/>
Protecting the App Economy(tm)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130327/81414abf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DecodeCBZCorrectImm.patch
Type: application/octet-stream
Size: 1419 bytes
Desc: DecodeCBZCorrectImm.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130327/81414abf/attachment.obj>


More information about the llvm-commits mailing list