2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
2010-05-03 14:08:02 +00:00
|
|
|
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-02-09 21:15:56 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-02-09 21:15:56 +00:00
|
|
|
*/
|
2009-04-14 01:26:57 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
/*
|
2009-11-06 21:45:30 +00:00
|
|
|
* ix86 public header v0.9.1
|
2009-04-14 01:26:57 +00:00
|
|
|
*
|
|
|
|
* Original Authors (v0.6.2 and prior):
|
|
|
|
* linuzappz <linuzappz@pcsx.net>
|
|
|
|
* alexey silinov
|
|
|
|
* goldfinger
|
|
|
|
* zerofrog(@gmail.com)
|
|
|
|
*
|
2009-11-06 21:45:30 +00:00
|
|
|
* Authors of v0.9.1:
|
2009-04-14 01:26:57 +00:00
|
|
|
* Jake.Stine(@gmail.com)
|
|
|
|
* cottonvibes(@gmail.com)
|
|
|
|
* sudonim(1@gmail.com)
|
2009-02-09 21:15:56 +00:00
|
|
|
*/
|
|
|
|
|
2009-04-08 06:25:40 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// New C++ Emitter!
|
|
|
|
//
|
|
|
|
// To use it just include the x86Emitter namespace into your file/class/function off choice.
|
2009-04-14 01:26:57 +00:00
|
|
|
//
|
|
|
|
// This header file is intended for use by public code. It includes the appropriate
|
|
|
|
// inlines and class definitions for efficient codegen. (code internal to the emitter
|
|
|
|
// should usually use ix86_internal.h instead, and manually include the
|
|
|
|
// ix86_inlines.inl file when it is known that inlining of ModSib functions are
|
|
|
|
// wanted).
|
|
|
|
//
|
2009-04-08 06:25:40 +00:00
|
|
|
|
2009-04-14 01:26:57 +00:00
|
|
|
#pragma once
|
2009-04-07 21:54:50 +00:00
|
|
|
|
2009-07-03 00:49:40 +00:00
|
|
|
#include "x86types.h"
|
|
|
|
#include "tools.h"
|
|
|
|
#include "instructions.h"
|
2009-03-01 14:42:31 +00:00
|
|
|
|
2009-04-14 01:26:57 +00:00
|
|
|
// Including legacy items for now, but these should be removed eventually,
|
|
|
|
// once most code is no longer dependent on them.
|
2009-07-03 00:49:40 +00:00
|
|
|
#include "legacy_types.h"
|
|
|
|
#include "legacy_instructions.h"
|
2009-10-24 16:28:48 +00:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// CallAddress Macros -- An Optimization work-around hack!
|
|
|
|
// --------------------------------------------------------------------------------------
|
|
|
|
// MSVC 2008 fails to optimize direct invocation of static recompiled code buffers, instead
|
|
|
|
// insisting on "mov eax, immaddr; call eax". Likewise, GCC fails to optimize it also, unless
|
|
|
|
// the typecast is explicitly inlined. These macros account for these problems.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
|
|
|
|
# define CallAddress( ptr ) \
|
|
|
|
__asm{ call offset ptr }
|
|
|
|
|
2009-11-02 07:00:59 +00:00
|
|
|
# define FastCallAddress( ptr, param1 ) \
|
2009-10-24 16:28:48 +00:00
|
|
|
__asm{ __asm mov ecx, param1 __asm call offset ptr }
|
|
|
|
|
|
|
|
# define FastCallAddress2( ptr, param1, param2 ) \
|
|
|
|
__asm{ __asm mov ecx, param1 __asm mov edx, param2 __asm call offset ptr }
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
# define CallAddress( ptr ) \
|
|
|
|
( (void (*)()) &(ptr)[0] )()
|
|
|
|
|
2009-11-02 07:00:59 +00:00
|
|
|
# define FastCallAddress( ptr, param1 ) \
|
|
|
|
( (void (*)( int )) &(ptr)[0] )( param1 )
|
2009-10-24 16:28:48 +00:00
|
|
|
|
2009-10-25 04:48:16 +00:00
|
|
|
# define FastCallAddress2( ptr, param1, param2 ) \
|
2009-10-24 16:28:48 +00:00
|
|
|
( (void (*)( int, int )) &(ptr)[0] )( param1, param2 )
|
|
|
|
|
2009-10-25 04:48:16 +00:00
|
|
|
#endif
|