From b75ed40ba6f2246a703f742d2d7862e96d2a4901 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Fri, 3 May 2019 08:56:22 +0200 Subject: [PATCH 1/3] Right endianness for ppc platforms --- suite/fuzz/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/suite/fuzz/platform.c b/suite/fuzz/platform.c index d146dc86b1..c47c3f2a39 100644 --- a/suite/fuzz/platform.c +++ b/suite/fuzz/platform.c @@ -104,7 +104,7 @@ struct platform platforms[] = { CS_ARCH_PPC, CS_MODE_BIG_ENDIAN, "PPC-64", - "ppc64" + "ppc64be" }, { //item 15 @@ -328,7 +328,7 @@ struct platform platforms[] = { CS_ARCH_PPC, CS_MODE_BIG_ENDIAN | CS_MODE_QPX, "ppc+qpx", - "ppcqpxbe" + "ppc64beqpx" }, // dummy entry to mark the end of this array. From e34fc023207c1acfe6513aaf5476c3726e2336c9 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Fri, 3 May 2019 08:56:41 +0200 Subject: [PATCH 2/3] Right decoding for tabort ppc instructions --- arch/PowerPC/PPCGenAsmWriter.inc | 8 ++++---- arch/PowerPC/PPCGenDisassemblerTables.inc | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/PowerPC/PPCGenAsmWriter.inc b/arch/PowerPC/PPCGenAsmWriter.inc index 4f480de529..725b2f734e 100644 --- a/arch/PowerPC/PPCGenAsmWriter.inc +++ b/arch/PowerPC/PPCGenAsmWriter.inc @@ -6040,9 +6040,9 @@ static void printInstruction(MCInst *MI, SStream *O) break; case 17: // TABORTDC, TABORTDCI, TABORTWC, TABORTWCI - printU5ImmOperand(MI, 1, O); + printU5ImmOperand(MI, 0, O); SStream_concat0(O, ", "); - printOperand(MI, 2, O); + printOperand(MI, 1, O); SStream_concat0(O, ", "); break; case 18: @@ -6184,12 +6184,12 @@ static void printInstruction(MCInst *MI, SStream *O) break; case 17: // TABORTDC, TABORTWC - printOperand(MI, 3, O); + printOperand(MI, 2, O); return; break; case 18: // TABORTDCI, TABORTWCI - printU5ImmOperand(MI, 3, O); + printU5ImmOperand(MI, 2, O); return; break; case 19: diff --git a/arch/PowerPC/PPCGenDisassemblerTables.inc b/arch/PowerPC/PPCGenDisassemblerTables.inc index be6d0b9e6b..c3509da8b8 100644 --- a/arch/PowerPC/PPCGenDisassemblerTables.inc +++ b/arch/PowerPC/PPCGenDisassemblerTables.inc @@ -5328,7 +5328,7 @@ static DecodeStatus fname(DecodeStatus S, unsigned Idx, InsnType insn, MCInst *M return S; \ case 73: \ tmp = fieldname(insn, 21, 5); \ - if (DecodeCRRC0RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler_Fail) { return MCDisassembler_Fail; } \ + if (decodeUImmOperand(MI, tmp, Address, Decoder, 5) == MCDisassembler_Fail) { return MCDisassembler_Fail; } \ tmp = fieldname(insn, 16, 5); \ if (DecodeGPRCRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler_Fail) { return MCDisassembler_Fail; } \ tmp = fieldname(insn, 11, 5); \ @@ -5336,7 +5336,7 @@ static DecodeStatus fname(DecodeStatus S, unsigned Idx, InsnType insn, MCInst *M return S; \ case 74: \ tmp = fieldname(insn, 21, 5); \ - if (DecodeCRRC0RegisterClass(MI, tmp, Address, Decoder) == MCDisassembler_Fail) { return MCDisassembler_Fail; } \ + if (decodeUImmOperand(MI, tmp, Address, Decoder, 5) == MCDisassembler_Fail) { return MCDisassembler_Fail; } \ tmp = fieldname(insn, 16, 5); \ if (DecodeGPRCRegisterClass(MI, tmp, Address, Decoder) == MCDisassembler_Fail) { return MCDisassembler_Fail; } \ tmp = fieldname(insn, 11, 5); \ From 26e73ed7c0a1ac41fefb3b63d876a17b29519901 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Tue, 7 May 2019 08:17:03 +0200 Subject: [PATCH 3/3] Revert "Right endianness for ppc platforms" This reverts commit b75ed40ba6f2246a703f742d2d7862e96d2a4901. --- suite/fuzz/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/suite/fuzz/platform.c b/suite/fuzz/platform.c index c47c3f2a39..d146dc86b1 100644 --- a/suite/fuzz/platform.c +++ b/suite/fuzz/platform.c @@ -104,7 +104,7 @@ struct platform platforms[] = { CS_ARCH_PPC, CS_MODE_BIG_ENDIAN, "PPC-64", - "ppc64be" + "ppc64" }, { //item 15 @@ -328,7 +328,7 @@ struct platform platforms[] = { CS_ARCH_PPC, CS_MODE_BIG_ENDIAN | CS_MODE_QPX, "ppc+qpx", - "ppc64beqpx" + "ppcqpxbe" }, // dummy entry to mark the end of this array.