From 9dac5981135f56a4dc08105c85fa78e6ad0938d1 Mon Sep 17 00:00:00 2001 From: lightningterror <18107717+lightningterror@users.noreply.github.com> Date: Mon, 21 Mar 2022 09:43:18 +0100 Subject: [PATCH] common: Clean up 32bit code. --- common/FastJmp.asm | 47 ------------------------------------------ common/FastJmp.cpp | 34 ------------------------------ common/FastJmp.h | 8 ++----- common/StringHelpers.h | 5 ----- 4 files changed, 2 insertions(+), 92 deletions(-) diff --git a/common/FastJmp.asm b/common/FastJmp.asm index 743f798ef4..6d8a05ce67 100644 --- a/common/FastJmp.asm +++ b/common/FastJmp.asm @@ -12,51 +12,6 @@ ; You should have received a copy of the GNU General Public License along with PCSX2. ; If not, see . -IFDEF _M_X86_32 - -; ----------------------------------------- -; 32-bit X86 -; ----------------------------------------- - .386 - .model flat - -_TEXT SEGMENT - -PUBLIC @fastjmp_set@4 -PUBLIC @fastjmp_jmp@8 - -; void fastjmp_set(fastjmp_buf*) -@fastjmp_set@4 PROC - mov eax, dword ptr [esp] - mov edx, esp ; fixup stack pointer, so it doesn't include the call to fastjmp_set - add edx, 4 - mov dword ptr [ecx], eax ; actually eip - mov dword ptr [ecx + 4], ebx - mov dword ptr [ecx + 8], edx ; actually esp - mov dword ptr [ecx + 12], ebp - mov dword ptr [ecx + 16], esi - mov dword ptr [ecx + 20], edi - xor eax, eax - ret -@fastjmp_set@4 ENDP - -; void __fastcall fastjmp_jmp(fastjmp_buf*, int) -@fastjmp_jmp@8 PROC - mov eax, edx ; return code - mov edx, dword ptr [ecx + 0] - mov ebx, dword ptr [ecx + 4] - mov esp, dword ptr [ecx + 8] - mov ebp, dword ptr [ecx + 12] - mov esi, dword ptr [ecx + 16] - mov edi, dword ptr [ecx + 20] - jmp edx -@fastjmp_jmp@8 ENDP - -_TEXT ENDS - -ENDIF ; _M_X86_32 - -IFDEF _M_X86_64 ; ----------------------------------------- ; 64-bit X86 ; ----------------------------------------- @@ -124,6 +79,4 @@ fastjmp_jmp ENDP _TEXT ENDS -ENDIF ; _M_X86_64 - END diff --git a/common/FastJmp.cpp b/common/FastJmp.cpp index 18607d8269..c59a275ecd 100644 --- a/common/FastJmp.cpp +++ b/common/FastJmp.cpp @@ -23,8 +23,6 @@ #define PREFIX "" #endif -#if defined(_M_X86_64) - asm( "\t.global " PREFIX "fastjmp_set\n" "\t.global " PREFIX "fastjmp_jmp\n" @@ -57,36 +55,4 @@ asm( jmp *%rdx )"); -#elif defined(_M_X86_32) - -asm( - "\t.global " PREFIX "fastjmp_set\n" - "\t.global " PREFIX "fastjmp_jmp\n" - "\t.text\n" - "\t" PREFIX "fastjmp_set:" R"( - movl 0(%esp), %eax - movl %esp, %edx # fixup stack pointer, so it doesn't include the call to fastjmp_set - addl $4, %edx - movl %eax, 0(%ecx) # actually eip - movl %ebx, 4(%ecx) - movl %edx, 8(%ecx) # actually esp - movl %ebp, 12(%ecx) - movl %esi, 16(%ecx) - movl %edi, 20(%ecx) - xorl %eax, %eax - ret -)" - "\t" PREFIX "fastjmp_jmp:" R"( - movl %edx, %eax - movl 0(%ecx), %edx # actually eip - movl 4(%ecx), %ebx - movl 8(%ecx), %esp # actually esp - movl 12(%ecx), %ebp - movl 16(%ecx), %esi - movl 20(%ecx), %edi - jmp *%edx -)"); - -#endif - #endif // __WIN32 diff --git a/common/FastJmp.h b/common/FastJmp.h index 099b8f57a2..7cfd2853ac 100644 --- a/common/FastJmp.h +++ b/common/FastJmp.h @@ -20,14 +20,10 @@ struct fastjmp_buf { -#if defined(_M_X86_64) && defined(_WIN32) +#if defined(_WIN32) static constexpr std::size_t BUF_SIZE = 240; -#elif defined(_M_X86_64) - static constexpr std::size_t BUF_SIZE = 64; -#elif defined(_M_X86_32) - static constexpr std::size_t BUF_SIZE = 24; #else -#error Unknown architecture. + static constexpr std::size_t BUF_SIZE = 64; #endif alignas(16) std::uint8_t buf[BUF_SIZE]; diff --git a/common/StringHelpers.h b/common/StringHelpers.h index 567523181b..5844d8ae02 100644 --- a/common/StringHelpers.h +++ b/common/StringHelpers.h @@ -225,12 +225,7 @@ extern bool pxParseAssignmentString(const wxString& src, wxString& ldest, wxStri #define pxsFmt FastFormatUnicode().Write #define pxsFmtV FastFormatUnicode().WriteV - -#ifdef _M_X86_64 #define pxsPtr(ptr) pxsFmt("0x%016" PRIXPTR, (ptr)).c_str() -#else -#define pxsPtr(ptr) pxsFmt("0x%08" PRIXPTR, (ptr)).c_str() -#endif extern wxString& operator+=(wxString& str1, const FastFormatUnicode& str2); extern wxString operator+(const wxString& str1, const FastFormatUnicode& str2);