Skip to content

Ghidra is a software reverse engineering (SRE) framework

Revert "GT-3394: Fixed register definitions in VLDM/VSTM instructions"

ghidorahrexea6cfcd08ca4
diff --git a/Ghidra/Processors/ARM/data/languages/ARM.sinc b/Ghidra/Processors/ARM/data/languages/ARM.sinc
index d05336a3d6..e017abf5d0 100644
--- a/Ghidra/Processors/ARM/data/languages/ARM.sinc
+++ b/Ghidra/Processors/ARM/data/languages/ARM.sinc
@@ -104,8 +104,12 @@ define context contextreg
# Transient context bits
counter = (14,18) # 0 to 7 counter (for building variable length register lists)
+# dreg = (17,21) # D register (attached, for building register lists)
+# sreg = (17,21) # S register (attached, for building register lists)
regNum = (19,23) # D register number (see dreg)
counter2 = (24,26) # 0 to 7 counter (for building variable length register lists)
+# dreg2 = (25,29) # 2nd D register (attached, for building register lists)
+# sreg2 = (25,29) # 2nd S register (attached, for building register lists)
reg2Num = (27,31) # 2nd D register number (see dreg2)
# --- do not allow any field to span 32-bit boundary ---
regInc = (32,33) # Pair register increment
diff --git a/Ghidra/Processors/ARM/data/languages/ARMneon.sinc b/Ghidra/Processors/ARM/data/languages/ARMneon.sinc
index 7c48cfd51c..ea8223d12f 100644
--- a/Ghidra/Processors/ARM/data/languages/ARMneon.sinc
+++ b/Ghidra/Processors/ARM/data/languages/ARMneon.sinc
@@ -2468,7 +2468,6 @@ vldmUpdate: immed is TMode=0 & vldmRn & c2121=1 & immed { vldmRn = vldmRn + (imm
vldmUpdate: thv_immed is TMode=1 & vldmRn & thv_c2121=0 & thv_immed { }
vldmUpdate: thv_immed is TMode=1 & vldmRn & thv_c2121=1 & thv_immed { vldmRn = vldmRn + (thv_immed << 2); }
-
buildVldmDdList: is counter=0 { }
buildVldmDdList: Dreg is counter=1 & Dreg [ counter=0; regNum=regNum+1; ]
{
@@ -2483,7 +2482,7 @@ buildVldmDdList: Dreg,buildVldmDdList is Dreg & buildVldmDdList [ counter=counte
build buildVldmDdList;
}
-vldmDdList: "{"^buildVldmDdList^"}" is D22 & c1215 & c0007 & buildVldmDdList [ regNum=(D22<<4)+c1215; counter=c0007>>1; ] { }
+vldmDdList: "{"^buildVldmDdList^"}" is D22 & c1215 & c0007 & buildVldmDdList [ regNum=(D22<<4)+c1215-1; counter=c0007>>1; ] { }
:vldmia^COND vldmRn,vldmDdList is ( ($(AMODE) & COND & c2327=0x19 & c2121 & c2020=1 & c0811=11 & c0000=0) |
($(TMODE_E) & thv_c2327=0x19 & thv_c2121 & thv_c2020=1 & thv_c0811=11 & thv_c0000=0) ) & vldmRn & vldmDdList & vldmOffset & vldmUpdate
@@ -2577,8 +2576,8 @@ buildVldmSdList: Sreg,buildVldmSdList is Sreg & buildVldmSdList [ counter=counte
build buildVldmSdList;
}
-vldmSdList: "{"^buildVldmSdList^"}" is TMode=0 & D22 & c1215 & c0007 & buildVldmSdList [ regNum=(c1215<<1) + D22; counter=c0007; ] { }
-vldmSdList: "{"^buildVldmSdList^"}" is TMode=1 & thv_D22 & thv_c1215 & thv_c0007 & buildVldmSdList [ regNum=(thv_c1215<<1) + thv_D22; counter=thv_c0007; ] { }
+vldmSdList: "{"^buildVldmSdList^"}" is TMode=0 & D22 & c1215 & c0007 & buildVldmSdList [ regNum=(c1215<<1) + D22 - 1; counter=c0007; ] { }
+vldmSdList: "{"^buildVldmSdList^"}" is TMode=1 & thv_D22 & thv_c1215 & thv_c0007 & buildVldmSdList [ regNum=(thv_c1215<<1) + thv_D22 - 1; counter=thv_c0007; ] { }
:vldmia^COND vldmRn,vldmSdList is ( ( $(AMODE) & COND & c2327=0x19 & c2121 & c2020=1 & c0811=10 ) |
($(TMODE_E) & thv_c2327=0x19 & thv_c2121 & thv_c2020=1 & thv_c0811=10 ) ) & vldmRn & vldmSdList & vldmOffset & vldmUpdate
@@ -4535,7 +4534,7 @@ buildVstmDdList: Dreg,buildVstmDdList is Dreg & buildVstmDdList [ counter=counte
build buildVstmDdList;
}
-vstmDdList: "{"^buildVstmDdList^"}" is D22 & c1215 & c0007 & buildVstmDdList [ regNum=(D22<<4)+c1215; counter=c0007>>1; ] { }
+vstmDdList: "{"^buildVstmDdList^"}" is D22 & c1215 & c0007 & buildVstmDdList [ regNum=(D22<<4)+c1215-1; counter=c0007>>1; ] { }
:vstmia^COND vldmRn,vstmDdList is ( ($(AMODE) & COND & c2327=0x19 & c2121 & c2020=0 & c0811=11 & c0000=0) |
($(TMODE_E) & thv_c2327=0x19 & thv_c2121 & thv_c2020=0 & thv_c0811=11 & thv_c0000=0) ) & vldmRn & vstmDdList & vldmOffset & vldmUpdate
@@ -4575,8 +4574,8 @@ buildVstmSdList: Sreg,buildVstmSdList is Sreg & buildVstmSdList [ counter=counte
build buildVstmSdList;
}
-vstmSdList: "{"^buildVstmSdList^"}" is TMode=0 & D22 & c1215 & c0007 & buildVstmSdList [ regNum=(c1215<<1) + D22; counter=c0007; ] { }
-vstmSdList: "{"^buildVstmSdList^"}" is TMode=1 & thv_D22 & thv_c1215 & thv_c0007 & buildVstmSdList [ regNum=(thv_c1215<<1) + thv_D22; counter=thv_c0007; ] { }
+vstmSdList: "{"^buildVstmSdList^"}" is TMode=0 & D22 & c1215 & c0007 & buildVstmSdList [ regNum=(c1215<<1) + D22 -1; counter=c0007; ] { }
+vstmSdList: "{"^buildVstmSdList^"}" is TMode=1 & thv_D22 & thv_c1215 & thv_c0007 & buildVstmSdList [ regNum=(thv_c1215<<1) + thv_D22 -1; counter=thv_c0007; ] { }
:vstmia^COND vldmRn,vstmSdList is ( ( $(AMODE) & COND & c2327=0x19 & c2121 & c2020=0 & c0811=10 ) |
($(TMODE_E) & thv_c2327=0x19 & thv_c2121 & thv_c2020=0 & thv_c0811=10 ) ) & vldmRn & vstmSdList & vldmOffset & vldmUpdate