summaryrefslogtreecommitdiffstats
path: root/src/core/arm/skyeye_common/vfp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-03-20 02:37:43 +0100
committerbunnei <bunneidev@gmail.com>2015-03-20 02:37:43 +0100
commit1981aa3d7e8c230f05999393a891c89105575b12 (patch)
tree0f2e2db10ba2b96bda11b4538aaaba7cdbd3536b /src/core/arm/skyeye_common/vfp
parentMerge pull request #667 from archshift/wut (diff)
parentdyncom: Make Load/Store instructions support big endian (diff)
downloadyuzu-1981aa3d7e8c230f05999393a891c89105575b12.tar
yuzu-1981aa3d7e8c230f05999393a891c89105575b12.tar.gz
yuzu-1981aa3d7e8c230f05999393a891c89105575b12.tar.bz2
yuzu-1981aa3d7e8c230f05999393a891c89105575b12.tar.lz
yuzu-1981aa3d7e8c230f05999393a891c89105575b12.tar.xz
yuzu-1981aa3d7e8c230f05999393a891c89105575b12.tar.zst
yuzu-1981aa3d7e8c230f05999393a891c89105575b12.zip
Diffstat (limited to 'src/core/arm/skyeye_common/vfp')
-rw-r--r--src/core/arm/skyeye_common/vfp/vfpinstr.cpp102
1 files changed, 73 insertions, 29 deletions
diff --git a/src/core/arm/skyeye_common/vfp/vfpinstr.cpp b/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
index b9b96c388..368b5a25d 100644
--- a/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
+++ b/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
@@ -1388,12 +1388,20 @@ VSTR_INST:
if (inst_cream->single)
{
- Memory::Write32(addr, cpu->ExtReg[inst_cream->d]);
+ WriteMemory32(cpu, addr, cpu->ExtReg[inst_cream->d]);
}
else
{
- Memory::Write32(addr, cpu->ExtReg[inst_cream->d*2]);
- Memory::Write32(addr + 4, cpu->ExtReg[inst_cream->d*2+1]);
+ const u32 word1 = cpu->ExtReg[inst_cream->d*2+0];
+ const u32 word2 = cpu->ExtReg[inst_cream->d*2+1];
+
+ if (InBigEndianMode(cpu)) {
+ WriteMemory32(cpu, addr + 0, word2);
+ WriteMemory32(cpu, addr + 4, word1);
+ } else {
+ WriteMemory32(cpu, addr + 0, word1);
+ WriteMemory32(cpu, addr + 4, word2);
+ }
}
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
@@ -1447,17 +1455,27 @@ VPUSH_INST:
{
if (inst_cream->single)
{
- Memory::Write32(addr, cpu->ExtReg[inst_cream->d+i]);
+ WriteMemory32(cpu, addr, cpu->ExtReg[inst_cream->d+i]);
addr += 4;
}
else
{
- Memory::Write32(addr, cpu->ExtReg[(inst_cream->d+i)*2]);
- Memory::Write32(addr + 4, cpu->ExtReg[(inst_cream->d+i)*2 + 1]);
+ const u32 word1 = cpu->ExtReg[(inst_cream->d+i)*2+0];
+ const u32 word2 = cpu->ExtReg[(inst_cream->d+i)*2+1];
+
+ if (InBigEndianMode(cpu)) {
+ WriteMemory32(cpu, addr + 0, word2);
+ WriteMemory32(cpu, addr + 4, word1);
+ } else {
+ WriteMemory32(cpu, addr + 0, word1);
+ WriteMemory32(cpu, addr + 4, word2);
+ }
+
addr += 8;
}
}
- cpu->Reg[R13] = cpu->Reg[R13] - inst_cream->imm32;
+
+ cpu->Reg[R13] -= inst_cream->imm32;
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(vpush_inst));
@@ -1516,13 +1534,22 @@ VSTM_INST: /* encoding 1 */
{
if (inst_cream->single)
{
- Memory::Write32(addr, cpu->ExtReg[inst_cream->d+i]);
+ WriteMemory32(cpu, addr, cpu->ExtReg[inst_cream->d+i]);
addr += 4;
}
else
{
- Memory::Write32(addr, cpu->ExtReg[(inst_cream->d+i)*2]);
- Memory::Write32(addr + 4, cpu->ExtReg[(inst_cream->d+i)*2 + 1]);
+ const u32 word1 = cpu->ExtReg[(inst_cream->d+i)*2+0];
+ const u32 word2 = cpu->ExtReg[(inst_cream->d+i)*2+1];
+
+ if (InBigEndianMode(cpu)) {
+ WriteMemory32(cpu, addr + 0, word2);
+ WriteMemory32(cpu, addr + 4, word1);
+ } else {
+ WriteMemory32(cpu, addr + 0, word1);
+ WriteMemory32(cpu, addr + 4, word2);
+ }
+
addr += 8;
}
}
@@ -1575,8 +1602,6 @@ VPOP_INST:
if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) {
CHECK_VFP_ENABLED;
- unsigned int value1, value2;
-
vpop_inst *inst_cream = (vpop_inst *)inst_base->component;
addr = cpu->Reg[R13];
@@ -1585,20 +1610,26 @@ VPOP_INST:
{
if (inst_cream->single)
{
- value1 = Memory::Read32(addr);
- cpu->ExtReg[inst_cream->d+i] = value1;
+ cpu->ExtReg[inst_cream->d+i] = ReadMemory32(cpu, addr);
addr += 4;
}
else
{
- value1 = Memory::Read32(addr);
- value2 = Memory::Read32(addr + 4);
- cpu->ExtReg[(inst_cream->d+i)*2] = value1;
- cpu->ExtReg[(inst_cream->d+i)*2 + 1] = value2;
+ const u32 word1 = ReadMemory32(cpu, addr + 0);
+ const u32 word2 = ReadMemory32(cpu, addr + 4);
+
+ if (InBigEndianMode(cpu)) {
+ cpu->ExtReg[(inst_cream->d+i)*2+0] = word2;
+ cpu->ExtReg[(inst_cream->d+i)*2+1] = word1;
+ } else {
+ cpu->ExtReg[(inst_cream->d+i)*2+0] = word1;
+ cpu->ExtReg[(inst_cream->d+i)*2+1] = word2;
+ }
+
addr += 8;
}
}
- cpu->Reg[R13] = cpu->Reg[R13] + inst_cream->imm32;
+ cpu->Reg[R13] += inst_cream->imm32;
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(vpop_inst));
@@ -1653,16 +1684,20 @@ VLDR_INST:
if (inst_cream->single)
{
- cpu->ExtReg[inst_cream->d] = Memory::Read32(addr);
+ cpu->ExtReg[inst_cream->d] = ReadMemory32(cpu, addr);
}
else
{
- unsigned int word1, word2;
- word1 = Memory::Read32(addr);
- word2 = Memory::Read32(addr + 4);
-
- cpu->ExtReg[inst_cream->d*2] = word1;
- cpu->ExtReg[inst_cream->d*2+1] = word2;
+ const u32 word1 = ReadMemory32(cpu, addr + 0);
+ const u32 word2 = ReadMemory32(cpu, addr + 4);
+
+ if (InBigEndianMode(cpu)) {
+ cpu->ExtReg[inst_cream->d*2+0] = word2;
+ cpu->ExtReg[inst_cream->d*2+1] = word1;
+ } else {
+ cpu->ExtReg[inst_cream->d*2+0] = word1;
+ cpu->ExtReg[inst_cream->d*2+1] = word2;
+ }
}
}
cpu->Reg[15] += GET_INST_SIZE(cpu);
@@ -1722,13 +1757,22 @@ VLDM_INST:
{
if (inst_cream->single)
{
- cpu->ExtReg[inst_cream->d+i] = Memory::Read32(addr);
+ cpu->ExtReg[inst_cream->d+i] = ReadMemory32(cpu, addr);
addr += 4;
}
else
{
- cpu->ExtReg[(inst_cream->d+i)*2] = Memory::Read32(addr);
- cpu->ExtReg[(inst_cream->d+i)*2 + 1] = Memory::Read32(addr + 4);
+ const u32 word1 = ReadMemory32(cpu, addr + 0);
+ const u32 word2 = ReadMemory32(cpu, addr + 4);
+
+ if (InBigEndianMode(cpu)) {
+ cpu->ExtReg[(inst_cream->d+i)*2+0] = word2;
+ cpu->ExtReg[(inst_cream->d+i)*2+1] = word1;
+ } else {
+ cpu->ExtReg[(inst_cream->d+i)*2+0] = word1;
+ cpu->ExtReg[(inst_cream->d+i)*2+1] = word2;
+ }
+
addr += 8;
}
}