Skip to contentSkip to conversation

arm64: insn: fix compare-and-branch encodings

PATCH New Robin Murphy 2 participants 3 messages Feb 18, 2015 – Feb 19, 2015 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: insn: fix compare-and-branch encodings

Fix cbz/cbnz having the mask offset by a bit, and add encodings for tbz/tbnz so that all branch forms are represented.

---
 arch/arm64/include/asm/insn.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/include/asm/insn.h +4 -2
index e2ff32a..d2f4942 100644
@@ -264,8 +264,10 @@ __AARCH64_INSN_FUNCS(ands,	0x7F200000, 0x6A000000)
 __AARCH64_INSN_FUNCS(bics,	0x7F200000, 0x6A200000)
 __AARCH64_INSN_FUNCS(b,		0xFC000000, 0x14000000)
 __AARCH64_INSN_FUNCS(bl,	0xFC000000, 0x94000000)
-__AARCH64_INSN_FUNCS(cbz,	0xFE000000, 0x34000000)
-__AARCH64_INSN_FUNCS(cbnz,	0xFE000000, 0x35000000)
+__AARCH64_INSN_FUNCS(cbz,	0x7F000000, 0x34000000)
+__AARCH64_INSN_FUNCS(cbnz,	0x7F000000, 0x35000000)
+__AARCH64_INSN_FUNCS(tbz,	0x7F000000, 0x36000000)
+__AARCH64_INSN_FUNCS(tbnz,	0x7F000000, 0x37000000)
 __AARCH64_INSN_FUNCS(bcond,	0xFF000010, 0x54000000)
 __AARCH64_INSN_FUNCS(svc,	0xFFE0001F, 0xD4000001)
 __AARCH64_INSN_FUNCS(hvc,	0xFFE0001F, 0xD4000002)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 arm64: insn: fix compare-and-branch encodings

Oops, missed some CCs...

Quoted 27 lines · Robin Murphy

Fix cbz/cbnz having the mask offset by a bit, and add encodings for tbz/tbnz so that all branch forms are represented.

---
  arch/arm64/include/asm/insn.h | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/include/asm/insn.h +4 -2
index e2ff32a..d2f4942 100644
@@ -264,8 +264,10 @@ __AARCH64_INSN_FUNCS(ands,	0x7F200000, 0x6A000000)
  __AARCH64_INSN_FUNCS(bics,	0x7F200000, 0x6A200000)
  __AARCH64_INSN_FUNCS(b,		0xFC000000, 0x14000000)
  __AARCH64_INSN_FUNCS(bl,	0xFC000000, 0x94000000)
-__AARCH64_INSN_FUNCS(cbz,	0xFE000000, 0x34000000)
-__AARCH64_INSN_FUNCS(cbnz,	0xFE000000, 0x35000000)
+__AARCH64_INSN_FUNCS(cbz,	0x7F000000, 0x34000000)
+__AARCH64_INSN_FUNCS(cbnz,	0x7F000000, 0x35000000)
+__AARCH64_INSN_FUNCS(tbz,	0x7F000000, 0x36000000)
+__AARCH64_INSN_FUNCS(tbnz,	0x7F000000, 0x37000000)
  __AARCH64_INSN_FUNCS(bcond,	0xFF000010, 0x54000000)
  __AARCH64_INSN_FUNCS(svc,	0xFFE0001F, 0xD4000001)
  __AARCH64_INSN_FUNCS(hvc,	0xFFE0001F, 0xD4000002)
#2 lore raw

PATCH 1/1 arm64: insn: fix compare-and-branch encodings

Quoted 23 lines · Robin Murphy

Oops, missed some CCs...

Quoted 20 lines · Robin Murphy

Fix cbz/cbnz having the mask offset by a bit, and add encodings for tbz/tbnz so that all branch forms are represented.

---
  arch/arm64/include/asm/insn.h | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm64/include/asm/insn.h +0 -2
index e2ff32a..d2f4942 100644
@@ -264,8 +264,10 @@ __AARCH64_INSN_FUNCS(ands, 0x7F200000, 0x6A000000)
  __AARCH64_INSN_FUNCS(bics,    0x7F200000, 0x6A200000)
  __AARCH64_INSN_FUNCS(b,               0xFC000000, 0x14000000)
  __AARCH64_INSN_FUNCS(bl,      0xFC000000, 0x94000000)
-__AARCH64_INSN_FUNCS(cbz,      0xFE000000, 0x34000000)
-__AARCH64_INSN_FUNCS(cbnz,     0xFE000000, 0x35000000)
Quoted 8 lines

arch/arm64/include/asm/insn.h __AARCH64_INSN_FUNCS(ands, 0x7F200000, 0x6A000000) · line 273

Quoted 8 lines
arch/arm64/include/asm/insn.h +4 -0
+__AARCH64_INSN_FUNCS(cbz,      0x7F000000, 0x34000000)
+__AARCH64_INSN_FUNCS(cbnz,     0x7F000000, 0x35000000)
+__AARCH64_INSN_FUNCS(tbz,      0x7F000000, 0x36000000)
+__AARCH64_INSN_FUNCS(tbnz,     0x7F000000, 0x37000000)
  __AARCH64_INSN_FUNCS(bcond,   0xFF000010, 0x54000000)
  __AARCH64_INSN_FUNCS(svc,     0xFFE0001F, 0xD4000001)
  __AARCH64_INSN_FUNCS(hvc,     0xFFE0001F, 0xD4000002)

Looks good to me, as described in ARMv8 ARM.