From 53ee26711ef33bf2b51bddb040421866dfc79bc3 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Fri, 1 Aug 2008 08:37:19 +0000 Subject: [PATCH] More linux work. Getting a bit closer, but JIT does still not work. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@119 8ced0084-cf51-0410-be5f-012b33b47a6e --- SConstruct | 7 ++++--- Source/Core/Common/Src/ABI.cpp | 3 ++- Source/Core/Common/Src/ABI.h | 5 ++--- Source/Core/Common/Src/Common.cpp | 1 + Source/Core/Common/Src/MemArena.cpp | 1 - Source/Core/Common/Src/MemoryUtil.cpp | 6 +++++- Source/Core/Core/Src/Boot/Boot.h | 2 -- Source/Core/Core/Src/HW/Memmap.cpp | 9 +++++---- Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp | 5 +++++ Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp | 9 +++++---- .../Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp | 20 +++++++++++-------- 11 files changed, 41 insertions(+), 27 deletions(-) diff --git a/SConstruct b/SConstruct index 54c8cd7721..63d36a1d26 100644 --- a/SConstruct +++ b/SConstruct @@ -1,11 +1,12 @@ import os import sys -warnings = ' -Wall -Wwrite-strings -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-qual -Wpacked' +warnings = ' -Wall -Wwrite-strings -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-qual -Wpacked -Wno-conversion' nonactive_warnings = '-Wunreachable-code' -ccflags = '-g -O3 -fno-strict-aliasing -fPIC -msse2 -DLOGGING -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' + warnings +ccflags = '-g -O3 -fno-strict-aliasing -fPIC -msse2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE' + warnings +#ccflags += ' -DLOGGING' if sys.platform == 'darwin': ccflags += ' -I/opt/local/include' @@ -47,7 +48,7 @@ else: "Source/Core/VideoCommon/Src", "Source/Plugins/Plugin_VideoOGL/Src", "Source/Plugins/Plugin_DSP_NULL/Src", - "Source/Plugins/Plugin_DSP_LLE/Src", +# "Source/Plugins/Plugin_DSP_LLE/Src", "Source/Plugins/Plugin_PadSimple/Src", "Source/Plugins/Plugin_nJoy_SDL/Src", "Source/Core/DolphinWX/src", diff --git a/Source/Core/Common/Src/ABI.cpp b/Source/Core/Common/Src/ABI.cpp index 78162f61f9..e45b93fbe2 100644 --- a/Source/Core/Common/Src/ABI.cpp +++ b/Source/Core/Common/Src/ABI.cpp @@ -134,4 +134,5 @@ void ABI_PopAllCalleeSavedRegsAndAdjustStack() { #endif -#endif \ No newline at end of file +#endif + diff --git a/Source/Core/Common/Src/ABI.h b/Source/Core/Common/Src/ABI.h index 5bfcae59e1..3386913834 100644 --- a/Source/Core/Common/Src/ABI.h +++ b/Source/Core/Common/Src/ABI.h @@ -52,7 +52,6 @@ // === 32-bit bog standard cdecl, shared between linux and windows ============================ // MacOSX 32-bit is same as System V with a few exceptions that we probably don't care much about. - #else // 64 bit calling convention @@ -63,7 +62,6 @@ #define ABI_PARAM2 RDX #define ABI_PARAM3 R8 #define ABI_PARAM4 R9 - #else // === 64-bit Unix (hopefully MacOSX too) ===================================================== @@ -91,4 +89,5 @@ void ABI_CallFunctionR(void *func, Gen::X64Reg reg1); void ABI_PushAllCalleeSavedRegsAndAdjustStack(); void ABI_PopAllCalleeSavedRegsAndAdjustStack(); -#endif // _JIT_ABI_H \ No newline at end of file +#endif // _JIT_ABI_H + diff --git a/Source/Core/Common/Src/Common.cpp b/Source/Core/Common/Src/Common.cpp index 3b562a717c..0cce42c703 100644 --- a/Source/Core/Common/Src/Common.cpp +++ b/Source/Core/Common/Src/Common.cpp @@ -52,6 +52,7 @@ void PanicAlert(const char* format, ...) //#error Do a messagebox! vprintf(format, args); printf("\n"); + asm ("int $3") ; #endif } diff --git a/Source/Core/Common/Src/MemArena.cpp b/Source/Core/Common/Src/MemArena.cpp index 11a87d524c..6753ebb851 100644 --- a/Source/Core/Common/Src/MemArena.cpp +++ b/Source/Core/Common/Src/MemArena.cpp @@ -40,7 +40,6 @@ void MemArena::GrabLowMemSpace(size_t size) ftruncate(fd, size); return; #endif - } diff --git a/Source/Core/Common/Src/MemoryUtil.cpp b/Source/Core/Common/Src/MemoryUtil.cpp index 5b6ff6f11b..d5681481d3 100644 --- a/Source/Core/Common/Src/MemoryUtil.cpp +++ b/Source/Core/Common/Src/MemoryUtil.cpp @@ -53,7 +53,11 @@ void* AllocateExecutableMemory(int size) #else void* retval = mmap(0, size, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); // | MAP_FIXED + MAP_ANONYMOUS | MAP_PRIVATE +#ifdef __x86_64__ + | MAP_32BIT +#endif + , -1, 0); // | MAP_FIXED printf("mappah exe %p %i\n", retval, size); if (!retval) diff --git a/Source/Core/Core/Src/Boot/Boot.h b/Source/Core/Core/Src/Boot/Boot.h index b76dbfcfe0..34d0c313d5 100644 --- a/Source/Core/Core/Src/Boot/Boot.h +++ b/Source/Core/Core/Src/Boot/Boot.h @@ -43,8 +43,6 @@ public: private: enum { BIOS_SIZE = 2*1024*1024 }; - static char gameID[7]; - static void RunFunction(u32 _iAddr, bool _bUseDebugger); static void UpdateDebugger_MapLoaded(const char* _gameID = NULL); diff --git a/Source/Core/Core/Src/HW/Memmap.cpp b/Source/Core/Core/Src/HW/Memmap.cpp index 39ab532879..31d2d92d30 100644 --- a/Source/Core/Core/Src/HW/Memmap.cpp +++ b/Source/Core/Core/Src/HW/Memmap.cpp @@ -1050,9 +1050,10 @@ void SDRUpdated() u32 CheckDTLB(u32 _Address, XCheckTLBFlag _Flag) { - PanicAlert("TLB: Read from unknown memory (0x%08x)\n" - "Several games uses the TLB to map memory. This\n" - "function is not support in dolphin. Cheers!", _Address); + PanicAlert("TLB: %s unknown memory (0x%08x)\n" + "Several games uses the TLB to map memory. This\n" + "function is not support in dolphin. Cheers!", + _Flag == FLAG_WRITE ? "Write to" : "Read from", _Address); u32 sr = PowerPC::ppcState.sr[EA_SR(_Address)]; @@ -1144,4 +1145,4 @@ u32 CheckDTLB(u32 _Address, XCheckTLBFlag _Flag) } -} // namespace \ No newline at end of file +} // namespace diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp index c10ca48a8a..4345f62898 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp @@ -15,6 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ #include "Common.h" +#include #include "x64Emitter.h" #include "ABI.h" #include "../../HLE/HLE.h" @@ -259,9 +260,13 @@ namespace Jit64 bool ImHereDebug = false; + std::map been_here; void ImHere() { + if (been_here.find(PC) != been_here.end()) + return; LOG(DYNA_REC, "I'm here - PC = %08x , LR = %08x", PC, LR); + been_here[PC] = true; } void FlushRegCaches() diff --git a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp index ad98459a9d..26b5382fd8 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/JitAsm.cpp @@ -191,12 +191,13 @@ void Generate() ABI_PushAllCalleeSavedRegsAndAdjustStack(); - //INT3(); + // INT3(); MOV(64, R(RBX), Imm64((u64)Memory::base)); - if ((u64)GetCodePointers() > 0x80000000ULL) { - PanicAlert("Code Pointers are above the limit!"); - } + // if ((u64)GetCodePointers() > 0x80000000ULL) { + // PanicAlert("Code Pointers are above the limit! %p", + // GetCodePointers()); + //} MOV(64, R(R15), Imm64((u64)GetCodePointers())); //It's below 2GB so 32 bits are good enough const u8 *outerLoop = GetCodePtr(); diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp index 429d40bcd8..29a22606f7 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_LoadStore.cpp @@ -56,8 +56,8 @@ namespace Jit64 if (accessSize != 32) XOR(32, R(EAX), R(EAX)); #ifdef _M_IX86 - AND(32, R(ECX), Imm32(Memory::MEMVIEW32_MASK)); - MOV(accessSize, R(EAX), MDisp(ECX, (u32)Memory::base)); + AND(32, R(reg), Imm32(Memory::MEMVIEW32_MASK)); + MOV(accessSize, R(EAX), MDisp(reg, (u32)Memory::base)); #else MOV(accessSize, R(EAX), MComplex(RBX, reg, SCALE_1, 0)); #endif @@ -72,9 +72,9 @@ namespace Jit64 SetJumpTarget(argh); switch (accessSize) { - case 32: ABI_CallFunctionR((void *)&Memory::Read_U32, ECX); break; - case 16: ABI_CallFunctionR((void *)&Memory::Read_U16, ECX); break; - case 8: ABI_CallFunctionR((void *)&Memory::Read_U8, ECX); break; + case 32: ABI_CallFunctionR((void *)&Memory::Read_U32, reg); break; + case 16: ABI_CallFunctionR((void *)&Memory::Read_U16, reg); break; + case 8: ABI_CallFunctionR((void *)&Memory::Read_U8, reg); break; } SetJumpTarget(arg2); } @@ -135,10 +135,10 @@ namespace Jit64 } //Still here? Do regular path. -#ifdef _M_IX86 - if (true) { -#elif defined(_M_X64) +#if defined(_M_X64) && defined(_WIN32) if (accessSize == 8 || accessSize == 16 || !jo.enableFastMem) { +#else + if (true) { #endif // Safe and boring gpr.Flush(FLUSH_VOLATILE); @@ -259,6 +259,8 @@ namespace Jit64 void stfs(UGeckoInstruction inst) { + Default(inst); + return; // LINUXTODO BIT32OLD; OLD; bool update = inst.OPCD & 1; @@ -336,6 +338,8 @@ namespace Jit64 void stX(UGeckoInstruction inst) { + Default(inst); + return; int s = inst.RS; int a = inst.RA;