Skip to content

Commit 9556e6e

Browse files
committed
Merge remote-tracking branch 'origin/GT-3346_ghidorahrex_PR-631_jroimartin_fix-avr-lpm'
2 parents 9a470a9 + 7946ec5 commit 9556e6e

File tree

1 file changed

+8
-7
lines changed
  • Ghidra/Processors/Atmel/data/languages

1 file changed

+8
-7
lines changed

Ghidra/Processors/Atmel/data/languages/avr8.sinc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -737,20 +737,20 @@ define pcodeop break;
737737
:elpm is phase=1 & ophi16=0x95d8 {
738738
ptr:3 = zext(Z) | (zext(RAMPZ) << 16);
739739
tmp:2 = *[code]:2 (ptr >> 1);
740-
val:2 = (tmp >> (Z & 0x1));
741-
R0 = val:1;
740+
val:2 = (tmp >> (8 * (Z & 0x1)));
741+
R0 = val:1;
742742
}
743743
:elpm RdFull, Z is phase=1 & ophi7=0x48 & oplow4=0x6 & RdFull & Z {
744744
ptr:3 = zext(Z) | (zext(RAMPZ) << 16);
745745
tmp:2 = *[code]:2 (ptr >> 1);
746-
val:2 = (tmp >> (Z & 0x1));
746+
val:2 = (tmp >> (8 * (Z & 0x1)));
747747
RdFull = val:1;
748748
}
749749

750750
:elpm RdFull, Z^"+" is phase=1 & ophi7=0x48 & oplow4=0x7 & RdFull & Z {
751751
ptr:3 = zext(Z) | (zext(RAMPZ) << 16);
752752
tmp:2 = *[code]:2 (ptr >> 1);
753-
val:2 = (tmp >> (Z & 0x1));
753+
val:2 = (tmp >> (8 * (Z & 0x1)));
754754
RdFull = val:1;
755755
ptr = ptr + 1;
756756
Z = ptr:2;
@@ -892,21 +892,21 @@ LdPredec: "-"^RstPtr is RstPtr { RstPtr = RstPtr - 0x01; export RstPtr; }
892892
:lpm R0 is phase=1 & ophi16=0x95c8 & R0 {
893893
ptr:$(PCBYTESIZE) = zext(Z);
894894
tmp:$(PCBYTESIZE) = *[code]:$(PCBYTESIZE) (ptr >> 1);
895-
val:$(PCBYTESIZE) = (tmp >> (Z & 0x1));
895+
val:$(PCBYTESIZE) = (tmp >> (8 * (Z & 0x1)));
896896
R0 = val:1;
897897
}
898898
# lpm Rd,Z
899899
:lpm RdFull,Z is phase=1 & ophi7=0x48 & op1to3=0x2 & RdFull & Z & opbit0=0 {
900900
ptr:$(PCBYTESIZE) = zext(Z);
901901
tmp:$(PCBYTESIZE) = *[code]:$(PCBYTESIZE) (ptr >> 1);
902-
val:$(PCBYTESIZE) = (tmp >> (Z & 0x1));
902+
val:$(PCBYTESIZE) = (tmp >> (8 * (Z & 0x1)));
903903
RdFull = val:1;
904904
}
905905
# lpm Rd,Z+
906906
:lpm RdFull,Z"+" is phase=1 & ophi7=0x48 & op1to3=0x2 & RdFull & Z & opbit0=1 {
907907
ptr:$(PCBYTESIZE) = zext(Z);
908908
tmp:$(PCBYTESIZE) = *[code]:$(PCBYTESIZE) (ptr >> 1);
909-
val:$(PCBYTESIZE) = (tmp >> (Z & 0x1));
909+
val:$(PCBYTESIZE) = (tmp >> (8 * (Z & 0x1)));
910910
RdFull = val:1;
911911
Z = Z + 1;
912912
}
@@ -1161,3 +1161,4 @@ define pcodeop watchdog_reset;
11611161
*[mem]:1 ptr = RdFull;
11621162
RdFull = tmp;
11631163
}
1164+

0 commit comments

Comments
 (0)