@@ -865,7 +865,7 @@ static DecodeStatus readInstruction16(ArrayRef<uint8_t> Bytes, uint64_t Address,
865
865
// / Read three bytes from the ArrayRef and return 24 bit data
866
866
static DecodeStatus readInstruction24 (ArrayRef<uint8_t > Bytes, uint64_t Address,
867
867
uint64_t &Size, uint64_t &Insn,
868
- bool IsLittleEndian) {
868
+ bool IsLittleEndian, bool CheckTIE = false ) {
869
869
// We want to read exactly 3 Bytes of data.
870
870
if (Bytes.size () < 3 ) {
871
871
Size = 0 ;
@@ -875,6 +875,8 @@ static DecodeStatus readInstruction24(ArrayRef<uint8_t> Bytes, uint64_t Address,
875
875
if (!IsLittleEndian) {
876
876
report_fatal_error (" Big-endian mode currently is not supported!" );
877
877
} else {
878
+ if (CheckTIE && (Bytes[0 ] & 0x8 ) != 0 )
879
+ return MCDisassembler::Fail;
878
880
Insn = (Bytes[2 ] << 16 ) | (Bytes[1 ] << 8 ) | (Bytes[0 ] << 0 );
879
881
}
880
882
@@ -894,6 +896,8 @@ static DecodeStatus readInstruction32(ArrayRef<uint8_t> Bytes, uint64_t Address,
894
896
if (!IsLittleEndian) {
895
897
report_fatal_error (" Big-endian mode currently is not supported!" );
896
898
} else {
899
+ if ((Bytes[0 ] & 0x8 ) == 0 )
900
+ return MCDisassembler::Fail;
897
901
Insn = (Bytes[3 ] << 24 ) | (Bytes[2 ] << 16 ) | (Bytes[1 ] << 8 ) | (Bytes[0 ] << 0 );
898
902
}
899
903
@@ -959,15 +963,15 @@ DecodeStatus XtensaDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
959
963
960
964
if (hasESP32S3Ops ()) {
961
965
// Parse ESP32S3 24-bit instructions
962
- Result = readInstruction24 (Bytes, Address, Size, Insn, IsLittleEndian);
963
- if (Result == MCDisassembler::Fail)
964
- return MCDisassembler::Fail;
965
- LLVM_DEBUG (dbgs () << " Trying ESP32S3 table (24-bit opcodes):\n " );
966
- Result = decodeInstruction (DecoderTableESP32S324, MI, Insn,
967
- Address, this , STI);
966
+ Result = readInstruction24 (Bytes, Address, Size, Insn, IsLittleEndian, true );
968
967
if (Result != MCDisassembler::Fail) {
969
- Size = 3 ;
970
- return Result;
968
+ LLVM_DEBUG (dbgs () << " Trying ESP32S3 table (24-bit opcodes):\n " );
969
+ Result = decodeInstruction (DecoderTableESP32S324, MI, Insn, Address, this ,
970
+ STI);
971
+ if (Result != MCDisassembler::Fail) {
972
+ Size = 3 ;
973
+ return Result;
974
+ }
971
975
}
972
976
973
977
// Parse ESP32S3 32-bit instructions
0 commit comments