From 25f4178ddabb257da00bd1fd69acc22b577a1ef8 Mon Sep 17 00:00:00 2001 From: gdk Date: Wed, 29 Jun 2022 17:24:21 -0300 Subject: [PATCH] Also reset call depth when not using the unmanaged dispatch loop --- src/ARMeilleure/State/ExecutionContext.cs | 5 +++++ src/ARMeilleure/State/NativeContext.cs | 2 ++ src/ARMeilleure/Translation/Translator.cs | 1 + 3 files changed, 8 insertions(+) diff --git a/src/ARMeilleure/State/ExecutionContext.cs b/src/ARMeilleure/State/ExecutionContext.cs index ce10a591c..7c89dd4be 100644 --- a/src/ARMeilleure/State/ExecutionContext.cs +++ b/src/ARMeilleure/State/ExecutionContext.cs @@ -128,6 +128,11 @@ namespace ARMeilleure.State public bool GetFPstateFlag(FPState flag) => _nativeContext.GetFPStateFlag(flag); public void SetFPstateFlag(FPState flag, bool value) => _nativeContext.SetFPStateFlag(flag, value); + internal void ResetCallDepth() + { + _nativeContext.ResetCallDepth(); + } + internal void CheckInterrupt() { if (_interrupted) diff --git a/src/ARMeilleure/State/NativeContext.cs b/src/ARMeilleure/State/NativeContext.cs index 348fd11f3..d4dcaed15 100644 --- a/src/ARMeilleure/State/NativeContext.cs +++ b/src/ARMeilleure/State/NativeContext.cs @@ -183,6 +183,8 @@ namespace ARMeilleure.State public bool GetRunning() => GetStorage().Running != 0; public void SetRunning(bool value) => GetStorage().Running = value ? 1 : 0; + public void ResetCallDepth() => GetStorage().CallDepth = 1; + public unsafe static int GetRegisterOffset(Register reg) { if (reg.Type == RegisterType.Integer) diff --git a/src/ARMeilleure/Translation/Translator.cs b/src/ARMeilleure/Translation/Translator.cs index dc18038ba..070b856e6 100644 --- a/src/ARMeilleure/Translation/Translator.cs +++ b/src/ARMeilleure/Translation/Translator.cs @@ -199,6 +199,7 @@ namespace ARMeilleure.Translation Statistics.StartTimer(); + context.ResetCallDepth(); ulong nextAddr = func.Execute(Stubs.ContextWrapper, context); Statistics.StopTimer(address);