Merge remote-tracking branch

'origin/GP-1478_ghidorahrex_PR-3616_agatti_68k_chk_chk2_cmp2' into
Ghidra_10.1 (Closes #2856)
This commit is contained in:
ghidra1 2021-11-23 21:54:28 -05:00
commit 3f60701d23

View File

@ -919,16 +919,113 @@ define pcodeop countLeadingZeros;
NF = 0;
}
:chk.w eaw,reg9dnw is (op=4 & reg9dnw & op68=6 & $(DAT_ALTER_ADDR_MODES))... & eaw unimpl
:chk.l eal,reg9dn is (op=4 & reg9dn & op68=4 & $(DAT_ALTER_ADDR_MODES))... & eal unimpl
:chk.w eaw,reg9dnw is (op=4 & reg9dnw & op68=6 & $(DAT_ALTER_ADDR_MODES))... & eaw {
build eaw;
local address:4 = zext(eaw);
local bound:2 = *:2 address;
local signed_bound:4 = sext(bound);
local signed_register:4 = sext(reg9dnw);
# Distinguishing between cmp2 and chk2 occurs in a very deep bit
bound: "hk2" is wl=1 { }
bound: "mp2" is wl=0 { }
if ((signed_register s>= 0) && (signed_register s<= signed_bound)) goto inst_next;
NF = signed_register s< 0;
__m68k_trap(6:1);
}
:c^bound^".b" e2b,rreg is opbig=0 & op67=3 & $(CTL_ADDR_MODES); rreg & bound; e2b [ savmod2=savmod1; regtsan=regtfan; ] unimpl
:c^bound^".w" e2w,rreg is opbig=2 & op67=3 & $(CTL_ADDR_MODES); rreg & bound; e2w [ savmod2=savmod1; regtsan=regtfan; ] unimpl
:c^bound^".l" e2l,rreg is opbig=4 & op67=3 & $(CTL_ADDR_MODES); rreg & bound; e2l [ savmod2=savmod1; regtsan=regtfan; ] unimpl
:chk.l eal,reg9dn is (op=4 & reg9dn & op68=4 & $(DAT_ALTER_ADDR_MODES))... & eal {
build eal;
local address:4 = zext(eal);
local bound:4 = *:4 address;
local signed_bound:4 = sext(bound);
local signed_register:4 = sext(reg9dn);
if ((signed_register s>= 0) && (signed_register s<= signed_bound)) goto inst_next;
NF = signed_register s< 0;
__m68k_trap(6:1);
}
:chk2.b e2b,rreg is opbig=0 & op67=3 & $(CTL_ADDR_MODES); rreg & wl=1; e2b [ savmod2=savmod1; regtsan=regtfan; ] {
build e2b;
local address:4 = zext(e2b);
local lower:1 = *:1 address;
local upper:1 = *:1 (address + 1);
local signed_lower:4 = sext(lower);
local signed_upper:4 = sext(upper);
local signed_register:4 = sext(rreg);
ZF = ((signed_register == signed_lower) || (signed_register == signed_upper));
CF = !((signed_register s>= signed_lower) && (signed_register s<= signed_upper));
if (!CF) goto inst_next;
__m68k_trap(6:1);
}
:chk2.w e2w,rreg is opbig=2 & op67=3 & $(CTL_ADDR_MODES); rreg & wl=1; e2w [ savmod2=savmod1; regtsan=regtfan; ] {
build e2w;
local address:4 = zext(e2w);
local lower:2 = *:2 address;
local upper:2 = *:2 (address + 2);
local signed_lower:4 = sext(lower);
local signed_upper:4 = sext(upper);
local signed_register:4 = sext(rreg);
ZF = ((signed_register == signed_lower) || (signed_register == signed_upper));
CF = !((signed_register s>= signed_lower) && (signed_register s<= signed_upper));
if (!CF) goto inst_next;
__m68k_trap(6:1);
}
:chk2.l e2l,rreg is opbig=4 & op67=3 & $(CTL_ADDR_MODES); rreg & wl=1; e2l [ savmod2=savmod1; regtsan=regtfan; ] {
build e2l;
local address:4 = zext(e2l);
local lower:4 = *:4 address;
local upper:4 = *:4 (address + 4);
local signed_lower:4 = sext(lower);
local signed_upper:4 = sext(upper);
local signed_register:4 = sext(rreg);
ZF = ((signed_register == signed_lower) || (signed_register == signed_upper));
CF = !((signed_register s>= signed_lower) && (signed_register s<= signed_upper));
if (!CF) goto inst_next;
__m68k_trap(6:1);
}
:cmp2.b e2b,rreg is opbig=0 & op67=3 & $(CTL_ADDR_MODES); rreg & wl=0; e2b [ savmod2=savmod1; regtsan=regtfan; ] {
build e2b;
local address:4 = zext(e2b);
local lower:1 = *:1 address;
local upper:1 = *:1 (address + 1);
local signed_lower:4 = sext(lower);
local signed_upper:4 = sext(upper);
local signed_register:4 = sext(rreg);
ZF = ((signed_register == signed_lower) || (signed_register == signed_upper));
CF = !((signed_register s>= signed_lower) && (signed_register s<= signed_upper));
}
:cmp2.w e2w,rreg is opbig=2 & op67=3 & $(CTL_ADDR_MODES); rreg & wl=0; e2w [ savmod2=savmod1; regtsan=regtfan; ] {
build e2w;
local address:4 = zext(e2w);
local lower:2 = *:2 address;
local upper:2 = *:2 (address + 2);
local signed_lower:4 = sext(lower);
local signed_upper:4 = sext(upper);
local signed_register:4 = sext(rreg);
ZF = ((signed_register == signed_lower) || (signed_register == signed_upper));
CF = !((signed_register s>= signed_lower) && (signed_register s<= signed_upper));
}
:cmp2.l e2l,rreg is opbig=4 & op67=3 & $(CTL_ADDR_MODES); rreg & wl=0; e2l [ savmod2=savmod1; regtsan=regtfan; ] {
build e2l;
local address:4 = zext(e2l);
local lower:4 = *:4 address;
local upper:4 = *:4 (address + 4);
local signed_lower:4 = sext(lower);
local signed_upper:4 = sext(upper);
local signed_register:4 = sext(rreg);
ZF = ((signed_register == signed_lower) || (signed_register == signed_upper));
CF = !((signed_register s>= signed_lower) && (signed_register s<= signed_upper));
}
@ifdef MC68040