summaryrefslogtreecommitdiff
path: root/libpcsxcore
diff options
context:
space:
mode:
authorSND\notaz_cp <SND\notaz_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-01-19 00:51:24 +0000
committerSND\notaz_cp <SND\notaz_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2013-01-19 00:51:24 +0000
commit8093a1645070c5b5413fc5dee0d9917aee178c9d (patch)
treebddaba3b8209d5d912a152e41497c86bcbabed64 /libpcsxcore
parentdfedf538eab08dc2ba7142ea07c51858b4ff6067 (diff)
downloadpcsxr-8093a1645070c5b5413fc5dee0d9917aee178c9d.tar.gz
dynarec: store cycles before psxBranchTest to better match interpreter
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@82380 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'libpcsxcore')
-rwxr-xr-xlibpcsxcore/ix86/iR3000A.c21
-rwxr-xr-xlibpcsxcore/ix86_64/iR3000A-64.c20
2 files changed, 23 insertions, 18 deletions
diff --git a/libpcsxcore/ix86/iR3000A.c b/libpcsxcore/ix86/iR3000A.c
index 942429b2..9039e069 100755
--- a/libpcsxcore/ix86/iR3000A.c
+++ b/libpcsxcore/ix86/iR3000A.c
@@ -99,10 +99,13 @@ static void iFlushRegs() {
}
}
-static void iRet() {
- /* store cycle */
+static void iStoreCycle() {
count = ((pc - pcold) / 4) * BIAS;
ADD32ItoM((u32)&psxRegs.cycle, count);
+}
+
+static void iRet() {
+ iStoreCycle();
if (resp) ADD32ItoR(ESP, resp);
RET();
}
@@ -181,11 +184,13 @@ static void SetBranch() {
}
iFlushRegs();
+ iStoreCycle();
MOV32MtoR(EAX, (u32)&target);
MOV32RtoM((u32)&psxRegs.pc, EAX);
CALLFunc((u32)psxBranchTest);
- iRet();
+ StackRes();
+ RET();
}
static void iJump(u32 branchPC) {
@@ -213,11 +218,10 @@ static void iJump(u32 branchPC) {
recBSC[psxRegs.code>>26]();
iFlushRegs();
+ iStoreCycle();
MOV32ItoM((u32)&psxRegs.pc, branchPC);
CALLFunc((u32)psxBranchTest);
- /* store cycle */
- count = ((pc - pcold) / 4) * BIAS;
- ADD32ItoM((u32)&psxRegs.cycle, count);
+
if (resp) ADD32ItoR(ESP, resp);
// maybe just happened an interruption, check so
@@ -270,11 +274,10 @@ static void iBranch(u32 branchPC, int savectx) {
recBSC[psxRegs.code>>26]();
iFlushRegs();
+ iStoreCycle();
MOV32ItoM((u32)&psxRegs.pc, branchPC);
CALLFunc((u32)psxBranchTest);
- /* store cycle */
- count = ((pc - pcold) / 4) * BIAS;
- ADD32ItoM((u32)&psxRegs.cycle, count);
+
if (resp) ADD32ItoR(ESP, resp);
// maybe just happened an interruption, check so
diff --git a/libpcsxcore/ix86_64/iR3000A-64.c b/libpcsxcore/ix86_64/iR3000A-64.c
index 0dccf8bf..0d07ed55 100755
--- a/libpcsxcore/ix86_64/iR3000A-64.c
+++ b/libpcsxcore/ix86_64/iR3000A-64.c
@@ -110,10 +110,13 @@ static void iFlushRegs() {
}
}
-static void iRet() {
- /* store cycle */
+static void iStoreCycle() {
count = ((pc - pcold) / 4) * BIAS;
ADD32ItoM((uptr)&psxRegs.cycle, count);
+}
+
+static void iRet() {
+ iStoreCycle();
StackRes();
RET();
}
@@ -179,11 +182,13 @@ static void SetBranch() {
recBSC[psxRegs.code>>26]();
iFlushRegs();
+ iStoreCycle();
MOV32MtoR(EAX, (uptr)&target);
MOV32RtoM((uptr)&psxRegs.pc, EAX);
CALLFunc((uptr)psxBranchTest);
- iRet();
+ StackRes();
+ RET();
}
static void iJump(u32 branchPC) {
@@ -212,11 +217,10 @@ static void iJump(u32 branchPC) {
recBSC[psxRegs.code>>26]();
iFlushRegs();
+ iStoreCycle();
MOV32ItoM((uptr)&psxRegs.pc, branchPC);
CALLFunc((uptr)psxBranchTest);
- /* store cycle */
- count = ((pc - pcold) / 4) * BIAS;
- ADD32ItoM((uptr)&psxRegs.cycle, count);
+
StackRes();
RET();
@@ -277,11 +281,9 @@ static void iBranch(u32 branchPC, int savectx) {
recBSC[psxRegs.code>>26]();
iFlushRegs();
+ iStoreCycle();
MOV32ItoM((uptr)&psxRegs.pc, branchPC);
CALLFunc((uptr)psxBranchTest);
- /* store cycle */
- count = ((pc - pcold) / 4) * BIAS;
- ADD32ItoM((uptr)&psxRegs.cycle, count);
StackRes();