wxGui branch: [linux] Updated projects, added Utilities and x86emitter libraries.

git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1459 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-07-03 20:12:33 +00:00
parent da691894c3
commit aceefaf812
19 changed files with 436 additions and 421 deletions

View File

@ -7,7 +7,7 @@
<Option compiler="gcc" /> <Option compiler="gcc" />
<Build> <Build>
<Target title="Debug"> <Target title="Debug">
<Option output="../../deps/debug/libbzip2-dbg" prefix_auto="1" extension_auto="1" /> <Option output="../../deps/debug/libbzip2" prefix_auto="1" extension_auto="1" />
<Option working_dir="" /> <Option working_dir="" />
<Option object_output="./.objs/debug" /> <Option object_output="./.objs/debug" />
<Option type="2" /> <Option type="2" />
@ -19,7 +19,7 @@
</Compiler> </Compiler>
</Target> </Target>
<Target title="Release"> <Target title="Release">
<Option output="../../deps/libbzip2" prefix_auto="1" extension_auto="1" /> <Option output="../../deps/release/libbzip2" prefix_auto="1" extension_auto="1" />
<Option working_dir="" /> <Option working_dir="" />
<Option object_output="./.objs/release" /> <Option object_output="./.objs/release" />
<Option type="2" /> <Option type="2" />
@ -35,7 +35,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Devel"> <Target title="Devel">
<Option output="../../deps/devel/libbzip2-dev" prefix_auto="1" extension_auto="1" /> <Option output="../../deps/devel/libbzip2" prefix_auto="1" extension_auto="1" />
<Option working_dir="" /> <Option working_dir="" />
<Option object_output="./.objs/devel" /> <Option object_output="./.objs/devel" />
<Option type="2" /> <Option type="2" />

View File

@ -7,7 +7,7 @@
<Option compiler="gcc" /> <Option compiler="gcc" />
<Build> <Build>
<Target title="Debug"> <Target title="Debug">
<Option output="../../deps/debug/zlib-dbg" prefix_auto="0" extension_auto="1" /> <Option output="../../deps/debug/zlib" prefix_auto="0" extension_auto="1" />
<Option working_dir="" /> <Option working_dir="" />
<Option object_output="./.objs/debug" /> <Option object_output="./.objs/debug" />
<Option type="2" /> <Option type="2" />
@ -20,7 +20,7 @@
</Compiler> </Compiler>
</Target> </Target>
<Target title="Release"> <Target title="Release">
<Option output="../../deps/zlib" prefix_auto="0" extension_auto="1" /> <Option output="../../deps/release/zlib" prefix_auto="0" extension_auto="1" />
<Option working_dir="" /> <Option working_dir="" />
<Option object_output="./.objs/release" /> <Option object_output="./.objs/release" />
<Option type="2" /> <Option type="2" />
@ -33,7 +33,7 @@
</Compiler> </Compiler>
</Target> </Target>
<Target title="Devel"> <Target title="Devel">
<Option output="../../deps/devel/zlib-dev" prefix_auto="0" extension_auto="1" /> <Option output="../../deps/devel/zlib" prefix_auto="0" extension_auto="1" />
<Option working_dir="" /> <Option working_dir="" />
<Option object_output="./.objs/devel" /> <Option object_output="./.objs/devel" />
<Option type="2" /> <Option type="2" />

View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Utilities" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="../../deps/debug/libUtilities.a" prefix_auto="0" extension_auto="0" />
<Option working_dir="" />
<Option object_output="./.objs/debug/" />
<Option type="2" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=yes --cflags`" />
<Add directory="../../include/Utilities" />
<Add directory="../../include" />
</Compiler>
</Target>
<Target title="Release">
<Option output="../../deps/release/libUtilities.a" prefix_auto="0" extension_auto="0" />
<Option working_dir="" />
<Option object_output="./.objs/release/" />
<Option type="2" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Compiler>
<Add option="-O2" />
<Add option="-Wall" />
<Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=no --cflags`" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
<Target title="Devel">
<Option output="../../deps/devel/libUtilities.a" prefix_auto="0" extension_auto="0" />
<Option working_dir="" />
<Option object_output="./.objs/devel/" />
<Option type="2" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Compiler>
<Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=yes --cflags`" />
</Compiler>
</Target>
</Build>
<Unit filename="../../include/Utilities/Console.h" />
<Unit filename="../../include/Utilities/Dependencies.h" />
<Unit filename="../../include/Utilities/Exceptions.h" />
<Unit filename="../../include/Utilities/General.h" />
<Unit filename="../../include/Utilities/MemcpyFast.h" />
<Unit filename="../../include/Utilities/RedtapeWindows.h" />
<Unit filename="../../include/Utilities/SafeArray.h" />
<Unit filename="../../include/Utilities/StringHelpers.h" />
<Unit filename="../../include/Utilities/Threading.h" />
<Unit filename="../../include/Utilities/lnx_memzero.h" />
<Unit filename="../../include/Utilities/win_memzero.h" />
<Unit filename="../../include/intrin_x86.h" />
<Unit filename="../../src/Utilities/AlignedMalloc.cpp" />
<Unit filename="../../src/Utilities/Console.cpp" />
<Unit filename="../../src/Utilities/Exceptions.cpp" />
<Unit filename="../../src/Utilities/Linux/LnxHostSys.cpp" />
<Unit filename="../../src/Utilities/LnxMisc.cpp" />
<Unit filename="../../src/Utilities/LnxThreads.cpp" />
<Unit filename="../../src/Utilities/PrecompiledHeader.cpp" />
<Unit filename="../../src/Utilities/PrecompiledHeader.h" />
<Unit filename="../../src/Utilities/StringHelpers.cpp" />
<Unit filename="../../src/Utilities/ThreadTools.cpp" />
<Unit filename="../../src/Utilities/vssprintf.cpp" />
<Unit filename="../../src/Utilities/x86/MemcpyFast.S" />
<Extensions>
<envvars />
<code_completion>
<search_path add="/usr/include/wx-2.8" />
</code_completion>
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="x86emitter" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="../../deps/debug/libx86emitter.a" prefix_auto="0" extension_auto="0" />
<Option working_dir="" />
<Option object_output="./.objs/debug/" />
<Option type="2" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=yes --cflags`" />
</Compiler>
</Target>
<Target title="Release">
<Option output="../../deps/release/libx86emitter.a" prefix_auto="0" extension_auto="0" />
<Option working_dir="" />
<Option object_output="./.objs/release/" />
<Option type="2" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Compiler>
<Add option="-O2" />
<Add option="-Wall" />
<Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=no --cflags`" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
<Target title="Devel">
<Option output="../../deps/devel/libx86emitter.a" prefix_auto="0" extension_auto="0" />
<Option working_dir="" />
<Option object_output="./.objs/devel" />
<Option type="2" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Compiler>
<Add option="-O2" />
<Add option="-Wall" />
<Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=no --cflags`" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add directory="../../include/x86emitter" />
<Add directory="../../include" />
</Compiler>
<Unit filename="../../include/x86emitter/implement/dwshift.h" />
<Unit filename="../../include/x86emitter/implement/group1.h" />
<Unit filename="../../include/x86emitter/implement/group2.h" />
<Unit filename="../../include/x86emitter/implement/group3.h" />
<Unit filename="../../include/x86emitter/implement/helpers.h" />
<Unit filename="../../include/x86emitter/implement/incdec.h" />
<Unit filename="../../include/x86emitter/implement/jmpcall.h" />
<Unit filename="../../include/x86emitter/implement/movs.h" />
<Unit filename="../../include/x86emitter/implement/test.h" />
<Unit filename="../../include/x86emitter/implement/xchg.h" />
<Unit filename="../../include/x86emitter/implement/xmm/arithmetic.h" />
<Unit filename="../../include/x86emitter/implement/xmm/basehelpers.h" />
<Unit filename="../../include/x86emitter/implement/xmm/comparisons.h" />
<Unit filename="../../include/x86emitter/implement/xmm/moremovs.h" />
<Unit filename="../../include/x86emitter/implement/xmm/shufflepack.h" />
<Unit filename="../../include/x86emitter/inlines.inl" />
<Unit filename="../../include/x86emitter/instructions.h" />
<Unit filename="../../include/x86emitter/internal.h" />
<Unit filename="../../include/x86emitter/legacy_instructions.h" />
<Unit filename="../../include/x86emitter/legacy_internal.h" />
<Unit filename="../../include/x86emitter/legacy_types.h" />
<Unit filename="../../include/x86emitter/macros.h" />
<Unit filename="../../include/x86emitter/sse_helpers.h" />
<Unit filename="../../include/x86emitter/tools.h" />
<Unit filename="../../include/x86emitter/x86emitter.h" />
<Unit filename="../../include/x86emitter/x86types.h" />
<Unit filename="../../src/x86emitter/3dnow.cpp" />
<Unit filename="../../src/x86emitter/PrecompiledHeader.cpp" />
<Unit filename="../../src/x86emitter/PrecompiledHeader.h" />
<Unit filename="../../src/x86emitter/cpudetect.cpp" />
<Unit filename="../../src/x86emitter/fpu.cpp" />
<Unit filename="../../src/x86emitter/jmp.cpp" />
<Unit filename="../../src/x86emitter/legacy.cpp" />
<Unit filename="../../src/x86emitter/legacy_sse.cpp" />
<Unit filename="../../src/x86emitter/simd.cpp" />
<Unit filename="../../src/x86emitter/tools.cpp" />
<Unit filename="../../src/x86emitter/x86emitter.cpp" />
<Extensions>
<envvars />
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

View File

