diff options
| author | 2014-06-17 15:52:45 +0200 | |
|---|---|---|
| committer | 2014-06-17 16:00:54 +0200 | |
| commit | 0bcb2902ec21393d71c94e63aa6733cb5311a0cc (patch) | |
| tree | 10beb60b5a8d212afdf0e7e58c5dfcbee691be2e /runtime/arch/x86/context_x86.h | |
| parent | 838b38fa3b2fb4a64f8a316459d372020f6e8feb (diff) | |
Revert "Revert "Fix access to FP registers when visiting stack""
This reverts commit 8ebd94ab2e0d9867a7d384f00fa4cab24235216f.
Fixes StackVisitor::GetVReg to read register value in a uintptr_t local and
cast it into uint32_t pointer argument.
Bug: 15433097
Change-Id: I4e13ed5446e823e9ec50fbc378b16be5b17b2294
Diffstat (limited to 'runtime/arch/x86/context_x86.h')
| -rw-r--r-- | runtime/arch/x86/context_x86.h | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/runtime/arch/x86/context_x86.h b/runtime/arch/x86/context_x86.h index 1c510265f9..a350b2500f 100644 --- a/runtime/arch/x86/context_x86.h +++ b/runtime/arch/x86/context_x86.h @@ -31,32 +31,49 @@ class X86Context : public Context { } virtual ~X86Context() {} - virtual void Reset(); + void Reset() OVERRIDE; - virtual void FillCalleeSaves(const StackVisitor& fr) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + void FillCalleeSaves(const StackVisitor& fr) OVERRIDE SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); - virtual void SetSP(uintptr_t new_sp) { - SetGPR(ESP, new_sp); + void SetSP(uintptr_t new_sp) OVERRIDE { + bool success = SetGPR(ESP, new_sp); + CHECK(success) << "Failed to set ESP register"; } - virtual void SetPC(uintptr_t new_pc) { + void SetPC(uintptr_t new_pc) OVERRIDE { eip_ = new_pc; } - virtual uintptr_t* GetGPRAddress(uint32_t reg) { + uintptr_t* GetGPRAddress(uint32_t reg) OVERRIDE { DCHECK_LT(reg, static_cast<uint32_t>(kNumberOfCpuRegisters)); return gprs_[reg]; } - virtual uintptr_t GetGPR(uint32_t reg) { + bool GetGPR(uint32_t reg, uintptr_t* val) OVERRIDE { DCHECK_LT(reg, static_cast<uint32_t>(kNumberOfCpuRegisters)); - return *gprs_[reg]; + if (gprs_[reg] == nullptr) { + return false; + } else { + DCHECK(val != nullptr); + *val = *gprs_[reg]; + return true; + } } - virtual void SetGPR(uint32_t reg, uintptr_t value); + bool SetGPR(uint32_t reg, uintptr_t value) OVERRIDE; - virtual void SmashCallerSaves(); - virtual void DoLongJump(); + bool GetFPR(uint32_t reg, uintptr_t* val) OVERRIDE { + LOG(FATAL) << "Floating-point registers are all caller save in X86"; + return false; + } + + bool SetFPR(uint32_t reg, uintptr_t value) OVERRIDE { + LOG(FATAL) << "Floating-point registers are all caller save in X86"; + return false; + } + + void SmashCallerSaves() OVERRIDE; + void DoLongJump() OVERRIDE; private: // Pointers to register locations, floating point registers are all caller save. Values are |