pred@2504: /** pred@2504: * vim: set ts=4 : pred@2504: * ============================================================================= pred@2504: * SourceMod BinTools Extension pred@2504: * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. pred@2504: * ============================================================================= pred@2504: * pred@2504: * This program is free software; you can redistribute it and/or modify it under pred@2504: * the terms of the GNU General Public License, version 3.0, as published by the pred@2504: * Free Software Foundation. pred@2504: * pred@2504: * This program is distributed in the hope that it will be useful, but WITHOUT pred@2504: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS pred@2504: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more pred@2504: * details. pred@2504: * pred@2504: * You should have received a copy of the GNU General Public License along with pred@2504: * this program. If not, see . pred@2504: * pred@2504: * As a special exception, AlliedModders LLC gives you permission to link the pred@2504: * code of this program (as well as its derivative works) to "Half-Life 2," the pred@2504: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software pred@2504: * by the Valve Corporation. You must obey the GNU General Public License in pred@2504: * all respects for all other code used. Additionally, AlliedModders LLC grants pred@2504: * this exception to all derivative works. AlliedModders LLC defines further pred@2504: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), pred@2504: * or . pred@2504: * pred@2504: * Version: $Id$ pred@2504: */ pred@2504: pred@2504: #ifndef _INCLUDE_SOURCEMOD_JIT_COMPILE_H_ pred@2504: #define _INCLUDE_SOURCEMOD_JIT_COMPILE_H_ pred@2504: pred@2504: #include pred@2504: #include pred@2504: #include "CallWrapper.h" pred@2504: #include "HookWrapper.h" pred@2504: pred@2504: void *JIT_CallCompile(CallWrapper *pWrapper, FuncAddrMethod method); pred@2504: #if defined HOOKING_ENABLED pred@2504: void *JIT_HookCompile(HookWrapper *pWrapper); pred@2504: void JIT_FreeHook(void *addr); pred@2504: #endif pred@2504: pred@2504: /******************** pred@2504: * Assembly Helpers * pred@2504: ********************/ pred@2504: pred@2504: inline jit_uint8_t _DecodeRegister3(jit_uint32_t val) pred@2504: { pred@2504: switch (val % 3) pred@2504: { pred@2504: case 0: pred@2504: { pred@2504: return REG_EAX; pred@2504: } pred@2504: case 1: pred@2504: { pred@2504: return REG_EDX; pred@2504: } pred@2504: case 2: pred@2504: { pred@2504: return REG_ECX; pred@2504: } pred@2504: } pred@2504: pred@2504: /* Should never happen */ pred@2504: assert(false); pred@2504: return 0xFF; pred@2504: } pred@2504: pred@2504: extern jit_uint32_t g_RegDecoder; pred@2504: pred@2504: #endif //_INCLUDE_SOURCEMOD_JIT_COMPILE_H_