@ -5,17 +5,17 @@
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#ifndef __PCSX2DEFS_H__ #ifndef __PCSX2DEFS_H__
#define __PCSX2DEFS_H__ #define __PCSX2DEFS_H__
@ -199,9 +199,9 @@
# define __naked __declspec(naked) # define __naked __declspec(naked)
# define __unused /*unused*/ # define __unused /*unused*/
# define __noinline __declspec(noinline) # define __noinline __declspec(noinline)
// Don't know if there are Visual C++ equivalents of these. // Don't know if there are Visual C++ equivalents of these.
# define __hot # define __hot
# define __cold # define __cold
# define likely(x) x # define likely(x) x
@ -215,7 +215,7 @@
# define GCC_VERSION (__GNUC__ * 10000 \ # define GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \ + __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__) + __GNUC_PATCHLEVEL__)
/* Test for GCC > 4.4.0; Should be adjusted when new versions come out */ /* Test for GCC > 4.4.0; Should be adjusted when new versions come out */
# if GCC_VERSION >= 40400 # if GCC_VERSION >= 40400
# define THE_UNBEARABLE_LIGHTNESS_OF_BEING_GCC_4_4_0 # define THE_UNBEARABLE_LIGHTNESS_OF_BEING_GCC_4_4_0

View File

@ -18,6 +18,9 @@
#pragma once #pragma once
// must include wx/setup.h first, otherwise we get warnings/errors regarding __LINUX__
#include <wx/setup.h>
#include "Pcsx2Defs.h" #include "Pcsx2Defs.h"
#include <wx/string.h> #include <wx/string.h>

View File

@ -89,9 +89,7 @@ namespace Console
{ {
ScopedLock locker( m_writelock ); ScopedLock locker( m_writelock );
vssprintf( m_format_buffer, fmt, args ); vssprintf( m_format_buffer, fmt, args );
const char* cstr = m_format_buffer.c_str(); Write( m_format_buffer.c_str() );
Write( fmt );
} }
__forceinline void __fastcall _WriteLn( const char* fmt, va_list args ) __forceinline void __fastcall _WriteLn( const char* fmt, va_list args )
@ -106,7 +104,7 @@ namespace Console
_WriteLn( fmt, args ); _WriteLn( fmt, args );
ClearColor(); ClearColor();
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
bool Write( const char* fmt, VARG_PARAM dummy, ... ) bool Write( const char* fmt, VARG_PARAM dummy, ... )
{ {

View File

@ -16,13 +16,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "PrecompiledHeader.h" #include "../PrecompiledHeader.h"
#include <sys/mman.h> #include <sys/mman.h>
#include <signal.h> #include <signal.h>
namespace HostSys namespace HostSys
{ {
static const uptr m_pagemask = getpagesize()-1;
void *Mmap(uptr base, u32 size) void *Mmap(uptr base, u32 size)
{ {
u8 *Mem; u8 *Mem;

View File

@ -18,6 +18,7 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "Threading.h" #include "Threading.h"
#include "x86emitter/tools.h"
// Note: assuming multicore is safer because it forces the interlocked routines to use // Note: assuming multicore is safer because it forces the interlocked routines to use
// the LOCK prefix. The prefix works on single core CPUs fine (but is slow), but not // the LOCK prefix. The prefix works on single core CPUs fine (but is slow), but not
@ -75,98 +76,4 @@ namespace Threading
return NULL; return NULL;
} }
/////////////////////////////////////////////////////////////////////////
// Cross-platform atomic operations for GCC.
// These are much faster than the old versions for single core CPUs.
// Note, I've disabled the single core optimization, because pcsx2 shouldn't
// ever create threads on single core CPUs anyway.
__forceinline long pcsx2_InterlockedExchange(volatile long* Target, long Value)
{
long result;
/*
* The XCHG instruction always locks the bus with or without the
* LOCKED prefix. This makes it significantly slower than CMPXCHG on
* uni-processor machines. The Windows InterlockedExchange function
* is nearly 3 times faster than the XCHG instruction, so this routine
* is not yet very useful for speeding up pthreads.
*/
if( true ) //isMultiCore )
{
__asm__ __volatile__ (
"xchgl %2,%1"
:"=r" (result)
:"m" (*Target), "0" (Value));
}
else
{
/*
* Faster version of XCHG for uni-processor systems because
* it doesn't lock the bus. If an interrupt or context switch
* occurs between the movl and the cmpxchgl then the value in
* 'location' may have changed, in which case we will loop
* back to do the movl again.
*/
__asm__ __volatile__ (
"0:\n\t"
"movl %1,%%eax\n\t"
"cmpxchgl %2,%1\n\t"
"jnz 0b"
:"=&a" (result)
:"m" (*Target), "r" (Value));
}
return result;
}
__forceinline long pcsx2_InterlockedExchangeAdd(volatile long* Addend, long Value)
{
if( true ) //isMultiCore )
{
__asm__ __volatile__(
".intel_syntax noprefix\n"
"lock xadd [%0], eax\n"
".att_syntax\n" : : "r"(Addend), "a"(Value) : "memory");
}
else
{
__asm__ __volatile__(
".intel_syntax noprefix\n"
"xadd [%0], eax\n"
".att_syntax\n" : : "r"(Addend), "a"(Value) : "memory");
}
}
__forceinline long pcsx2_InterlockedCompareExchange(volatile long *dest, long value, long comp)
{
long result;
if( true ) //isMultiCore )
{
__asm__ __volatile__ (
"lock\n\t"
"cmpxchgl %2,%1" /* if (EAX == [location]) */
/* [location] = value */
/* else */
/* EAX = [location] */
:"=a" (result)
:"m" (*dest), "r" (value), "a" (comp));
}
else
{
__asm__ __volatile__ (
"cmpxchgl %2,%1" /* if (EAX == [location]) */
/* [location] = value */
/* else */
/* EAX = [location] */
:"=a" (result)
:"m" (*dest), "r" (value), "a" (comp));
}
return result;
}
} }

View File

@ -51,7 +51,7 @@ namespace Threading
int Thread::GetReturnCode() const int Thread::GetReturnCode() const
{ {
if( !m_terminated ) if( !m_terminated )
throw std::logic_error( "Thread is still running. No return code is available." ); throw std::logic_error( "Thread is still running. No return code is available." );
return m_returncode; return m_returncode;
@ -60,10 +60,10 @@ namespace Threading
// pthread Cond is an evil api that is not suited for Pcsx2 needs. // pthread Cond is an evil api that is not suited for Pcsx2 needs.
// Let's not use it. (Air) // Let's not use it. (Air)
#if 0 #if 0
WaitEvent::WaitEvent() WaitEvent::WaitEvent()
{ {
int err = 0; int err = 0;
err = pthread_cond_init(&cond, NULL); err = pthread_cond_init(&cond, NULL);
err = pthread_mutex_init(&mutex, NULL); err = pthread_mutex_init(&mutex, NULL);
} }
@ -93,7 +93,7 @@ namespace Threading
{ {
sem_init( &sema, false, 0 ); sem_init( &sema, false, 0 );
} }
Semaphore::~Semaphore() Semaphore::~Semaphore()
{ {
sem_destroy( &sema ); sem_destroy( &sema );
@ -153,7 +153,23 @@ namespace Threading
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// define some overloads for InterlockedExchanges // define some overloads for InterlockedExchanges
// for commonly used types, like u32 and s32. // for commonly used types, like u32 and s32.
__forceinline long pcsx2_InterlockedExchange( volatile long* target, long srcval )
{
return _InterlockedExchange( target, srcval );
}
__forceinline long pcsx2_InterlockedCompareExchange( volatile long* target, long srcval, long comp )
{
// Use the pthreads-win32 implementation...
return _InterlockedCompareExchange( target, srcval, comp );
}
__forceinline long pcsx2_InterlockedExchangeAdd( volatile long* target, long srcval )
{
return _InterlockedExchangeAdd( target, srcval );
}
__forceinline void AtomicExchange( volatile u32& Target, u32 value ) __forceinline void AtomicExchange( volatile u32& Target, u32 value )
{ {
pcsx2_InterlockedExchange( (volatile long*)&Target, value ); pcsx2_InterlockedExchange( (volatile long*)&Target, value );
@ -204,4 +220,4 @@ namespace Threading
pcsx2_InterlockedCompareExchange( (volatile long*)target, (long)value, (long)comparand ); pcsx2_InterlockedCompareExchange( (volatile long*)target, (long)value, (long)comparand );
} }
} }

View File

@ -87,58 +87,5 @@ namespace Threading
return NULL; return NULL;
} }
// Note: assuming multicore is safer because it forces the interlocked routines to use
// the LOCK prefix. The prefix works on single core CPUs fine (but is slow), but not
// having the LOCK prefix is very bad indeed.
//////////////////////////////////////////////////////////////////////
// Win32 versions of InterlockedExchange.
// These are much faster than the Win32 Kernel versions thanks to inlining.
__forceinline long pcsx2_InterlockedExchange( volatile long* target, long srcval )
{
return _InterlockedExchange( target, srcval );
}
__forceinline long pcsx2_InterlockedCompareExchange( volatile long* target, long srcval, long comp )
{
// Use the pthreads-win32 implementation...
return _InterlockedCompareExchange( target, srcval, comp );
}
__forceinline long pcsx2_InterlockedExchangeAdd( volatile long* target, long srcval )
{
//long result;
// Use our own implementation...
// Pcsx2 won't use threads unless it's a multicore cpu, so no need to use
// the optimized single-core method.
if( true ) //ptw32_smp_system )
{
__asm
{
mov ecx,dword ptr [target]
mov eax,dword ptr [srcval]
lock xadd dword ptr [ecx],eax
// msvc smartly returns eax for us without so much as a compiler warning even...
//mov dword ptr [result], eax
}
}
else
{
__asm
{
mov ecx,dword ptr [target]
mov eax,dword ptr [srcval]
xadd dword ptr [ecx],eax
// msvc smartly returns eax for us without so much as a compiler warning even...
//mov dword ptr [result], eax
}
}
// return result;
}
} }

View File

@ -460,7 +460,7 @@ static void cropzeros(char *buffer)
stop = buffer--; stop = buffer--;
while (*buffer == '0') buffer--; while (*buffer == '0') buffer--;
if (*buffer == '.') buffer--; if (*buffer == '.') buffer--;
while (*++buffer = *stop++); while ( (*++buffer = *stop++) != 0 );
} }
} }

