2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
2010-05-03 14:08:02 +00:00
|
|
|
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-04-14 01:26:57 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-04-14 01:26:57 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2019-08-23 21:40:33 +00:00
|
|
|
//#define SPAM_DEPRECATION_WARNINGS
|
|
|
|
#if defined(__linux__) && defined(__clang__) && defined(SPAM_DEPRECATION_WARNINGS)
|
2015-11-19 23:47:46 +00:00
|
|
|
#define ATTR_DEP [[deprecated]]
|
|
|
|
#else
|
|
|
|
#define ATTR_DEP
|
|
|
|
#endif
|
|
|
|
|
2009-04-14 01:26:57 +00:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
// legacy jump/align functions
|
|
|
|
//------------------------------------------------------------------
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern void x86SetPtr(u8* ptr);
|
|
|
|
ATTR_DEP extern void x86SetJ8(u8* j8);
|
|
|
|
ATTR_DEP extern void x86SetJ8A(u8* j8);
|
|
|
|
ATTR_DEP extern void x86SetJ16(u16* j16);
|
|
|
|
ATTR_DEP extern void x86SetJ16A(u16* j16);
|
|
|
|
ATTR_DEP extern void x86SetJ32(u32* j32);
|
|
|
|
ATTR_DEP extern void x86SetJ32A(u32* j32);
|
2016-11-12 15:28:37 +00:00
|
|
|
ATTR_DEP extern void x86Align(int bytes);
|
|
|
|
ATTR_DEP extern void x86AlignExecutable(int align);
|
2009-04-14 01:26:57 +00:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
|
|
|
////////////////////////////////////
|
|
|
|
// jump instructions //
|
|
|
|
////////////////////////////////////
|
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
// jmp rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JMP8(u8 to);
|
2009-04-14 01:26:57 +00:00
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
// jmp rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JMP32(uptr to);
|
2009-04-14 01:26:57 +00:00
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
// jp rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JP8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jnp rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JNP8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// je rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JE8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jz rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JZ8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jg rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JG8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jge rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JGE8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// js rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JS8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jns rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JNS8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jl rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JL8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// ja rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JA8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jae rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JAE8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jb rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JB8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jbe rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JBE8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jle rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JLE8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jne rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JNE8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jnz rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JNZ8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jng rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JNG8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jnge rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JNGE8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jnl rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JNL8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jnle rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JNLE8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jo rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JO8(u8 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jno rel8
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u8* JNO8(u8 to);
|
2009-04-14 01:26:57 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
// jb rel16
|
2015-11-19 23:47:46 +00:00
|
|
|
ATTR_DEP extern u16* JA16( u16 to );
|
2009-04-14 01:26:57 +00:00
|
|
|
// jb rel16
|
2015-11-19 23:47:46 +00:00
|
|
|
ATTR_DEP extern u16* JB16( u16 to );
|
2009-04-14 01:26:57 +00:00
|
|
|
// je rel16
|
2015-11-19 23:47:46 +00:00
|
|
|
ATTR_DEP extern u16* JE16( u16 to );
|
2009-04-14 01:26:57 +00:00
|
|
|
// jz rel16
|
2015-11-19 23:47:46 +00:00
|
|
|
ATTR_DEP extern u16* JZ16( u16 to );
|
2009-04-14 01:26:57 +00:00
|
|
|
*/
|
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
// jns rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JNS32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// js rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JS32(u32 to);
|
2009-04-14 01:26:57 +00:00
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
// jb rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JB32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// je rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JE32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jz rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JZ32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jg rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JG32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jge rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JGE32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jl rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JL32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jle rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JLE32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jae rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JAE32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jne rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JNE32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jnz rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JNZ32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jng rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JNG32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jnge rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JNGE32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jnl rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JNL32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jnle rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JNLE32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jo rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JO32(u32 to);
|
2010-04-25 00:31:27 +00:00
|
|
|
// jno rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JNO32(u32 to);
|
2009-04-14 01:26:57 +00:00
|
|
|
// js rel32
|
2021-09-06 18:28:26 +00:00
|
|
|
ATTR_DEP extern u32* JS32(u32 to);
|
2009-04-14 01:26:57 +00:00
|
|
|
|
|
|
|
//******************
|
2010-04-25 00:31:27 +00:00
|
|
|
// FPU instructions
|
2009-04-14 01:26:57 +00:00
|
|
|
//******************
|
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
// fld m32 to fpu reg stack
|
2016-11-12 15:28:37 +00:00
|
|
|
ATTR_DEP extern void FLD32(u32 from);
|
2009-04-14 01:26:57 +00:00
|
|
|
// fld st(i)
|
2015-11-19 23:47:46 +00:00
|
|
|
ATTR_DEP extern void FLD(int st);
|
2009-04-14 01:26:57 +00:00
|
|
|
// fld1 (push +1.0f on the stack)
|
2015-11-19 23:47:46 +00:00
|
|
|
ATTR_DEP extern void FLD1();
|
2009-04-14 01:26:57 +00:00
|
|
|
// fld1 (push log_2 e on the stack)
|
2015-11-19 23:47:46 +00:00
|
|
|
ATTR_DEP extern void FLDL2E();
|
2010-04-25 00:31:27 +00:00
|
|
|
// fstp m32 from fpu reg stack
|
2016-11-12 15:28:37 +00:00
|
|
|
ATTR_DEP extern void FSTP32(u32 to);
|
2009-04-14 01:26:57 +00:00
|
|
|
// fstp st(i)
|
2015-11-19 23:47:46 +00:00
|
|
|
ATTR_DEP extern void FSTP(int st);
|
2009-04-14 01:26:57 +00:00
|
|
|
|
|
|
|
// frndint
|
2015-11-19 23:47:46 +00:00
|
|
|
ATTR_DEP extern void FRNDINT();
|
|
|
|
ATTR_DEP extern void FXCH(int st);
|
|
|
|
ATTR_DEP extern void F2XM1();
|
|
|
|
ATTR_DEP extern void FSCALE();
|
2009-04-14 01:26:57 +00:00
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
// fadd ST(0) to fpu reg stack ST(src)
|
2016-11-12 15:28:37 +00:00
|
|
|
ATTR_DEP extern void FADD320toR(x86IntRegType src);
|
2010-04-25 00:31:27 +00:00
|
|
|
// fsub ST(src) to fpu reg stack ST(0)
|
2016-11-12 15:28:37 +00:00
|
|
|
ATTR_DEP extern void FSUB32Rto0(x86IntRegType src);
|
2009-04-14 01:26:57 +00:00
|
|
|
|
2010-04-25 00:31:27 +00:00
|
|
|
// fmul m32 to fpu reg stack
|
2016-11-12 15:28:37 +00:00
|
|
|
ATTR_DEP extern void FMUL32(u32 from);
|
2010-04-25 00:31:27 +00:00
|
|
|
// fdiv m32 to fpu reg stack
|
2016-11-12 15:28:37 +00:00
|
|
|
ATTR_DEP extern void FDIV32(u32 from);
|
2010-04-25 00:31:27 +00:00
|
|
|
// ftan fpu reg stack
|
2016-11-12 15:28:37 +00:00
|
|
|
ATTR_DEP extern void FPATAN(void);
|
2010-04-25 00:31:27 +00:00
|
|
|
// fsin fpu reg stack
|
2016-11-12 15:28:37 +00:00
|
|
|
ATTR_DEP extern void FSIN(void);
|
2009-04-14 01:26:57 +00:00
|
|
|
|
|
|
|
//*********************
|
|
|
|
// SSE instructions *
|
|
|
|
//*********************
|
2016-11-12 15:28:37 +00:00
|
|
|
ATTR_DEP extern void SSE_MAXSS_XMM_to_XMM(x86SSERegType to, x86SSERegType from);
|
|
|
|
ATTR_DEP extern void SSE_MINSS_XMM_to_XMM(x86SSERegType to, x86SSERegType from);
|
|
|
|
ATTR_DEP extern void SSE_ADDSS_XMM_to_XMM(x86SSERegType to, x86SSERegType from);
|
|
|
|
ATTR_DEP extern void SSE_SUBSS_XMM_to_XMM(x86SSERegType to, x86SSERegType from);
|
2009-04-14 01:26:57 +00:00
|
|
|
|
|
|
|
//*********************
|
|
|
|
// SSE 2 Instructions*
|
|
|
|
//*********************
|
|
|
|
|
2016-11-12 15:28:37 +00:00
|
|
|
ATTR_DEP extern void SSE2_MAXSD_XMM_to_XMM(x86SSERegType to, x86SSERegType from);
|
|
|
|
ATTR_DEP extern void SSE2_MINSD_XMM_to_XMM(x86SSERegType to, x86SSERegType from);
|
|
|
|
ATTR_DEP extern void SSE2_ADDSD_XMM_to_XMM(x86SSERegType to, x86SSERegType from);
|
|
|
|
ATTR_DEP extern void SSE2_SUBSD_XMM_to_XMM(x86SSERegType to, x86SSERegType from);
|