aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/arm/skyeye_common/vfp/vfpinstr.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash <mathew1800@gmail.com>2015-03-11 16:10:14 -0400
committerGravatar Lioncash <mathew1800@gmail.com>2015-03-17 15:13:32 -0400
commit9fdb311d6e2d636c4599ddc3d4cb9adad6cec540 (patch)
tree358501f8f2e31c7c27ee17c62996ef01e21354c7 /src/core/arm/skyeye_common/vfp/vfpinstr.cpp
parentf28080621477d7e6a6caaf6bf93da7f448159562 (diff)
dyncom: Make Load/Store instructions support big endian
Diffstat (limited to 'src/core/arm/skyeye_common/vfp/vfpinstr.cpp')
-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 b9b96c38..368b5a25 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;
}
}