Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: src/arm/simulator-arm.cc

Issue 500095: As a first step towards implementing thumb2, add code for... Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/arm/assembler-thumb2.cc ('K') | « src/arm/simulator-arm.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/simulator-arm.cc
===================================================================
--- src/arm/simulator-arm.cc (revision 3473)
+++ src/arm/simulator-arm.cc (working copy)
@@ -421,6 +421,7 @@
stack_ = reinterpret_cast<char*>(malloc(stack_size));
pc_modified_ = false;
icount_ = 0;
+ thumb_mode_ = false;
break_pc_ = NULL;
break_instr_ = 0;
@@ -2074,6 +2075,12 @@
reinterpret_cast<byte*>(instr));
PrintF(" 0x%08x %s\n", instr, buffer.start());
}
+ // Temporary special-casing of our particular ARM/THUMB switch
Erik Corry 2009/12/17 14:05:50 I think this can be moved to where it fits (in the
+ if ((unsigned)instr->InstructionBits() == 0xe24ff003) {
+ thumb_mode_ = true;
+ set_register(pc, reinterpret_cast<int32_t>(instr) + Instr::kInstrSize);
+ return;
+ }
if (instr->ConditionField() == special_condition) {
DecodeUnconditional(instr);
} else if (ConditionallyExecute(instr)) {
@@ -2118,6 +2125,11 @@
}
}
+void Simulator::InstructionDecode(ThumbInstr* instr) {
+ // For now, assume all thumb instructions are an aligned switch back to ARM
Erik Corry 2009/12/17 14:05:50 Please assert this is true.
+ set_register(pc, reinterpret_cast<int32_t>(instr) + Instr::kInstrSize);
+ thumb_mode_ = false;
+}
void Simulator::Execute() {
// Get the PC to simulate. Cannot use the accessor here as we need the
@@ -2128,9 +2140,14 @@
// Fast version of the dispatch loop without checking whether the simulator
// should be stopping at a particular executed instruction.
while (program_counter != end_sim_pc) {
- Instr* instr = reinterpret_cast<Instr*>(program_counter);
+ if (thumb_mode_) {
+ ThumbInstr* instr = reinterpret_cast<ThumbInstr*>(program_counter);
+ InstructionDecode(instr);
+ } else {
+ Instr* instr = reinterpret_cast<Instr*>(program_counter);
+ InstructionDecode(instr);
+ }
icount_++;
- InstructionDecode(instr);
program_counter = get_pc();
}
} else {
« src/arm/assembler-thumb2.cc ('K') | « src/arm/simulator-arm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698