diff --git a/sourcepawn/include/sp_vm_api.h b/sourcepawn/include/sp_vm_api.h index 93fedf57..b576d849 100644 --- a/sourcepawn/include/sp_vm_api.h +++ b/sourcepawn/include/sp_vm_api.h @@ -608,6 +608,20 @@ namespace SourcePawn * @return Number of functions. */ virtual unsigned int FunctionCount(const sp_context_t *ctx) =0; + + /** + * @brief Returns a version string. + * + * @return Versioning string. + */ + virtual const char *GetVersionString() =0; + + /** + * @brief Returns a string describing optimizations. + * + * @return String describing CPU specific optimizations. + */ + virtual const char *GetCPUOptimizations() =0; }; }; diff --git a/sourcepawn/jit/x86/jit_x86.cpp b/sourcepawn/jit/x86/jit_x86.cpp index fb71321c..346cacfb 100644 --- a/sourcepawn/jit/x86/jit_x86.cpp +++ b/sourcepawn/jit/x86/jit_x86.cpp @@ -2119,8 +2119,23 @@ jit_rewind: { sym = (sp_fdbg_symbol_t *)cursor; - ctx->symbols[iter].codestart = RelocLookup(jit, sym->codestart, false); - ctx->symbols[iter].codeend = RelocLookup(jit, sym->codeend, false); + /** + * @brief There is an "issue" where the compiler will give totally bogus code + * address because codegeneration is still being calculated. A simple fix for + * this is to coerce the codestart value to 0 when it's invalid. + */ + if (sym->codestart > data->codesize) + { + ctx->symbols[iter].codestart = 0; + } else { + ctx->symbols[iter].codestart = RelocLookup(jit, sym->codestart, false); + } + if (sym->codeend > data->codesize) + { + ctx->symbols[iter].codeend = data->codesize; + } else { + ctx->symbols[iter].codeend = RelocLookup(jit, sym->codeend, false); + } ctx->symbols[iter].name = strbase + sym->name; ctx->symbols[iter].sym = sym; @@ -2261,3 +2276,13 @@ unsigned int JITX86::FunctionCount(const sp_context_t *ctx) return fnc->num_functions; } + +const char *JITX86::GetVersionString() +{ + return "1.0.0.0"; +} + +const char *JITX86::GetCPUOptimizations() +{ + return "Generic 80486"; +} diff --git a/sourcepawn/jit/x86/jit_x86.h b/sourcepawn/jit/x86/jit_x86.h index 05d3a2a8..fcdcbccf 100644 --- a/sourcepawn/jit/x86/jit_x86.h +++ b/sourcepawn/jit/x86/jit_x86.h @@ -81,6 +81,8 @@ public: unsigned int GetAPIVersion(); bool FunctionLookup(const sp_context_t *ctx, uint32_t code_addr, unsigned int *result); unsigned int FunctionCount(const sp_context_t *ctx); + const char *GetVersionString(); + const char *GetCPUOptimizations(); }; cell_t NativeCallback(sp_context_t *ctx, ucell_t native_idx, cell_t *params);