bugfix, more...

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@116 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-07-31 21:02:19 +00:00
parent 523ca5a682
commit 0c21d95606
4 changed files with 37 additions and 6 deletions

View File

@ -29,6 +29,14 @@ void ABI_CallFunctionR(void *func, X64Reg reg1) {
ADD(32, R(ESP), Imm8(4));
}
void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2)
{
PUSH(32, arg1);
PUSH(32, Imm32(param2));
CALL(func);
ADD(32, R(ESP), Imm8(8));
}
void ABI_PushAllCalleeSavedRegsAndAdjustStack() {
PUSH(EBP);
PUSH(EBX);
@ -66,6 +74,14 @@ void ABI_CallFunctionR(void *func, X64Reg reg1) {
CALL(func);
}
void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2)
{
if (arg1.IsSimpleReg(ABI_PARAM1))
MOV(32, R(ABI_PARAM1), arg1);
MOV(32, R(ABI_PARAM2), Imm32(param2));
CALL(func);
}
#ifdef _WIN32
// Win64 Specific Code
// ====================================
@ -74,7 +90,7 @@ void ABI_PushAllCalleeSavedRegsAndAdjustStack() {
PUSH(RBX);
PUSH(RSI);
PUSH(RDI);
PUSH(RBP);
//PUSH(RBP);
PUSH(R12);
PUSH(R13);
PUSH(R14);
@ -89,7 +105,7 @@ void ABI_PopAllCalleeSavedRegsAndAdjustStack() {
POP(R14);
POP(R13);
POP(R12);
POP(RBP);
//POP(RBP);
POP(RDI);
POP(RSI);
POP(RBX);
@ -99,11 +115,21 @@ void ABI_PopAllCalleeSavedRegsAndAdjustStack() {
// Unix64 Specific Code
// ====================================
void ABI_PushAllCalleeSavedRegsAndAdjustStack() {
PUSH(RBX);
PUSH(RBP);
PUSH(R12);
PUSH(R13);
PUSH(R14);
PUSH(R15);
}
void ABI_PopAllCalleeSavedRegsAndAdjustStack() {
POP(R15);
POP(R14);
POP(R13);
POP(R12);
POP(RBP);
POP(RBX);
}
#endif

View File

@ -83,6 +83,7 @@
// These will destroy the 1 or 2 first "parameter regs".
void ABI_CallFunctionC(void *func, u32 param1);
void ABI_CallFunctionCC(void *func, u32 param1, u32 param2);
void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2);
// Pass a register as a paremeter.
void ABI_CallFunctionR(void *func, Gen::X64Reg reg1);

View File

@ -132,7 +132,11 @@ namespace Gen
void WriteNormalOp(bool toRM, NormalOp op, const OpArg &operand, int bits) const;
bool IsImm() const {return scale == SCALE_IMM8 || scale == SCALE_IMM16 || scale == SCALE_IMM32 || scale == SCALE_IMM64;}
bool IsSimpleReg() const {return scale == SCALE_NONE;}
bool IsSimpleReg(X64Reg reg) const {
if (!IsSimpleReg())
return false;
return GetSimpleReg() == reg;
}
bool CanDoOpWith(OpArg &other) const
{
if (IsSimpleReg()) return true;

View File

@ -356,7 +356,7 @@ namespace Jit64
case 36: accessSize = 32; break; //stw
case 44: accessSize = 16; break; //sth
case 38: accessSize = 8; break; //stb
default: _assert_msg_(DYNA_REC,0,"AWETKLJASDLKF"); return;
default: _assert_msg_(DYNA_REC, 0, "AWETKLJASDLKF"); return;
}
if (gpr.R(a).IsImm() && !update)