common: Clean up 32bit code.

This commit is contained in:
lightningterror 2022-03-21 09:43:18 +01:00
parent 6db573d255
commit 9dac598113
4 changed files with 2 additions and 92 deletions

View File

@ -12,51 +12,6 @@
; You should have received a copy of the GNU General Public License along with PCSX2.
; If not, see <http://www.gnu.org/licenses/>.
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

View File

@ -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

View File

@ -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];

View File

@ -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);