some more API calls
authorDavid Anderson <dvander@alliedmods.net>
Mon Jan 01 20:58:02 2007 +0000 (2007-01-01)
changeset 253881b1fbcc698
parent 252 ce166c465bad
child 254 7c39a88ceaa3
some more API calls
fixed another bug in debug section
sourcepawn/include/sp_vm_api.h
sourcepawn/jit/x86/jit_x86.cpp
sourcepawn/jit/x86/jit_x86.h
     1.1 --- a/sourcepawn/include/sp_vm_api.h	Mon Jan 01 19:50:16 2007 +0000
     1.2 +++ b/sourcepawn/include/sp_vm_api.h	Mon Jan 01 20:58:02 2007 +0000
     1.3 @@ -608,6 +608,20 @@
     1.4  		 * @return			Number of functions.
     1.5  		 */
     1.6  		virtual unsigned int FunctionCount(const sp_context_t *ctx) =0;
     1.7 +
     1.8 +		/**
     1.9 +		 * @brief Returns a version string.
    1.10 +		 *
    1.11 +		 * @return			Versioning string.
    1.12 +		 */
    1.13 +		virtual const char *GetVersionString() =0;
    1.14 +
    1.15 +		/**
    1.16 +		 * @brief Returns a string describing optimizations.
    1.17 +		 *
    1.18 +		 * @return			String describing CPU specific optimizations.
    1.19 +		 */
    1.20 +		virtual const char *GetCPUOptimizations() =0;
    1.21  	};
    1.22  };
    1.23  
     2.1 --- a/sourcepawn/jit/x86/jit_x86.cpp	Mon Jan 01 19:50:16 2007 +0000
     2.2 +++ b/sourcepawn/jit/x86/jit_x86.cpp	Mon Jan 01 20:58:02 2007 +0000
     2.3 @@ -2119,8 +2119,23 @@
     2.4  		{
     2.5  			sym = (sp_fdbg_symbol_t *)cursor;
     2.6  
     2.7 -			ctx->symbols[iter].codestart = RelocLookup(jit, sym->codestart, false);
     2.8 -			ctx->symbols[iter].codeend = RelocLookup(jit, sym->codeend, false);
     2.9 +			/**
    2.10 +			 * @brief There is an "issue" where the compiler will give totally bogus code 
    2.11 +			 * address because codegeneration is still being calculated.  A simple fix for 
    2.12 +			 * this is to coerce the codestart value to 0 when it's invalid.
    2.13 +			 */
    2.14 +			if (sym->codestart > data->codesize)
    2.15 +			{
    2.16 +				ctx->symbols[iter].codestart = 0;
    2.17 +			} else {
    2.18 +				ctx->symbols[iter].codestart = RelocLookup(jit, sym->codestart, false);
    2.19 +			}
    2.20 +			if (sym->codeend > data->codesize)
    2.21 +			{
    2.22 +				ctx->symbols[iter].codeend = data->codesize;
    2.23 +			} else {
    2.24 +				ctx->symbols[iter].codeend = RelocLookup(jit, sym->codeend, false);
    2.25 +			}
    2.26  			ctx->symbols[iter].name = strbase + sym->name;
    2.27  			ctx->symbols[iter].sym = sym;
    2.28  
    2.29 @@ -2261,3 +2276,13 @@
    2.30  
    2.31  	return fnc->num_functions;
    2.32  }
    2.33 +
    2.34 +const char *JITX86::GetVersionString()
    2.35 +{
    2.36 +	return "1.0.0.0";
    2.37 +}
    2.38 +
    2.39 +const char *JITX86::GetCPUOptimizations()
    2.40 +{
    2.41 +	return "Generic 80486";
    2.42 +}
     3.1 --- a/sourcepawn/jit/x86/jit_x86.h	Mon Jan 01 19:50:16 2007 +0000
     3.2 +++ b/sourcepawn/jit/x86/jit_x86.h	Mon Jan 01 20:58:02 2007 +0000
     3.3 @@ -81,6 +81,8 @@
     3.4  	unsigned int GetAPIVersion();
     3.5  	bool FunctionLookup(const sp_context_t *ctx, uint32_t code_addr, unsigned int *result);
     3.6  	unsigned int FunctionCount(const sp_context_t *ctx);
     3.7 +	const char *GetVersionString();
     3.8 +	const char *GetCPUOptimizations();
     3.9  };
    3.10  
    3.11  cell_t NativeCallback(sp_context_t *ctx, ucell_t native_idx, cell_t *params);