Index: src/arm/simulator-arm.cc |
=================================================================== |
--- src/arm/simulator-arm.cc (revision 4607) |
+++ src/arm/simulator-arm.cc (working copy) |
@@ -728,6 +728,13 @@ |
} |
+void Simulator::set_dw_register(int dreg, const int* dbl) { |
+ ASSERT((dreg >= 0) && (dreg < num_d_registers)); |
+ registers_[dreg] = dbl[0]; |
+ registers_[dreg + 1] = dbl[1]; |
+} |
+ |
+ |
// Raw access to the PC register. |
void Simulator::set_pc(int32_t value) { |
pc_modified_ = true; |
@@ -1001,6 +1008,41 @@ |
} |
+int32_t* Simulator::ReadDW(int32_t addr) { |
+#if V8_TARGET_CAN_READ_UNALIGNED |
+ int32_t* ptr = reinterpret_cast<int32_t *>(addr); |
Erik Corry
2010/05/07 20:04:34
I removed a space here for you.
|
+ return ptr; |
+#else |
+ if ((addr & 3) == 0) { |
+ intptr_t* ptr = reinterpret_cast<intptr_t*>(addr); |
+ return *ptr; |
Erik Corry
2010/05/07 20:04:34
I don't see how this compiles. It should be retur
|
+ } |
+ PrintF("Unaligned read at 0x%08x\n", addr); |
+ UNIMPLEMENTED(); |
+ return 0; |
+#endif |
+} |
+ |
+ |
+void Simulator::WriteDW(int32_t addr, int32_t value1, int32_t value2) { |
+#if V8_TARGET_CAN_READ_UNALIGNED |
+ int32_t* ptr = reinterpret_cast<int32_t*>(addr); |
+ *ptr++ = value1; |
+ *ptr = value2; |
+ return; |
+#else |
+ if ((addr & 3) == 0) { |
+ int32_t* ptr = reinterpret_cast<int32_t*>(addr); |
+ *ptr++ = value1; |
+ *ptr = value2; |
+ return; |
+ } |
+ PrintF("Unaligned write at 0x%08x, pc=%p\n", addr, instr); |
Erik Corry
2010/05/07 20:04:34
There's no variable called instr here so this does
|
+ UNIMPLEMENTED(); |
+#endif |
+} |
+ |
+ |
// Returns the limit of the stack area to enable checking for stack overflows. |
uintptr_t Simulator::StackLimit() const { |
// Leave a safety margin of 256 bytes to prevent overrunning the stack when |
@@ -1628,7 +1670,19 @@ |
} |
} |
} |
- if (instr->HasH()) { |
+ if (((instr->Bits(7, 4) & 0xd) == 0xd) && (instr->Bit(20) == 0)) { |
+ ASSERT((rd % 2) == 0); |
+ if (instr->HasH()) { |
+ // The strd instruction. |
+ int32_t value1 = get_register(rd); |
+ int32_t value2 = get_register(rd+1); |
+ WriteDW(addr, value1, value2); |
+ } else { |
+ // The ldrd instruction. |
+ int* rn_data = ReadDW(addr); |
+ set_dw_register(rd, rn_data); |
+ } |
+ } else if (instr->HasH()) { |
if (instr->HasSign()) { |
if (instr->HasL()) { |
int16_t val = ReadH(addr, instr); |