2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
|
|
|
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
|
|
|
*
|
|
|
|
* 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-07-03 00:49:40 +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-07-03 00:49:40 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2009-11-06 21:45:30 +00:00
|
|
|
namespace x86Emitter {
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2009-11-06 21:45:30 +00:00
|
|
|
// helpermess is currently broken >_<
|
2009-07-03 00:49:40 +00:00
|
|
|
|
2009-11-06 21:45:30 +00:00
|
|
|
#if 0
|
2009-07-03 00:49:40 +00:00
|
|
|
|
|
|
|
template< typename xImpl, typename T >
|
2009-11-06 21:45:30 +00:00
|
|
|
void _DoI_helpermess( const xImpl& helpme, const xDirectOrIndirect& to, const xImmReg<T>& immOrReg )
|
2009-07-03 00:49:40 +00:00
|
|
|
{
|
|
|
|
if( to.IsDirect() )
|
|
|
|
{
|
|
|
|
if( immOrReg.IsReg() )
|
|
|
|
helpme( to.GetReg(), immOrReg.GetReg() );
|
|
|
|
else
|
|
|
|
helpme( to.GetReg(), immOrReg.GetImm() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( immOrReg.IsReg() )
|
|
|
|
helpme( to.GetMem(), immOrReg.GetReg() );
|
|
|
|
else
|
|
|
|
helpme( to.GetMem(), immOrReg.GetImm() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template< typename xImpl, typename T >
|
|
|
|
void _DoI_helpermess( const xImpl& helpme, const ModSibBase& to, const xImmReg<T>& immOrReg )
|
|
|
|
{
|
|
|
|
if( immOrReg.IsReg() )
|
|
|
|
helpme( to, immOrReg.GetReg() );
|
|
|
|
else
|
2009-11-06 21:45:30 +00:00
|
|
|
helpme( (ModSibStrict)to, immOrReg.GetImm() );
|
2009-07-03 00:49:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template< typename xImpl, typename T >
|
|
|
|
void _DoI_helpermess( const xImpl& helpme, const xDirectOrIndirect<T>& to, int imm )
|
|
|
|
{
|
|
|
|
if( to.IsDirect() )
|
|
|
|
helpme( to.GetReg(), imm );
|
|
|
|
else
|
|
|
|
helpme( to.GetMem(), imm );
|
|
|
|
}
|
|
|
|
|
|
|
|
template< typename xImpl, typename T >
|
|
|
|
void _DoI_helpermess( const xImpl& helpme, const xDirectOrIndirect<T>& parm )
|
|
|
|
{
|
|
|
|
if( parm.IsDirect() )
|
|
|
|
helpme( parm.GetReg() );
|
|
|
|
else
|
|
|
|
helpme( parm.GetMem() );
|
|
|
|
}
|
|
|
|
|
|
|
|
template< typename xImpl, typename T >
|
|
|
|
void _DoI_helpermess( const xImpl& helpme, const xDirectOrIndirect<T>& to, const xDirectOrIndirect<T>& from )
|
|
|
|
{
|
|
|
|
if( to.IsDirect() && from.IsDirect() )
|
|
|
|
helpme( to.GetReg(), from.GetReg() );
|
|
|
|
|
|
|
|
else if( to.IsDirect() )
|
|
|
|
helpme( to.GetReg(), from.GetMem() );
|
|
|
|
|
|
|
|
else if( from.IsDirect() )
|
|
|
|
helpme( to.GetMem(), from.GetReg() );
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
// One of the fields needs to be direct, or else we cannot complete the operation.
|
|
|
|
// (intel doesn't support indirects in both fields)
|
|
|
|
|
2009-10-04 15:34:40 +00:00
|
|
|
pxFailDev( "Invalid asm instruction: Both operands are indirect memory addresses." );
|
2009-07-03 00:49:40 +00:00
|
|
|
}
|
2009-11-06 21:45:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
} // End namespace x86Emitter
|