[AArch64] Fix incorrect mask when decoding b.cond instruction

Message ID 1441963216-8139-1-git-send-email-pierre.langlois@arm.com
State New, archived
Headers

Commit Message

Pierre Langlois Sept. 11, 2015, 9:20 a.m. UTC
  Hi all,

The encoding of the b.cond instruction is described in the architecture
reference manual as:

b.cond  0101 0100 iiii iiii iiii iiii iii0 cccc

So the mask should be 0xff000010.

I've regression tested it on aarch64-linux, I haven't seen any difference
with or without the patch.

Thanks,
Pierre

gdb/ChangeLog:

	* aarch64-tdep.c (decode_bcond): Fix incorrect mask.
---
 gdb/aarch64-tdep.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Yao Qi Sept. 11, 2015, 3:35 p.m. UTC | #1
Pierre Langlois <pierre.langlois@arm.com> writes:

> The encoding of the b.cond instruction is described in the architecture
> reference manual as:
>
> b.cond  0101 0100 iiii iiii iiii iiii iii0 cccc
>
> So the mask should be 0xff000010.
>
> I've regression tested it on aarch64-linux, I haven't seen any difference
> with or without the patch.

Hi Pierre,
You posted this patch here
https://sourceware.org/ml/gdb-patches/2015-08/msg00421.html and I
reviewed it.  The patch is OK.
  
Pierre Langlois Sept. 11, 2015, 3:52 p.m. UTC | #2
On 11/09/15 16:35, Yao Qi wrote:
> Pierre Langlois <pierre.langlois@arm.com> writes:
> 
>> The encoding of the b.cond instruction is described in the architecture
>> reference manual as:
>>
>> b.cond  0101 0100 iiii iiii iiii iiii iii0 cccc
>>
>> So the mask should be 0xff000010.
>>
>> I've regression tested it on aarch64-linux, I haven't seen any difference
>> with or without the patch.
> 
> Hi Pierre,
> You posted this patch here
> https://sourceware.org/ml/gdb-patches/2015-08/msg00421.html and I
> reviewed it.  The patch is OK.
> 

Oops, sorry for posting this again.  I've pushed it now.

Thanks,
Pierre
  

Patch

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 9a44446..a4d8186 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -339,7 +339,8 @@  decode_b (CORE_ADDR addr, uint32_t insn, int *is_bl, int32_t *offset)
 static int
 decode_bcond (CORE_ADDR addr, uint32_t insn, unsigned *cond, int32_t *offset)
 {
-  if (decode_masked_match (insn, 0xfe000000, 0x54000000))
+  /* b.cond  0101 0100 iiii iiii iiii iiii iii0 cccc */
+  if (decode_masked_match (insn, 0xff000010, 0x54000000))
     {
       *cond = (insn >> 0) & 0xf;
       *offset = extract_signed_bitfield (insn, 19, 5) << 2;