View File

@ -1,6 +1,9 @@
#ifndef EMITTER_PRECOMPILED_HEADER #ifndef EMITTER_PRECOMPILED_HEADER
#define EMITTER_PRECOMPILED_HEADER #define EMITTER_PRECOMPILED_HEADER
// must include wx/setup.h first, otherwise we get warnings/errors regarding __LINUX__
#include <wx/setup.h>
#include "Pcsx2Defs.h" #include "Pcsx2Defs.h"
#include <wx/string.h> #include <wx/string.h>

View File

@ -5,12 +5,12 @@
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@ -35,7 +35,7 @@ static s32 iCpuId( u32 cmd, u32 *regs )
xor ecx, ecx; // ecx should be zero for CPUID(4) xor ecx, ecx; // ecx should be zero for CPUID(4)
} }
#else #else
__asm__ ( "xor ecx, ecx" ); __asm__ ( "xor %ecx, %ecx" );
#endif #endif
__cpuid( (int*)regs, cmd ); __cpuid( (int*)regs, cmd );
@ -48,7 +48,7 @@ static u64 GetRdtsc( void )
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Note: This function doesn't support GCC/Linux. Looking online it seems the only // Note: This function doesn't support GCC/Linux. Looking online it seems the only
// way to simulate the Microsoft SEH model is to use unix signals, and the 'sigaction' // way to simulate the Microsoft SEH model is to use unix signals, and the 'sigaction'
// function specifically. Maybe a project for a linux developer at a later date. :) // function specifically. Maybe a project for a linux developer at a later date. :)
// //
@ -89,7 +89,7 @@ static void SetSingleAffinity()
DWORD_PTR availProcCpus, availSysCpus; DWORD_PTR availProcCpus, availSysCpus;
if( !GetProcessAffinityMask( GetCurrentProcess(), &availProcCpus, &availSysCpus ) ) return; if( !GetProcessAffinityMask( GetCurrentProcess(), &availProcCpus, &availSysCpus ) ) return;
int i; int i;
for( i=0; i<32; ++i ) for( i=0; i<32; ++i )
{ {
@ -158,17 +158,17 @@ int arr[] = {
0x20202020,0x20402020,0x36362e32,0x7a4847 0x20202020,0x20402020,0x36362e32,0x7a4847
}; };
void cpudetectInit() void cpudetectInit()
{ {
u32 regs[ 4 ]; u32 regs[ 4 ];
u32 cmds; u32 cmds;
int cputype=0; // Cpu type int cputype=0; // Cpu type
//AMD 64 STUFF //AMD 64 STUFF
u32 x86_64_8BITBRANDID; u32 x86_64_8BITBRANDID;
u32 x86_64_12BITBRANDID; u32 x86_64_12BITBRANDID;
int num; int num;
char str[50]; char str[50];
memzero_obj( cpuinfo.x86ID ); memzero_obj( cpuinfo.x86ID );
cpuinfo.x86Family = 0; cpuinfo.x86Family = 0;
cpuinfo.x86Model = 0; cpuinfo.x86Model = 0;
@ -176,21 +176,21 @@ void cpudetectInit()
cpuinfo.x86StepID = 0; cpuinfo.x86StepID = 0;
cpuinfo.x86Flags = 0; cpuinfo.x86Flags = 0;
cpuinfo.x86EFlags = 0; cpuinfo.x86EFlags = 0;
if ( iCpuId( 0, regs ) == -1 ) return; if ( iCpuId( 0, regs ) == -1 ) return;
cmds = regs[ 0 ]; cmds = regs[ 0 ];
((u32*)cpuinfo.x86ID)[ 0 ] = regs[ 1 ]; ((u32*)cpuinfo.x86ID)[ 0 ] = regs[ 1 ];
((u32*)cpuinfo.x86ID)[ 1 ] = regs[ 3 ]; ((u32*)cpuinfo.x86ID)[ 1 ] = regs[ 3 ];
((u32*)cpuinfo.x86ID)[ 2 ] = regs[ 2 ]; ((u32*)cpuinfo.x86ID)[ 2 ] = regs[ 2 ];
// Hack - prevents reg[2] & reg[3] from being optimized out of existance! // Hack - prevents reg[2] & reg[3] from being optimized out of existance!
num = sprintf(str, "\tx86Flags = %8.8x %8.8x\n", regs[3], regs[2]); num = sprintf(str, "\tx86Flags = %8.8x %8.8x\n", regs[3], regs[2]);
u32 LogicalCoresPerPhysicalCPU = 0; u32 LogicalCoresPerPhysicalCPU = 0;
u32 PhysicalCoresPerPhysicalCPU = 1; u32 PhysicalCoresPerPhysicalCPU = 1;
if ( cmds >= 0x00000001 ) if ( cmds >= 0x00000001 )
{ {
if ( iCpuId( 0x00000001, regs ) != -1 ) if ( iCpuId( 0x00000001, regs ) != -1 )
{ {
@ -216,14 +216,14 @@ void cpudetectInit()
if ( iCpuId( 0x80000000, regs ) != -1 ) if ( iCpuId( 0x80000000, regs ) != -1 )
{ {
cmds = regs[ 0 ]; cmds = regs[ 0 ];
if ( cmds >= 0x80000001 ) if ( cmds >= 0x80000001 )
{ {
if ( iCpuId( 0x80000001, regs ) != -1 ) if ( iCpuId( 0x80000001, regs ) != -1 )
{ {
x86_64_12BITBRANDID = regs[1] & 0xfff; x86_64_12BITBRANDID = regs[1] & 0xfff;
cpuinfo.x86EFlags2 = regs[ 2 ]; cpuinfo.x86EFlags2 = regs[ 2 ];
cpuinfo.x86EFlags = regs[ 3 ]; cpuinfo.x86EFlags = regs[ 3 ];
} }
} }
/* detect multicore for amd cpu */ /* detect multicore for amd cpu */
@ -235,7 +235,7 @@ void cpudetectInit()
} }
} }
} }
switch(cpuinfo.x86PType) switch(cpuinfo.x86PType)
{ {
case 0: case 0:
@ -256,7 +256,7 @@ void cpudetectInit()
} }
if ( cpuinfo.x86ID[ 0 ] == 'G' ){ cputype=0;}//trick lines but if you know a way better ;p if ( cpuinfo.x86ID[ 0 ] == 'G' ){ cputype=0;}//trick lines but if you know a way better ;p
if ( cpuinfo.x86ID[ 0 ] == 'A' ){ cputype=1;} if ( cpuinfo.x86ID[ 0 ] == 'A' ){ cputype=1;}
memzero_obj( cpuinfo.x86Fam ); memzero_obj( cpuinfo.x86Fam );
iCpuId( 0x80000002, (u32*)cpuinfo.x86Fam); iCpuId( 0x80000002, (u32*)cpuinfo.x86Fam);
iCpuId( 0x80000003, (u32*)(cpuinfo.x86Fam+16)); iCpuId( 0x80000003, (u32*)(cpuinfo.x86Fam+16));
@ -292,12 +292,12 @@ void cpudetectInit()
cpucaps.hasMultiThreading = ( cpuinfo.x86Flags >> 28 ) & 1; cpucaps.hasMultiThreading = ( cpuinfo.x86Flags >> 28 ) & 1;
cpucaps.hasThermalMonitor = ( cpuinfo.x86Flags >> 29 ) & 1; cpucaps.hasThermalMonitor = ( cpuinfo.x86Flags >> 29 ) & 1;
cpucaps.hasIntel64BitArchitecture = ( cpuinfo.x86Flags >> 30 ) & 1; cpucaps.hasIntel64BitArchitecture = ( cpuinfo.x86Flags >> 30 ) & 1;
//that is only for AMDs //that is only for AMDs
cpucaps.hasMultimediaExtensionsExt = ( cpuinfo.x86EFlags >> 22 ) & 1; //mmx2 cpucaps.hasMultimediaExtensionsExt = ( cpuinfo.x86EFlags >> 22 ) & 1; //mmx2
cpucaps.hasAMD64BitArchitecture = ( cpuinfo.x86EFlags >> 29 ) & 1; //64bit cpu cpucaps.hasAMD64BitArchitecture = ( cpuinfo.x86EFlags >> 29 ) & 1; //64bit cpu
cpucaps.has3DNOWInstructionExtensionsExt = ( cpuinfo.x86EFlags >> 30 ) & 1; //3dnow+ cpucaps.has3DNOWInstructionExtensionsExt = ( cpuinfo.x86EFlags >> 30 ) & 1; //3dnow+
cpucaps.has3DNOWInstructionExtensions = ( cpuinfo.x86EFlags >> 31 ) & 1; //3dnow cpucaps.has3DNOWInstructionExtensions = ( cpuinfo.x86EFlags >> 31 ) & 1; //3dnow
cpucaps.hasStreamingSIMD4ExtensionsA = ( cpuinfo.x86EFlags2 >> 6 ) & 1; //INSERTQ / EXTRQ / MOVNT cpucaps.hasStreamingSIMD4ExtensionsA = ( cpuinfo.x86EFlags2 >> 6 ) & 1; //INSERTQ / EXTRQ / MOVNT
InitCPUTicks(); InitCPUTicks();
@ -311,8 +311,8 @@ void cpudetectInit()
// --> SSE3 / SSSE3 / SSE4.1 / SSE 4.2 detection <-- // --> SSE3 / SSSE3 / SSE4.1 / SSE 4.2 detection <--
cpucaps.hasStreamingSIMD3Extensions = ( cpuinfo.x86Flags2 >> 0 ) & 1; //sse3 cpucaps.hasStreamingSIMD3Extensions = ( cpuinfo.x86Flags2 >> 0 ) & 1; //sse3
cpucaps.hasSupplementalStreamingSIMD3Extensions = ( cpuinfo.x86Flags2 >> 9 ) & 1; //ssse3 cpucaps.hasSupplementalStreamingSIMD3Extensions = ( cpuinfo.x86Flags2 >> 9 ) & 1; //ssse3
cpucaps.hasStreamingSIMD4Extensions = ( cpuinfo.x86Flags2 >> 19 ) & 1; //sse4.1 cpucaps.hasStreamingSIMD4Extensions = ( cpuinfo.x86Flags2 >> 19 ) & 1; //sse4.1
cpucaps.hasStreamingSIMD4Extensions2 = ( cpuinfo.x86Flags2 >> 20 ) & 1; //sse4.2 cpucaps.hasStreamingSIMD4Extensions2 = ( cpuinfo.x86Flags2 >> 20 ) & 1; //sse4.2
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -343,7 +343,7 @@ void cpudetectInit()
u8* funcSSE41 = xGetPtr(); u8* funcSSE41 = xGetPtr();
xBLEND.VPD( xmm1, xmm0 ); xBLEND.VPD( xmm1, xmm0 );
xRET(); xRET();
bool sse3_result = _test_instruction( recSSE ); // sse3 bool sse3_result = _test_instruction( recSSE ); // sse3
bool ssse3_result = _test_instruction( funcSSSE3 ); bool ssse3_result = _test_instruction( funcSSSE3 );
bool sse41_result = _test_instruction( funcSSE41 ); bool sse41_result = _test_instruction( funcSSE41 );
@ -359,7 +359,7 @@ void cpudetectInit()
{ {
Console::Notice( "SSE3 Detection Inconsistency: cpuid=%s, test_result=%s", Console::Notice( "SSE3 Detection Inconsistency: cpuid=%s, test_result=%s",
params bool_to_char( !!cpucaps.hasStreamingSIMD3Extensions ), bool_to_char( sse3_result ) ); params bool_to_char( !!cpucaps.hasStreamingSIMD3Extensions ), bool_to_char( sse3_result ) );
cpucaps.hasStreamingSIMD3Extensions = sse3_result; cpucaps.hasStreamingSIMD3Extensions = sse3_result;
} }

View File

@ -5,12 +5,12 @@
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@ -95,7 +95,7 @@ static __forceinline ModSibStrict<ImmType> _mhlp2( x86IntRegType src1, x86IntReg
{ x##cod( _mhlp2<u##bits>(to1,to2) + offset, _reghlp<u##bits>(from) ); } \ { x##cod( _mhlp2<u##bits>(to1,to2) + offset, _reghlp<u##bits>(from) ); } \
emitterT void cod##bits##RmStoR( x86IntRegType to, x86IntRegType from1, x86IntRegType from2, int offset ) \ emitterT void cod##bits##RmStoR( x86IntRegType to, x86IntRegType from1, x86IntRegType from2, int offset ) \
{ x##cod( _reghlp<u##bits>(to), _mhlp2<u##bits>(from1,from2) + offset ); } { x##cod( _reghlp<u##bits>(to), _mhlp2<u##bits>(from1,from2) + offset ); }
#define DEFINE_LEGACY_SHIFT_HELPER( cod, bits ) \ #define DEFINE_LEGACY_SHIFT_HELPER( cod, bits ) \
emitterT void cod##bits##CLtoR( x86IntRegType to ) { x##cod( _reghlp<u##bits>(to), cl ); } \ emitterT void cod##bits##CLtoR( x86IntRegType to ) { x##cod( _reghlp<u##bits>(to), cl ); } \
emitterT void cod##bits##ItoR( x86IntRegType to, u8 imm ) { x##cod( _reghlp<u##bits>(to), imm ); } \ emitterT void cod##bits##ItoR( x86IntRegType to, u8 imm ) { x##cod( _reghlp<u##bits>(to), imm ); } \
@ -108,9 +108,9 @@ static __forceinline ModSibStrict<ImmType> _mhlp2( x86IntRegType src1, x86IntReg
emitterT void cod##bits##R( x86IntRegType to ) { x##cod( _reghlp<u##bits>(to) ); } \ emitterT void cod##bits##R( x86IntRegType to ) { x##cod( _reghlp<u##bits>(to) ); } \
emitterT void cod##bits##M( uptr to ) { x##cod( ptr##bits[to] ); } \ emitterT void cod##bits##M( uptr to ) { x##cod( ptr##bits[to] ); } \
emitterT void cod##bits##Rm( x86IntRegType to, uptr offset ) { x##cod( _mhlp<u##bits>(to) + offset ); } emitterT void cod##bits##Rm( x86IntRegType to, uptr offset ) { x##cod( _mhlp<u##bits>(to) + offset ); }
//emitterT void cod##bits##RtoRmS( x86IntRegType to1, x86IntRegType to2, x86IntRegType from, int offset ) \ //emitterT void cod##bits##RtoRmS( x86IntRegType to1, x86IntRegType to2, x86IntRegType from, int offset )
// { cod( _mhlp2<u##bits>(to1,to2) + offset, _reghlp<u##bits>(from) ); } \ // { cod( _mhlp2<u##bits>(to1,to2) + offset, _reghlp<u##bits>(from) ); }
#define DEFINE_OPCODE_LEGACY( cod ) \ #define DEFINE_OPCODE_LEGACY( cod ) \
DEFINE_LEGACY_HELPER( cod, 32 ) \ DEFINE_LEGACY_HELPER( cod, 32 ) \
@ -199,18 +199,18 @@ emitterT void MOV8RmSOffsettoR( x86IntRegType to, x86IntRegType from1, s32 from2
xMOV( xRegister8(to), ptr[(xAddressReg(from1)<<scale) + from2] ); xMOV( xRegister8(to), ptr[(xAddressReg(from1)<<scale) + from2] );
} }
emitterT void AND32I8toR( x86IntRegType to, s8 from ) emitterT void AND32I8toR( x86IntRegType to, s8 from )
{ {
xAND( _reghlp<u32>(to), from ); xAND( _reghlp<u32>(to), from );
} }
emitterT void AND32I8toM( uptr to, s8 from ) emitterT void AND32I8toM( uptr to, s8 from )
{ {
xAND( ptr8[to], from ); xAND( ptr8[to], from );
} }
/* cmove r32 to r32*/ /* cmove r32 to r32*/
emitterT void CMOVE32RtoR( x86IntRegType to, x86IntRegType from ) emitterT void CMOVE32RtoR( x86IntRegType to, x86IntRegType from )
{ {
xCMOVE( xRegister32(to), xRegister32(from) ); xCMOVE( xRegister32(to), xRegister32(from) );
} }
@ -237,7 +237,7 @@ emitterT void MUL32M( u32 from ) { xUMUL( ptr32[from] ); }
emitterT void IMUL32M( u32 from ) { xMUL( ptr32[from] ); } emitterT void IMUL32M( u32 from ) { xMUL( ptr32[from] ); }
/* imul r32 by r32 to r32 */ /* imul r32 by r32 to r32 */
emitterT void IMUL32RtoR( x86IntRegType to, x86IntRegType from ) emitterT void IMUL32RtoR( x86IntRegType to, x86IntRegType from )
{ {
xMUL( xRegister32(to), xRegister32(from) ); xMUL( xRegister32(to), xRegister32(from) );
} }
@ -258,7 +258,7 @@ emitterT void LEA32RtoR(x86IntRegType to, x86IntRegType from, s32 offset)
} }
emitterT void LEA32RRtoR(x86IntRegType to, x86IntRegType from0, x86IntRegType from1) emitterT void LEA32RRtoR(x86IntRegType to, x86IntRegType from0, x86IntRegType from1)
{ {
xLEA( xRegister32( to ), ptr[xAddressReg(from0)+xAddressReg(from1)] ); xLEA( xRegister32( to ), ptr[xAddressReg(from0)+xAddressReg(from1)] );
} }
@ -357,7 +357,7 @@ emitterT u32* J32Rel( int cc, u32 to )
} }
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
emitterT void x86SetPtr( u8* ptr ) emitterT void x86SetPtr( u8* ptr )
{ {
x86Ptr = ptr; x86Ptr = ptr;
} }
@ -401,7 +401,7 @@ void x86SetJ8A( u8* j8 )
} }
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
emitterT void x86SetJ32( u32* j32 ) emitterT void x86SetJ32( u32* j32 )
{ {
*j32 = ( x86Ptr - (u8*)j32 ) - 4; *j32 = ( x86Ptr - (u8*)j32 ) - 4;
} }
@ -413,7 +413,7 @@ emitterT void x86SetJ32A( u32* j32 )
} }
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
emitterT void x86Align( int bytes ) emitterT void x86Align( int bytes )
{ {
// forward align // forward align
x86Ptr = (u8*)( ( (uptr)x86Ptr + bytes - 1) & ~( bytes - 1 ) ); x86Ptr = (u8*)( ( (uptr)x86Ptr + bytes - 1) & ~( bytes - 1 ) );
@ -432,29 +432,29 @@ emitterT void NOP( void ) { xNOP(); }
//////////////////////////////////// ////////////////////////////////////
/* jmp rel8 */ /* jmp rel8 */
emitterT u8* JMP8( u8 to ) emitterT u8* JMP8( u8 to )
{ {
xWrite8( 0xEB ); xWrite8( 0xEB );
xWrite8( to ); xWrite8( to );
return x86Ptr - 1; return x86Ptr - 1;
} }
/* jmp rel32 */ /* jmp rel32 */
emitterT u32* JMP32( uptr to ) emitterT u32* JMP32( uptr to )
{ {
assert( (sptr)to <= 0x7fffffff && (sptr)to >= -0x7fffffff ); assert( (sptr)to <= 0x7fffffff && (sptr)to >= -0x7fffffff );
xWrite8( 0xE9 ); xWrite8( 0xE9 );
xWrite32( to ); xWrite32( to );
return (u32*)(x86Ptr - 4 ); return (u32*)(x86Ptr - 4 );
} }
/* jmp r32/r64 */ /* jmp r32/r64 */
emitterT void JMPR( x86IntRegType to ) emitterT void JMPR( x86IntRegType to )
{ {
xJMP( xRegister32(to) ); xJMP( xRegister32(to) );
} }
// jmp m32 // jmp m32
emitterT void JMP32M( uptr to ) emitterT void JMP32M( uptr to )
{ {
xJMP( ptr32[to] ); xJMP( ptr32[to] );
@ -476,247 +476,247 @@ emitterT u8* JE8( u8 to ) {
} }
/* jz rel8 */ /* jz rel8 */
emitterT u8* JZ8( u8 to ) emitterT u8* JZ8( u8 to )
{ {
return J8Rel( 0x74, to ); return J8Rel( 0x74, to );
} }
/* js rel8 */ /* js rel8 */
emitterT u8* JS8( u8 to ) emitterT u8* JS8( u8 to )
{ {
return J8Rel( 0x78, to ); return J8Rel( 0x78, to );
} }
/* jns rel8 */ /* jns rel8 */
emitterT u8* JNS8( u8 to ) emitterT u8* JNS8( u8 to )
{ {
return J8Rel( 0x79, to ); return J8Rel( 0x79, to );
} }
/* jg rel8 */ /* jg rel8 */
emitterT u8* JG8( u8 to ) emitterT u8* JG8( u8 to )
{ {
return J8Rel( 0x7F, to ); return J8Rel( 0x7F, to );
} }
/* jge rel8 */ /* jge rel8 */
emitterT u8* JGE8( u8 to ) emitterT u8* JGE8( u8 to )
{ {
return J8Rel( 0x7D, to ); return J8Rel( 0x7D, to );
} }
/* jl rel8 */ /* jl rel8 */
emitterT u8* JL8( u8 to ) emitterT u8* JL8( u8 to )
{ {
return J8Rel( 0x7C, to ); return J8Rel( 0x7C, to );
} }
/* ja rel8 */ /* ja rel8 */
emitterT u8* JA8( u8 to ) emitterT u8* JA8( u8 to )
{ {
return J8Rel( 0x77, to ); return J8Rel( 0x77, to );
} }
emitterT u8* JAE8( u8 to ) emitterT u8* JAE8( u8 to )
{ {
return J8Rel( 0x73, to ); return J8Rel( 0x73, to );
} }
/* jb rel8 */ /* jb rel8 */
emitterT u8* JB8( u8 to ) emitterT u8* JB8( u8 to )
{ {
return J8Rel( 0x72, to ); return J8Rel( 0x72, to );
} }
/* jbe rel8 */ /* jbe rel8 */
emitterT u8* JBE8( u8 to ) emitterT u8* JBE8( u8 to )
{ {
return J8Rel( 0x76, to ); return J8Rel( 0x76, to );
} }
/* jle rel8 */ /* jle rel8 */
emitterT u8* JLE8( u8 to ) emitterT u8* JLE8( u8 to )
{ {
return J8Rel( 0x7E, to ); return J8Rel( 0x7E, to );
} }
/* jne rel8 */ /* jne rel8 */
emitterT u8* JNE8( u8 to ) emitterT u8* JNE8( u8 to )
{ {
return J8Rel( 0x75, to ); return J8Rel( 0x75, to );
} }
/* jnz rel8 */ /* jnz rel8 */
emitterT u8* JNZ8( u8 to ) emitterT u8* JNZ8( u8 to )
{ {
return J8Rel( 0x75, to ); return J8Rel( 0x75, to );
} }
/* jng rel8 */ /* jng rel8 */
emitterT u8* JNG8( u8 to ) emitterT u8* JNG8( u8 to )
{ {
return J8Rel( 0x7E, to ); return J8Rel( 0x7E, to );
} }
/* jnge rel8 */ /* jnge rel8 */
emitterT u8* JNGE8( u8 to ) emitterT u8* JNGE8( u8 to )
{ {
return J8Rel( 0x7C, to ); return J8Rel( 0x7C, to );
} }
/* jnl rel8 */ /* jnl rel8 */
emitterT u8* JNL8( u8 to ) emitterT u8* JNL8( u8 to )
{ {
return J8Rel( 0x7D, to ); return J8Rel( 0x7D, to );
} }
/* jnle rel8 */ /* jnle rel8 */
emitterT u8* JNLE8( u8 to ) emitterT u8* JNLE8( u8 to )
{ {
return J8Rel( 0x7F, to ); return J8Rel( 0x7F, to );
} }
/* jo rel8 */ /* jo rel8 */
emitterT u8* JO8( u8 to ) emitterT u8* JO8( u8 to )
{ {
return J8Rel( 0x70, to ); return J8Rel( 0x70, to );
} }
/* jno rel8 */ /* jno rel8 */
emitterT u8* JNO8( u8 to ) emitterT u8* JNO8( u8 to )
{ {
return J8Rel( 0x71, to ); return J8Rel( 0x71, to );
} }
// jb rel32 // jb rel32
emitterT u32* JB32( u32 to ) emitterT u32* JB32( u32 to )
{ {
return J32Rel( 0x82, to ); return J32Rel( 0x82, to );
} }
/* je rel32 */ /* je rel32 */
emitterT u32* JE32( u32 to ) emitterT u32* JE32( u32 to )
{ {
return J32Rel( 0x84, to ); return J32Rel( 0x84, to );
} }
/* jz rel32 */ /* jz rel32 */
emitterT u32* JZ32( u32 to ) emitterT u32* JZ32( u32 to )
{ {
return J32Rel( 0x84, to ); return J32Rel( 0x84, to );
} }
/* js rel32 */ /* js rel32 */
emitterT u32* JS32( u32 to ) emitterT u32* JS32( u32 to )
{ {
return J32Rel( 0x88, to ); return J32Rel( 0x88, to );
} }
/* jns rel32 */ /* jns rel32 */
emitterT u32* JNS32( u32 to ) emitterT u32* JNS32( u32 to )
{ {
return J32Rel( 0x89, to ); return J32Rel( 0x89, to );
} }
/* jg rel32 */ /* jg rel32 */
emitterT u32* JG32( u32 to ) emitterT u32* JG32( u32 to )
{ {
return J32Rel( 0x8F, to ); return J32Rel( 0x8F, to );
} }
/* jge rel32 */ /* jge rel32 */
emitterT u32* JGE32( u32 to ) emitterT u32* JGE32( u32 to )
{ {
return J32Rel( 0x8D, to ); return J32Rel( 0x8D, to );
} }
/* jl rel32 */ /* jl rel32 */
emitterT u32* JL32( u32 to ) emitterT u32* JL32( u32 to )
{ {
return J32Rel( 0x8C, to ); return J32Rel( 0x8C, to );
} }
/* jle rel32 */ /* jle rel32 */
emitterT u32* JLE32( u32 to ) emitterT u32* JLE32( u32 to )
{ {
return J32Rel( 0x8E, to ); return J32Rel( 0x8E, to );
} }
/* ja rel32 */ /* ja rel32 */
emitterT u32* JA32( u32 to ) emitterT u32* JA32( u32 to )
{ {
return J32Rel( 0x87, to ); return J32Rel( 0x87, to );
} }
/* jae rel32 */ /* jae rel32 */
emitterT u32* JAE32( u32 to ) emitterT u32* JAE32( u32 to )
{ {
return J32Rel( 0x83, to ); return J32Rel( 0x83, to );
} }
/* jne rel32 */ /* jne rel32 */
emitterT u32* JNE32( u32 to ) emitterT u32* JNE32( u32 to )
{ {
return J32Rel( 0x85, to ); return J32Rel( 0x85, to );
} }
/* jnz rel32 */ /* jnz rel32 */
emitterT u32* JNZ32( u32 to ) emitterT u32* JNZ32( u32 to )
{ {
return J32Rel( 0x85, to ); return J32Rel( 0x85, to );
} }
/* jng rel32 */ /* jng rel32 */
emitterT u32* JNG32( u32 to ) emitterT u32* JNG32( u32 to )
{ {
return J32Rel( 0x8E, to ); return J32Rel( 0x8E, to );
} }
/* jnge rel32 */ /* jnge rel32 */
emitterT u32* JNGE32( u32 to ) emitterT u32* JNGE32( u32 to )
{ {
return J32Rel( 0x8C, to ); return J32Rel( 0x8C, to );
} }
/* jnl rel32 */ /* jnl rel32 */
emitterT u32* JNL32( u32 to ) emitterT u32* JNL32( u32 to )
{ {
return J32Rel( 0x8D, to ); return J32Rel( 0x8D, to );
} }
/* jnle rel32 */ /* jnle rel32 */
emitterT u32* JNLE32( u32 to ) emitterT u32* JNLE32( u32 to )
{ {
return J32Rel( 0x8F, to ); return J32Rel( 0x8F, to );
} }
/* jo rel32 */ /* jo rel32 */
emitterT u32* JO32( u32 to ) emitterT u32* JO32( u32 to )
{ {
return J32Rel( 0x80, to ); return J32Rel( 0x80, to );
} }
/* jno rel32 */ /* jno rel32 */
emitterT u32* JNO32( u32 to ) emitterT u32* JNO32( u32 to )
{ {
return J32Rel( 0x81, to ); return J32Rel( 0x81, to );
} }
/* call func */ /* call func */
emitterT void CALLFunc( uptr func ) emitterT void CALLFunc( uptr func )
{ {
xCALL( (void*)func ); xCALL( (void*)func );
} }
/* call r32 */ /* call r32 */
emitterT void CALL32R( x86IntRegType to ) emitterT void CALL32R( x86IntRegType to )
{ {
xCALL( xRegister32( to ) ); xCALL( xRegister32( to ) );
} }
/* call m32 */ /* call m32 */
emitterT void CALL32M( u32 to ) emitterT void CALL32M( u32 to )
{ {
xCALL( ptr32[to] ); xCALL( ptr32[to] );
} }
@ -726,7 +726,7 @@ emitterT void BSRRtoR(x86IntRegType to, x86IntRegType from)
xBSR( xRegister32(to), xRegister32(from) ); xBSR( xRegister32(to), xRegister32(from) );
} }
emitterT void BSWAP32R( x86IntRegType to ) emitterT void BSWAP32R( x86IntRegType to )
{ {
xBSWAP( xRegister32(to) ); xBSWAP( xRegister32(to) );
} }

View File

@ -5,12 +5,12 @@
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@ -74,17 +74,17 @@ __forceinline void xWrite8( u8 val )
} }
__forceinline void xWrite16( u16 val ) __forceinline void xWrite16( u16 val )
{ {
xWrite( val ); xWrite( val );
} }
__forceinline void xWrite32( u32 val ) __forceinline void xWrite32( u32 val )
{ {
xWrite( val ); xWrite( val );
} }
__forceinline void xWrite64( u64 val ) __forceinline void xWrite64( u64 val )
{ {
xWrite( val ); xWrite( val );
} }
@ -93,7 +93,7 @@ const xAddressIndexer<u128> ptr128;
const xAddressIndexer<u64> ptr64; const xAddressIndexer<u64> ptr64;
const xAddressIndexer<u32> ptr32; const xAddressIndexer<u32> ptr32;
const xAddressIndexer<u16> ptr16; const xAddressIndexer<u16> ptr16;
const xAddressIndexer<u8> ptr8; const xAddressIndexer<u8> ptr8;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
@ -130,7 +130,7 @@ const xRegister8
dl( 2 ), bl( 3 ), dl( 2 ), bl( 3 ),
ah( 4 ), ch( 5 ), ah( 4 ), ch( 5 ),
dh( 6 ), bh( 7 ); dh( 6 ), bh( 7 );
const xRegisterCL cl; const xRegisterCL cl;
const char *const x86_regnames_gpr8[8] = const char *const x86_regnames_gpr8[8] =
@ -174,9 +174,9 @@ namespace Internal
if( src.IsEmpty() ) return "empty"; if( src.IsEmpty() ) return "empty";
switch( sizeof(T) ) switch( sizeof(T) )
{ {
case 1: return tbl_regnames_gpr8[ src.Id ]; case 1: return x86_regnames_gpr8[ src.Id ];
case 2: return tbl_regnames_gpr16[ src.Id ]; case 2: return x86_regnames_gpr16[ src.Id ];
case 4: return tbl_regnames_gpr32[ src.Id ]; case 4: return x86_regnames_gpr32[ src.Id ];
} }
} }
@ -196,7 +196,7 @@ namespace Internal
// brand P4s with a broken barrel shifter?). The workaround is to do our own manual // brand P4s with a broken barrel shifter?). The workaround is to do our own manual
// x86Ptr access and update using a u32 instead of u8. Thanks to little endianness, // x86Ptr access and update using a u32 instead of u8. Thanks to little endianness,
// the same end result is achieved and no false dependencies are generated. The draw- // the same end result is achieved and no false dependencies are generated. The draw-
// back is that it clobbers 3 bytes past the end of the write, which could cause a // back is that it clobbers 3 bytes past the end of the write, which could cause a
// headache for someone who himself is doing some kind of headache-inducing amount of // headache for someone who himself is doing some kind of headache-inducing amount of
// recompiler SMC. So we don't do a work-around, and just hope for the compiler to // recompiler SMC. So we don't do a work-around, and just hope for the compiler to
// stop sucking someday instead. :) // stop sucking someday instead. :)
@ -277,7 +277,7 @@ namespace Internal
{ {
jASSUME( regfield < 8 ); jASSUME( regfield < 8 );
int displacement_size = (info.Displacement == 0) ? 0 : int displacement_size = (info.Displacement == 0) ? 0 :
( ( info.IsByteSizeDisp() ) ? 1 : 2 ); ( ( info.IsByteSizeDisp() ) ? 1 : 2 );
if( !NeedsSibMagic( info ) ) if( !NeedsSibMagic( info ) )
@ -444,7 +444,7 @@ const SetImplAll<Jcc_ParityOdd> xSETPO;
// Assigns the current emitter buffer target address. // Assigns the current emitter buffer target address.
// This is provided instead of using x86Ptr directly, since we may in the future find // This is provided instead of using x86Ptr directly, since we may in the future find
// a need to change the storage class system for the x86Ptr 'under the hood.' // a need to change the storage class system for the x86Ptr 'under the hood.'
__emitinline void xSetPtr( void* ptr ) __emitinline void xSetPtr( void* ptr )
{ {
x86Ptr = (u8*)ptr; x86Ptr = (u8*)ptr;
} }
@ -459,7 +459,7 @@ __emitinline u8* xGetPtr()
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
__emitinline void xAlignPtr( uint bytes ) __emitinline void xAlignPtr( uint bytes )
{ {
// forward align // forward align
x86Ptr = (u8*)( ( (uptr)x86Ptr + bytes - 1) & ~(bytes - 1) ); x86Ptr = (u8*)( ( (uptr)x86Ptr + bytes - 1) & ~(bytes - 1) );
@ -483,13 +483,13 @@ __emitinline void xAdvancePtr( uint bytes )
// Necessary because by default ModSib compounds registers into Index when possible. // Necessary because by default ModSib compounds registers into Index when possible.
// //
// If the ModSib is in illegal form ([Base + Index*5] for example) then an assertion // If the ModSib is in illegal form ([Base + Index*5] for example) then an assertion
// followed by an InvalidParameter Exception will be tossed around in haphazard // followed by an InvalidParameter Exception will be tossed around in haphazard
// fashion. // fashion.
// //
// Optimization Note: Currently VC does a piss poor job of inlining this, even though // Optimization Note: Currently VC does a piss poor job of inlining this, even though
// constant propagation *should* resove it to little or no code (VC's constprop fails // constant propagation *should* resove it to little or no code (VC's constprop fails
// on C++ class initializers). There is a work around [using array initializers instead] // on C++ class initializers). There is a work around [using array initializers instead]
// but it's too much trouble for code that isn't performance critical anyway. // but it's too much trouble for code that isn't performance critical anyway.
// And, with luck, maybe VC10 will optimize it better and make it a non-issue. :D // And, with luck, maybe VC10 will optimize it better and make it a non-issue. :D
// //
void ModSibBase::Reduce() void ModSibBase::Reduce()
@ -518,7 +518,7 @@ void ModSibBase::Reduce()
} }
// The Scale has a series of valid forms, all shown here: // The Scale has a series of valid forms, all shown here:
switch( Scale ) switch( Scale )
{ {
case 0: break; case 0: break;
@ -530,7 +530,7 @@ void ModSibBase::Reduce()
Base = Index; Base = Index;
Scale = 1; Scale = 1;
break; break;
case 4: Scale = 2; break; case 4: Scale = 2; break;
case 5: // becomes [reg*4+reg] case 5: // becomes [reg*4+reg]
@ -538,15 +538,15 @@ void ModSibBase::Reduce()
Base = Index; Base = Index;
Scale = 2; Scale = 2;
break; break;
case 6: // invalid! case 6: // invalid!
assert( false ); assert( false );
break; break;
case 7: // so invalid! case 7: // so invalid!
assert( false ); assert( false );
break; break;
case 8: Scale = 3; break; case 8: Scale = 3; break;
case 9: // becomes [reg*8+reg] case 9: // becomes [reg*8+reg]
jASSUME( Base.IsEmpty() ); jASSUME( Base.IsEmpty() );
@ -569,8 +569,8 @@ template< typename OperandType >
static void EmitLeaMagic( xRegister<OperandType> to, const ModSibBase& src, bool preserve_flags ) static void EmitLeaMagic( xRegister<OperandType> to, const ModSibBase& src, bool preserve_flags )
{ {
typedef xRegister<OperandType> ToReg; typedef xRegister<OperandType> ToReg;
int displacement_size = (src.Displacement == 0) ? 0 : int displacement_size = (src.Displacement == 0) ? 0 :
( ( src.IsByteSizeDisp() ) ? 1 : 2 ); ( ( src.IsByteSizeDisp() ) ? 1 : 2 );
// See EmitSibMagic for commenting on SIB encoding. // See EmitSibMagic for commenting on SIB encoding.
@ -597,7 +597,7 @@ static void EmitLeaMagic( xRegister<OperandType> to, const ModSibBase& src, bool
{ {
// encode as MOV and ADD combo. Make sure to use the immediate on the // encode as MOV and ADD combo. Make sure to use the immediate on the
// ADD since it can encode as an 8-bit sign-extended value. // ADD since it can encode as an 8-bit sign-extended value.
xMOV( to, ToReg( src.Index.Id ) ); xMOV( to, ToReg( src.Index.Id ) );
xADD( to, src.Displacement ); xADD( to, src.Displacement );
return; return;
@ -659,7 +659,7 @@ static void EmitLeaMagic( xRegister<OperandType> to, const ModSibBase& src, bool
{ {
// special case handling of ESP as Index, which is replaceable with // special case handling of ESP as Index, which is replaceable with
// a single MOV even when preserve_flags is set! :D // a single MOV even when preserve_flags is set! :D
xMOV( to, ToReg( src.Base.Id ) ); xMOV( to, ToReg( src.Base.Id ) );
return; return;
} }

View File

@ -1,22 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file> <CodeBlocks_workspace_file>
<Workspace title="pcsx2_suite_2008 workspace"> <Workspace title="pcsx2_suite_2008 workspace">
<Project filename="../../plugins/zerogs/dx/Windows/zerogs_2008.cbp" />
<Project filename="../../plugins/CDVDiso/src/Windows/CDVDiso_vs2008.cbp" />
<Project filename="../../plugins/spu2-x/src/Windows/Spu2-X_vs2008.cbp" />
<Project filename="../../3rdparty/SoundTouch/SoundTouch.cbp" />
<Project filename="../../3rdparty/zlib/zlib.cbp" />
<Project filename="../../3rdparty/bzip2/bzip2.cbp" />
<Project filename="../../plugins/LilyPad/LilyPad_VC2008.cbp" />
<Project filename="../../plugins/zerospu2/Windows/ZeroSPU2_2008.cbp" />
<Project filename="../../plugins/xpad/xpad_vs2008.cbp" />
<Project filename="../../plugins/CDVDnull/Src/CDVDnull_vs2008.cbp" />
<Project filename="../../plugins/USBnull/Windows/USBnull_vc2008.cbp" />
<Project filename="../../plugins/FWnull/Windows/FWnull_vc2008.cbp" />
<Project filename="../../plugins/dev9null/src/DEV9null_vc2008.cbp" />
<Project filename="../../plugins/zeropad/Windows/ZeroPAD_2008.cbp" />
<Project filename="pcsx2.cbp" active="1"> <Project filename="pcsx2.cbp" active="1">
<Depends filename="../../3rdparty/zlib/zlib.cbp" /> <Depends filename="../../3rdparty/zlib/zlib.cbp" />
</Project> </Project>
<Project filename="../../common/build/Utilities/Utilities.cbp" />
<Project filename="../../common/build/x86emitter/x86emitter.cbp" />
<Project filename="../../3rdparty/SoundTouch/SoundTouch.cbp" />
<Project filename="../../3rdparty/zlib/zlib.cbp" />
<Project filename="../../3rdparty/bzip2/bzip2.cbp" />
</Workspace> </Workspace>
</CodeBlocks_workspace_file> </CodeBlocks_workspace_file>

View File

@ -28,7 +28,9 @@
</ResourceCompiler> </ResourceCompiler>
<Linker> <Linker>
<Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=yes --libs`" /> <Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=yes --libs`" />
<Add library="$(SvnRootDir)/deps/debug/zlib-dbg.a" /> <Add library="$(SvnRootDir)/deps/debug/zlib.a" />
<Add library="$(SvnRootDir)/deps/debug/libx86emitter.a" />
<Add library="$(SvnRootDir)/deps/debug/libUtilities.a" />
</Linker> </Linker>
</Target> </Target>
<Target title="Devel"> <Target title="Devel">
@ -53,7 +55,9 @@
</ResourceCompiler> </ResourceCompiler>
<Linker> <Linker>
<Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=yes --libs`" /> <Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=yes --libs`" />
<Add library="$(SvnRootDir)/deps/devel/zlib-dev.a" /> <Add library="$(SvnRootDir)/deps/devel/zlib.a" />
<Add library="$(SvnRootDir)/deps/devel/libx86emitter.a" />
<Add library="$(SvnRootDir)/deps/devel/libUtilities.a" />
</Linker> </Linker>
</Target> </Target>
<Target title="Release"> <Target title="Release">
@ -77,7 +81,9 @@
<Linker> <Linker>
<Add option="-s" /> <Add option="-s" />
<Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=no --libs`" /> <Add option="`wx-config --version=2.8 --static=no --unicode=yes --debug=no --libs`" />
<Add library="$(SvnRootDir)/deps/zlib.a" /> <Add library="$(SvnRootDir)/deps/release/zlib.a" />
<Add library="$(SvnRootDir)/deps/release/libx86emitter.a" />
<Add library="$(SvnRootDir)/deps/release/libUtilities.a" />
</Linker> </Linker>
</Target> </Target>
<Environment> <Environment>
@ -102,22 +108,16 @@
<Unit filename="../../common/include/Pcsx2Config.h" /> <Unit filename="../../common/include/Pcsx2Config.h" />
<Unit filename="../../common/include/Pcsx2Defs.h" /> <Unit filename="../../common/include/Pcsx2Defs.h" />
<Unit filename="../../common/include/Pcsx2Types.h" /> <Unit filename="../../common/include/Pcsx2Types.h" />
<Unit filename="../AlignedMalloc.cpp" />
<Unit filename="../CDVD.cpp" />
<Unit filename="../CDVD.h" /> <Unit filename="../CDVD.h" />
<Unit filename="../CDVDiso.cpp" />
<Unit filename="../CDVDiso.h" /> <Unit filename="../CDVDiso.h" />
<Unit filename="../CDVDisodrv.cpp" />
<Unit filename="../CDVDisodrv.h" /> <Unit filename="../CDVDisodrv.h" />
<Unit filename="../COP0.cpp" /> <Unit filename="../COP0.cpp" />
<Unit filename="../COP2.cpp" /> <Unit filename="../COP2.cpp" />
<Unit filename="../Cache.cpp" /> <Unit filename="../Cache.cpp" />
<Unit filename="../Cache.h" /> <Unit filename="../Cache.h" />
<Unit filename="../CdRom.cpp" />
<Unit filename="../CdRom.h" /> <Unit filename="../CdRom.h" />
<Unit filename="../Common.h" /> <Unit filename="../Common.h" />
<Unit filename="../Config.h" /> <Unit filename="../Config.h" />
<Unit filename="../Console.cpp" />
<Unit filename="../Counters.cpp" /> <Unit filename="../Counters.cpp" />
<Unit filename="../Counters.h" /> <Unit filename="../Counters.h" />
<Unit filename="../DebugTools/Debug.h" /> <Unit filename="../DebugTools/Debug.h" />
@ -182,8 +182,6 @@
<Unit filename="../IopSio2.cpp" /> <Unit filename="../IopSio2.cpp" />
<Unit filename="../IopSio2.h" /> <Unit filename="../IopSio2.h" />
<Unit filename="../Linux/HostGui.cpp" /> <Unit filename="../Linux/HostGui.cpp" />
<Unit filename="../Linux/LnxMisc.cpp" />
<Unit filename="../Linux/LnxThreads.cpp" />
<Unit filename="../Linux/memzero.h" /> <Unit filename="../Linux/memzero.h" />
<Unit filename="../MMI.cpp" /> <Unit filename="../MMI.cpp" />
<Unit filename="../MTGS.cpp" /> <Unit filename="../MTGS.cpp" />
@ -257,11 +255,9 @@
<Unit filename="../SourceLog.cpp" /> <Unit filename="../SourceLog.cpp" />
<Unit filename="../Stats.cpp" /> <Unit filename="../Stats.cpp" />
<Unit filename="../Stats.h" /> <Unit filename="../Stats.h" />
<Unit filename="../StringUtils.cpp" />
<Unit filename="../StringUtils.h" /> <Unit filename="../StringUtils.h" />
<Unit filename="../System.cpp" /> <Unit filename="../System.cpp" />
<Unit filename="../System.h" /> <Unit filename="../System.h" />
<Unit filename="../ThreadTools.cpp" />
<Unit filename="../Threading.h" /> <Unit filename="../Threading.h" />
<Unit filename="../Utilities/AsciiFile.h" /> <Unit filename="../Utilities/AsciiFile.h" />
<Unit filename="../Utilities/FileUtils.cpp" /> <Unit filename="../Utilities/FileUtils.cpp" />
@ -283,42 +279,24 @@
<Unit filename="../VifDma.cpp" /> <Unit filename="../VifDma.cpp" />
<Unit filename="../VifDma.h" /> <Unit filename="../VifDma.h" />
<Unit filename="../pcsxAbout.bmp" /> <Unit filename="../pcsxAbout.bmp" />
<Unit filename="../rdebug/deci2.cpp">
<Option target="&lt;{~None~}&gt;" />
</Unit>
<Unit filename="../rdebug/deci2.h"> <Unit filename="../rdebug/deci2.h">
<Option target="&lt;{~None~}&gt;" /> <Option target="&lt;{~None~}&gt;" />
</Unit> </Unit>
<Unit filename="../rdebug/deci2_dbgp.cpp">
<Option target="&lt;{~None~}&gt;" />
</Unit>
<Unit filename="../rdebug/deci2_dbgp.h"> <Unit filename="../rdebug/deci2_dbgp.h">
<Option target="&lt;{~None~}&gt;" /> <Option target="&lt;{~None~}&gt;" />
</Unit> </Unit>
<Unit filename="../rdebug/deci2_dcmp.cpp">
<Option target="&lt;{~None~}&gt;" />
</Unit>
<Unit filename="../rdebug/deci2_dcmp.h"> <Unit filename="../rdebug/deci2_dcmp.h">
<Option target="&lt;{~None~}&gt;" /> <Option target="&lt;{~None~}&gt;" />
</Unit> </Unit>
<Unit filename="../rdebug/deci2_drfp.h"> <Unit filename="../rdebug/deci2_drfp.h">
<Option target="&lt;{~None~}&gt;" /> <Option target="&lt;{~None~}&gt;" />
</Unit> </Unit>
<Unit filename="../rdebug/deci2_iloadp.cpp">
<Option target="&lt;{~None~}&gt;" />
</Unit>
<Unit filename="../rdebug/deci2_iloadp.h"> <Unit filename="../rdebug/deci2_iloadp.h">
<Option target="&lt;{~None~}&gt;" /> <Option target="&lt;{~None~}&gt;" />
</Unit> </Unit>
<Unit filename="../rdebug/deci2_netmp.cpp">
<Option target="&lt;{~None~}&gt;" />
</Unit>
<Unit filename="../rdebug/deci2_netmp.h"> <Unit filename="../rdebug/deci2_netmp.h">
<Option target="&lt;{~None~}&gt;" /> <Option target="&lt;{~None~}&gt;" />
</Unit> </Unit>
<Unit filename="../rdebug/deci2_ttyp.cpp">
<Option target="&lt;{~None~}&gt;" />
</Unit>
<Unit filename="../rdebug/deci2_ttyp.h"> <Unit filename="../rdebug/deci2_ttyp.h">
<Option target="&lt;{~None~}&gt;" /> <Option target="&lt;{~None~}&gt;" />
</Unit> </Unit>
@ -328,18 +306,13 @@
<Unit filename="../tinyxml/tinyxml.h" /> <Unit filename="../tinyxml/tinyxml.h" />
<Unit filename="../tinyxml/tinyxmlerror.cpp" /> <Unit filename="../tinyxml/tinyxmlerror.cpp" />
<Unit filename="../tinyxml/tinyxmlparser.cpp" /> <Unit filename="../tinyxml/tinyxmlparser.cpp" />
<Unit filename="../vssprintf.cpp" />
<Unit filename="../vtlb.cpp" /> <Unit filename="../vtlb.cpp" />
<Unit filename="../vtlb.h" /> <Unit filename="../vtlb.h" />
<Unit filename="../x86/BaseblockEx.cpp" /> <Unit filename="../x86/BaseblockEx.cpp" />
<Unit filename="../x86/BaseblockEx.h" /> <Unit filename="../x86/BaseblockEx.h" />
<Unit filename="../x86/aMicroVU.S">
<Option target="&lt;{~None~}&gt;" />
</Unit>
<Unit filename="../x86/aR3000A.S" /> <Unit filename="../x86/aR3000A.S" />
<Unit filename="../x86/aVUzerorec.S" /> <Unit filename="../x86/aVUzerorec.S" />
<Unit filename="../x86/aVif.S" /> <Unit filename="../x86/aVif.S" />
<Unit filename="../x86/fast_routines.S" />
<Unit filename="../x86/iCOP0.cpp" /> <Unit filename="../x86/iCOP0.cpp" />
<Unit filename="../x86/iCOP0.h" /> <Unit filename="../x86/iCOP0.h" />
<Unit filename="../x86/iCOP2.cpp" /> <Unit filename="../x86/iCOP2.cpp" />
@ -401,23 +374,14 @@
<Unit filename="../x86/ix86/implement/xmm/comparisons.h" /> <Unit filename="../x86/ix86/implement/xmm/comparisons.h" />
<Unit filename="../x86/ix86/implement/xmm/moremovs.h" /> <Unit filename="../x86/ix86/implement/xmm/moremovs.h" />
<Unit filename="../x86/ix86/implement/xmm/shufflepack.h" /> <Unit filename="../x86/ix86/implement/xmm/shufflepack.h" />
<Unit filename="../x86/ix86/ix86.cpp" />
<Unit filename="../x86/ix86/ix86.h" /> <Unit filename="../x86/ix86/ix86.h" />
<Unit filename="../x86/ix86/ix86_3dnow.cpp" />
<Unit filename="../x86/ix86/ix86_cpudetect.cpp" />
<Unit filename="../x86/ix86/ix86_fpu.cpp" />
<Unit filename="../x86/ix86/ix86_inlines.inl" /> <Unit filename="../x86/ix86/ix86_inlines.inl" />
<Unit filename="../x86/ix86/ix86_instructions.h" /> <Unit filename="../x86/ix86/ix86_instructions.h" />
<Unit filename="../x86/ix86/ix86_internal.h" /> <Unit filename="../x86/ix86/ix86_internal.h" />
<Unit filename="../x86/ix86/ix86_jmp.cpp" />
<Unit filename="../x86/ix86/ix86_legacy.cpp" />
<Unit filename="../x86/ix86/ix86_legacy_instructions.h" /> <Unit filename="../x86/ix86/ix86_legacy_instructions.h" />
<Unit filename="../x86/ix86/ix86_legacy_internal.h" /> <Unit filename="../x86/ix86/ix86_legacy_internal.h" />
<Unit filename="../x86/ix86/ix86_legacy_sse.cpp" />
<Unit filename="../x86/ix86/ix86_legacy_types.h" /> <Unit filename="../x86/ix86/ix86_legacy_types.h" />
<Unit filename="../x86/ix86/ix86_simd.cpp" />
<Unit filename="../x86/ix86/ix86_sse_helpers.h" /> <Unit filename="../x86/ix86/ix86_sse_helpers.h" />
<Unit filename="../x86/ix86/ix86_tools.cpp" />
<Unit filename="../x86/ix86/ix86_types.h" /> <Unit filename="../x86/ix86/ix86_types.h" />
<Unit filename="../x86/ix86/ix86_writers.inl" /> <Unit filename="../x86/ix86/ix86_writers.inl" />
<Unit filename="../x86/microVU.cpp" /> <Unit filename="../x86/microVU.cpp" />

View File

@ -5,12 +5,12 @@
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
@ -68,7 +68,7 @@ void __fastcall iopHwWrite8_Page1( u32 addr, mem8_t val )
u32 masked_addr = pgmsk( addr ); u32 masked_addr = pgmsk( addr );
switch( masked_addr ) switch( masked_addr )
{ {
mcase(HW_SIO_DATA): sioWrite8( val ); break; mcase(HW_SIO_DATA): sioWrite8( val ); break;
// for use of serial port ignore for now // for use of serial port ignore for now
@ -116,8 +116,6 @@ void __fastcall iopHwWrite8_Page3( u32 addr, mem8_t val )
if( addr == 0x1f80380c ) // STDOUT if( addr == 0x1f80380c ) // STDOUT
{ {
bool flush = false;
// Terminate lines on CR or full buffers, and ignore \n's if the string contents // Terminate lines on CR or full buffers, and ignore \n's if the string contents
// are empty (otherwise terminate on \n too!) // are empty (otherwise terminate on \n too!)
if( ( val == '\r' ) || ( g_pbufi == 1023 ) || if( ( val == '\r' ) || ( g_pbufi == 1023 ) ||
@ -148,7 +146,7 @@ void __fastcall iopHwWrite8_Page8( u32 addr, mem8_t val )
psxHu8( addr ) = val; psxHu8( addr ) = val;
PSXHW_LOG( "HwWrite8 to %s, addr 0x%08x = 0x%02x", _log_GetIopHwName<mem8_t>(addr), addr, psxHu8(addr) ); PSXHW_LOG( "HwWrite8 to %s, addr 0x%08x = 0x%02x", _log_GetIopHwName<mem8_t>(addr), addr, psxHu8(addr) );
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
@ -187,7 +185,7 @@ static __forceinline void _HwWrite_16or32_Page1( u32 addr, T val )
case 0x8: case 0x8:
psxRcntWtarget16( cntidx, val ); psxRcntWtarget16( cntidx, val );
break; break;
default: default:
psxHu(addr) = val; psxHu(addr) = val;
break; break;
@ -332,14 +330,14 @@ static __forceinline void _HwWrite_16or32_Page1( u32 addr, T val )
SPU2WriteMemAddr( 1, val ); SPU2WriteMemAddr( 1, val );
HW_DMA7_MADR = val; HW_DMA7_MADR = val;
break; break;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// //
/* /*
mcase(0x1f801088): // DMA0 CHCR -- MDEC IN [ignored] mcase(0x1f801088): // DMA0 CHCR -- MDEC IN [ignored]
DmaExec(0); DmaExec(0);
break; break;
mcase(0x1f801098): // DMA1 CHCR -- MDEC OUT [ignored] mcase(0x1f801098): // DMA1 CHCR -- MDEC OUT [ignored]
DmaExec(1); DmaExec(1);
break; break;
@ -395,7 +393,7 @@ static __forceinline void _HwWrite_16or32_Page1( u32 addr, T val )
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// DMA ICR handlers -- General XOR behavior! // DMA ICR handlers -- General XOR behavior!
mcase(0x1f8010f4): mcase(0x1f8010f4):
{ {
u32 tmp = (~val) & HW_DMA_ICR; u32 tmp = (~val) & HW_DMA_ICR;
@ -417,7 +415,7 @@ static __forceinline void _HwWrite_16or32_Page1( u32 addr, T val )
psxHu(addr) = ((tmp ^ val) & 0xffffff) ^ tmp; psxHu(addr) = ((tmp ^ val) & 0xffffff) ^ tmp;
} }
break; break;
mcase(0x1f801576): // ICR2_hi (16 bit?) [dunno if it ever happens] mcase(0x1f801576): // ICR2_hi (16 bit?) [dunno if it ever happens]
{ {
const u32 val2 = (u32)val << 16; const u32 val2 = (u32)val << 16;
@ -454,7 +452,7 @@ static __forceinline void _HwWrite_16or32_Page1( u32 addr, T val )
break; break;
} }
} }
PSXHW_LOG( "HwWrite%s to %s, addr 0x%08x = 0x%04x", PSXHW_LOG( "HwWrite%s to %s, addr 0x%08x = 0x%04x",
sizeof(T) == 2 ? "16" : "32", _log_GetIopHwName<T>( addr ), addr, val sizeof(T) == 2 ? "16" : "32", _log_GetIopHwName<T>( addr ), addr, val
); );
@ -517,7 +515,7 @@ void __fastcall iopHwWrite32_Page8( u32 addr, mem32_t val )
{ {
// SIO2 Send commands alternate registers. First reg maps to Send1, second // SIO2 Send commands alternate registers. First reg maps to Send1, second
// to Send2, third to Send1, etc. And the following clever code does this: // to Send2, third to Send1, etc. And the following clever code does this:
const int parm = (masked_addr-0x240) / 8; const int parm = (masked_addr-0x240) / 8;
if(masked_addr & 4) sio2_setSend2( parm, val ); else sio2_setSend1( parm, val ); if(masked_addr & 4) sio2_setSend2( parm, val ); else sio2_setSend1( parm, val );
} }
@ -533,7 +531,7 @@ void __fastcall iopHwWrite32_Page8( u32 addr, mem32_t val )
// Other SIO2 registers are read-only, no-ops on write. // Other SIO2 registers are read-only, no-ops on write.
default: default:
psxHu32(addr) = val; psxHu32(addr) = val;
break; break;
} }
} }
else if( masked_addr >= pgmsk(HW_FW_START) && masked_addr <= pgmsk(HW_FW_END) ) else if( masked_addr >= pgmsk(HW_FW_START) && masked_addr <= pgmsk(HW_FW_END) )