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

Unified Diff: runtime/vm/code_patcher_arm64.cc

Issue 274043003: Adds debugger patching to arm64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 months 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
« no previous file with comments | « runtime/vm/benchmark_test.cc ('k') | runtime/vm/constants_arm64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_patcher_arm64.cc
===================================================================
--- runtime/vm/code_patcher_arm64.cc (revision 35975)
+++ runtime/vm/code_patcher_arm64.cc (working copy)
@@ -6,7 +6,7 @@
#if defined(TARGET_ARCH_ARM64)
#include "vm/code_patcher.h"
-
+#include "vm/cpu.h"
#include "vm/instructions.h"
#include "vm/object.h"
@@ -46,16 +46,43 @@
}
+class PoolPointerCall : public ValueObject {
+ public:
+ explicit PoolPointerCall(uword pc) : end_(pc) {
+ // Last instruction: blr ip0.
+ ASSERT(*(reinterpret_cast<uint32_t*>(end_) - 1) == 0xd63f0200);
+ InstructionPattern::DecodeLoadWordFromPool(
+ end_ - Instr::kInstrSize, &reg_, &index_);
+ }
+
+ int32_t pp_offset() const {
+ return InstructionPattern::OffsetFromPPIndex(index_);
+ }
+
+ void set_pp_offset(int32_t offset) const {
+ InstructionPattern::EncodeLoadWordFromPoolFixed(
+ end_ - Instr::kInstrSize, offset);
+ CPU::FlushICache(end_ - kCallPatternSize, kCallPatternSize);
+ }
+
+ private:
+ static const int kCallPatternSize = 3 * Instr::kInstrSize;
+ uword end_;
+ Register reg_;
+ intptr_t index_;
+ DISALLOW_IMPLICIT_CONSTRUCTORS(PoolPointerCall);
+};
+
+
int32_t CodePatcher::GetPoolOffsetAt(uword return_address) {
- // TODO(zra): Needed for debugger.
- UNIMPLEMENTED();
- return 0;
+ PoolPointerCall call(return_address);
+ return call.pp_offset();
}
void CodePatcher::SetPoolOffsetAt(uword return_address, int32_t offset) {
- // TODO(zra): Needed for debugger.
- UNIMPLEMENTED();
+ PoolPointerCall call(return_address);
+ call.set_pp_offset(offset);
}
« no previous file with comments | « runtime/vm/benchmark_test.cc ('k') | runtime/vm/constants_arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698