Don't decode blocks starting outside mapped memory & undefined instead of throw on invalid sysreg coprocessor (#964)

* Don't decode blocks in invalid memory locations.

* Emit undefined instruction on invalid coprocessor

...rather than throwing.

* Call undefined instruction directly.
This commit is contained in:
gdkchan 2020-03-04 16:25:27 -03:00 committed by GitHub
parent 25c3b8b356
commit d9ed827696
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -47,7 +47,7 @@ namespace ARMeilleure.Decoders
{ {
if (!visited.TryGetValue(blkAddress, out Block block)) if (!visited.TryGetValue(blkAddress, out Block block))
{ {
if (opsCount > MaxInstsPerFunction) if (opsCount > MaxInstsPerFunction || !memory.IsMapped((long)blkAddress))
{ {
return null; return null;
} }

View file

@ -17,7 +17,8 @@ namespace ARMeilleure.Instructions
if (op.Coproc != 15) if (op.Coproc != 15)
{ {
throw new NotImplementedException($"Unknown MRC Coprocessor ID 0x{op.Coproc:X16} at 0x{op.Address:X16}."); InstEmit.Und(context);
return;
} }
if (op.Opc1 != 0) if (op.Opc1 != 0)
@ -70,7 +71,8 @@ namespace ARMeilleure.Instructions
if (op.Coproc != 15) if (op.Coproc != 15)
{ {
throw new NotImplementedException($"Unknown MRC Coprocessor ID 0x{op.Coproc:X16} at 0x{op.Address:X16}."); InstEmit.Und(context);
return;
} }
if (op.Opc1 != 0) if (op.Opc1 != 0)
@ -119,7 +121,8 @@ namespace ARMeilleure.Instructions
if (op.Coproc != 15) if (op.Coproc != 15)
{ {
throw new NotImplementedException($"Unknown MRC Coprocessor ID 0x{op.Coproc:X16} at 0x{op.Address:X16}."); InstEmit.Und(context);
return;
} }
var opc = op.MrrcOp; var opc = op.MrrcOp;