|
pred@2504
|
1 |
/** |
|
pred@2504
|
2 |
* vim: set ts=4 : |
|
pred@2504
|
3 |
* ============================================================================= |
|
pred@2504
|
4 |
* SourceMod BinTools Extension |
|
pred@2504
|
5 |
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. |
|
pred@2504
|
6 |
* ============================================================================= |
|
pred@2504
|
7 |
* |
|
pred@2504
|
8 |
* This program is free software; you can redistribute it and/or modify it under |
|
pred@2504
|
9 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
pred@2504
|
10 |
* Free Software Foundation. |
|
pred@2504
|
11 |
* |
|
pred@2504
|
12 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
pred@2504
|
13 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
pred@2504
|
14 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
pred@2504
|
15 |
* details. |
|
pred@2504
|
16 |
* |
|
pred@2504
|
17 |
* You should have received a copy of the GNU General Public License along with |
|
pred@2504
|
18 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
pred@2504
|
19 |
* |
|
pred@2504
|
20 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
pred@2504
|
21 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
pred@2504
|
22 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
pred@2504
|
23 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
pred@2504
|
24 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
pred@2504
|
25 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
pred@2504
|
26 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
pred@2504
|
27 |
* or <http://www.sourcemod.net/license.php>. |
|
pred@2504
|
28 |
* |
|
pred@2504
|
29 |
* Version: $Id$ |
|
pred@2504
|
30 |
*/ |
|
pred@2504
|
31 |
|
|
pred@2504
|
32 |
#ifndef _INCLUDE_SOURCEMOD_JIT_COMPILE_H_ |
|
pred@2504
|
33 |
#define _INCLUDE_SOURCEMOD_JIT_COMPILE_H_ |
|
pred@2504
|
34 |
|
|
pred@2504
|
35 |
#include <jit_helpers.h> |
|
pred@2504
|
36 |
#include <x86_macros.h> |
|
pred@2504
|
37 |
#include "CallWrapper.h" |
|
pred@2504
|
38 |
#include "HookWrapper.h" |
|
pred@2504
|
39 |
|
|
pred@2504
|
40 |
void *JIT_CallCompile(CallWrapper *pWrapper, FuncAddrMethod method); |
|
pred@2504
|
41 |
#if defined HOOKING_ENABLED |
|
pred@2504
|
42 |
void *JIT_HookCompile(HookWrapper *pWrapper); |
|
pred@2504
|
43 |
void JIT_FreeHook(void *addr); |
|
pred@2504
|
44 |
#endif |
|
pred@2504
|
45 |
|
|
pred@2504
|
46 |
/******************** |
|
pred@2504
|
47 |
* Assembly Helpers * |
|
pred@2504
|
48 |
********************/ |
|
pred@2504
|
49 |
|
|
pred@2504
|
50 |
inline jit_uint8_t _DecodeRegister3(jit_uint32_t val) |
|
pred@2504
|
51 |
{ |
|
pred@2504
|
52 |
switch (val % 3) |
|
pred@2504
|
53 |
{ |
|
pred@2504
|
54 |
case 0: |
|
pred@2504
|
55 |
{ |
|
pred@2504
|
56 |
return REG_EAX; |
|
pred@2504
|
57 |
} |
|
pred@2504
|
58 |
case 1: |
|
pred@2504
|
59 |
{ |
|
pred@2504
|
60 |
return REG_EDX; |
|
pred@2504
|
61 |
} |
|
pred@2504
|
62 |
case 2: |
|
pred@2504
|
63 |
{ |
|
pred@2504
|
64 |
return REG_ECX; |
|
pred@2504
|
65 |
} |
|
pred@2504
|
66 |
} |
|
pred@2504
|
67 |
|
|
pred@2504
|
68 |
/* Should never happen */ |
|
pred@2504
|
69 |
assert(false); |
|
pred@2504
|
70 |
return 0xFF; |
|
pred@2504
|
71 |
} |
|
pred@2504
|
72 |
|
|
pred@2504
|
73 |
extern jit_uint32_t g_RegDecoder; |
|
pred@2504
|
74 |
|
|
pred@2504
|
75 |
#endif //_INCLUDE_SOURCEMOD_JIT_COMPILE_H_ |