diff --git a/toolbox/stackframe.h b/toolbox/stackframe.h index e7ac43f..48c46fc 100644 --- a/toolbox/stackframe.h +++ b/toolbox/stackframe.h @@ -8,6 +8,7 @@ template void ToolReturn(uint32_t sp, uint32_t value) { + if (sp == -1) sp = cpuGetAReg(7); static_assert(N == 2 || N == 4, "Invalid Return Size"); if (N == 4) { @@ -19,6 +20,14 @@ void ToolReturn(uint32_t sp, uint32_t value) } } +// pre-define these templates to prevent instantiation errors. +template +uint32_t StackFrame__(uint32_t sp, uint32_t &x, Args&... args); +template +uint32_t StackFrame__(uint32_t sp, uint16_t &x, Args&... args); +template +uint32_t StackFrame__(uint32_t sp); + template uint32_t StackFrame__(uint32_t sp)