mirror of https://github.com/PCSX2/pcsx2.git
common: Clean up 32bit code.
This commit is contained in:
parent
6db573d255
commit
9dac598113
|
@ -12,51 +12,6 @@
|
||||||
; You should have received a copy of the GNU General Public License along with PCSX2.
|
; You should have received a copy of the GNU General Public License along with PCSX2.
|
||||||
; If not, see <http://www.gnu.org/licenses/>.
|
; 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
|
; 64-bit X86
|
||||||
; -----------------------------------------
|
; -----------------------------------------
|
||||||
|
@ -124,6 +79,4 @@ fastjmp_jmp ENDP
|
||||||
|
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
|
|
||||||
ENDIF ; _M_X86_64
|
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
#define PREFIX ""
|
#define PREFIX ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_M_X86_64)
|
|
||||||
|
|
||||||
asm(
|
asm(
|
||||||
"\t.global " PREFIX "fastjmp_set\n"
|
"\t.global " PREFIX "fastjmp_set\n"
|
||||||
"\t.global " PREFIX "fastjmp_jmp\n"
|
"\t.global " PREFIX "fastjmp_jmp\n"
|
||||||
|
@ -57,36 +55,4 @@ asm(
|
||||||
jmp *%rdx
|
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
|
#endif // __WIN32
|
||||||
|
|
|
@ -20,14 +20,10 @@
|
||||||
|
|
||||||
struct fastjmp_buf
|
struct fastjmp_buf
|
||||||
{
|
{
|
||||||
#if defined(_M_X86_64) && defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
static constexpr std::size_t BUF_SIZE = 240;
|
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
|
#else
|
||||||
#error Unknown architecture.
|
static constexpr std::size_t BUF_SIZE = 64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
alignas(16) std::uint8_t buf[BUF_SIZE];
|
alignas(16) std::uint8_t buf[BUF_SIZE];
|
||||||
|
|
|
@ -225,12 +225,7 @@ extern bool pxParseAssignmentString(const wxString& src, wxString& ldest, wxStri
|
||||||
|
|
||||||
#define pxsFmt FastFormatUnicode().Write
|
#define pxsFmt FastFormatUnicode().Write
|
||||||
#define pxsFmtV FastFormatUnicode().WriteV
|
#define pxsFmtV FastFormatUnicode().WriteV
|
||||||
|
|
||||||
#ifdef _M_X86_64
|
|
||||||
#define pxsPtr(ptr) pxsFmt("0x%016" PRIXPTR, (ptr)).c_str()
|
#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+=(wxString& str1, const FastFormatUnicode& str2);
|
||||||
extern wxString operator+(const wxString& str1, const FastFormatUnicode& str2);
|
extern wxString operator+(const wxString& str1, const FastFormatUnicode& str2);
|
||||||
|
|
Loading…
Reference in New Issue