Index: runtime/vm/instructions_mips.cc |
=================================================================== |
--- runtime/vm/instructions_mips.cc (revision 24063) |
+++ runtime/vm/instructions_mips.cc (working copy) |
@@ -6,6 +6,7 @@ |
#if defined(TARGET_ARCH_MIPS) |
#include "vm/constants_mips.h" |
+#include "vm/cpu.h" |
#include "vm/instructions.h" |
#include "vm/object.h" |
@@ -158,6 +159,24 @@ |
} |
+void CallPattern::InsertAt(uword pc, uword target_address) { |
+ Instr* lui = Instr::At(pc + (0 * Instr::kInstrSize)); |
+ Instr* ori = Instr::At(pc + (1 * Instr::kInstrSize)); |
+ Instr* jr = Instr::At(pc + (2 * Instr::kInstrSize)); |
+ Instr* nop = Instr::At(pc + (3 * Instr::kInstrSize)); |
+ uint16_t target_lo = target_address & 0xffff; |
+ uint16_t target_hi = target_address >> 16; |
+ |
+ lui->SetImmInstrBits(LUI, ZR, TMP1, target_hi); |
+ ori->SetImmInstrBits(ORI, TMP1, TMP1, target_lo); |
+ jr->SetSpecialInstrBits(JALR, TMP1, ZR, RA); |
+ nop->SetInstructionBits(Instr::kNopInstruction); |
+ |
+ ASSERT(kFixedLengthInBytes == 4 * Instr::kInstrSize); |
+ CPU::FlushICache(pc, kFixedLengthInBytes); |
+} |
+ |
+ |
JumpPattern::JumpPattern(uword pc) : pc_(pc) { } |