[PATCH] Fix encoding of unconditional Thumb2 branch (T4)

Gordon Keiser gkeiser at arxan.com
Wed Mar 27 17:24:50 PDT 2013


Hi,

A little while back someone checked in a patch to disassemble this branch correctly, but the TableGen definition was still using incorrect information as if a 20 bit immediate was involved, and the encode function neglected to right shift the immediate first (the output becomes left shifted by #1).   The former item was causing the S, J1, and J2 bits of the instruction to be set incorrectly (based on bits 19-17 of the immediate rather than the calculated version from the encode function), and the latter was causing all of the branches to go twice as far as specified.  This was verified both by the output from LLVM's disassembler which is correct in this case, IDA 6.4, and lots of bit checking vs. ARM's docs.

The patch also updates test cases, which were listing encoding results which didn't match what they should have been.

I don't have commit access yet, so someone who does can feel free to commit if it looks good.

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/fd663e29/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Thumb2b.wT4Encoding.patch
Type: application/octet-stream
Size: 3083 bytes
Desc: Thumb2b.wT4Encoding.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130327/fd663e29/attachment.obj>


More information about the llvm-commits mailing list