diff options
author | gdkchan <gab.dark.100@gmail.com> | 2020-03-04 16:25:27 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-04 16:25:27 -0300 |
commit | d9ed827696700ef5b9b777031bab451f23fb837c (patch) | |
tree | e70dad24f8c95f8f2efeac41356ac204643de26e | |
parent | 25c3b8b3564bb7c3c353b5ea2171200f9ebfa2ca (diff) |
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.
-rw-r--r-- | ARMeilleure/Decoders/Decoder.cs | 2 | ||||
-rw-r--r-- | ARMeilleure/Instructions/InstEmitSystem32.cs | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/ARMeilleure/Decoders/Decoder.cs b/ARMeilleure/Decoders/Decoder.cs index 913d5082..7cbb62e6 100644 --- a/ARMeilleure/Decoders/Decoder.cs +++ b/ARMeilleure/Decoders/Decoder.cs @@ -47,7 +47,7 @@ namespace ARMeilleure.Decoders { if (!visited.TryGetValue(blkAddress, out Block block)) { - if (opsCount > MaxInstsPerFunction) + if (opsCount > MaxInstsPerFunction || !memory.IsMapped((long)blkAddress)) { return null; } diff --git a/ARMeilleure/Instructions/InstEmitSystem32.cs b/ARMeilleure/Instructions/InstEmitSystem32.cs index 808b4fdd..ebf829a0 100644 --- a/ARMeilleure/Instructions/InstEmitSystem32.cs +++ b/ARMeilleure/Instructions/InstEmitSystem32.cs @@ -17,7 +17,8 @@ namespace ARMeilleure.Instructions 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) @@ -70,7 +71,8 @@ namespace ARMeilleure.Instructions 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) @@ -119,7 +121,8 @@ namespace ARMeilleure.Instructions 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; |