summaryrefslogtreecommitdiff
path: root/src/vm
diff options
context:
space:
mode:
authorRama Krishnan Raghupathy <ramarag@microsoft.com>2016-07-18 19:40:05 -0700
committerRama Krishnan Raghupathy <ramarag@microsoft.com>2016-07-25 18:42:30 -0700
commit00e3695c1b51248f58f6b7e1f24f83a791a3b79e (patch)
tree1af2da04bf3816d3a6172b52a84201387a5e2673 /src/vm
parentc358f77a1ddcf31475450c40af64ad115259e622 (diff)
downloadcoreclr-00e3695c1b51248f58f6b7e1f24f83a791a3b79e.tar.gz
coreclr-00e3695c1b51248f58f6b7e1f24f83a791a3b79e.tar.bz2
coreclr-00e3695c1b51248f58f6b7e1f24f83a791a3b79e.zip
Arm64: Debugger
Instruction emulation for Break Points Debugger::FuncEvalSetup NativeWalker ExceptionHijack Exception intercept Managed Return Value
Diffstat (limited to 'src/vm')
-rw-r--r--src/vm/arm64/cgencpu.h63
-rw-r--r--src/vm/arm64/stubs.cpp17
-rw-r--r--src/vm/exceptionhandling.cpp3
-rw-r--r--src/vm/stubmgr.cpp12
-rw-r--r--src/vm/stubmgr.h2
-rw-r--r--src/vm/util.cpp40
6 files changed, 116 insertions, 21 deletions
diff --git a/src/vm/arm64/cgencpu.h b/src/vm/arm64/cgencpu.h
index 4929cd1dc9..53079352cb 100644
--- a/src/vm/arm64/cgencpu.h
+++ b/src/vm/arm64/cgencpu.h
@@ -153,9 +153,34 @@ inline TADDR GetSP(const T_CONTEXT * context) {
return TADDR(context->Sp);
}
-inline PCODE GetLR(const T_CONTEXT * context) {
+inline TADDR GetLR(const T_CONTEXT * context) {
LIMITED_METHOD_DAC_CONTRACT;
- return PCODE(context->Lr);
+ return context->Lr;
+}
+
+inline void SetLR( T_CONTEXT * context, TADDR eip) {
+ LIMITED_METHOD_DAC_CONTRACT;
+ context->Lr = eip;
+}
+
+inline TADDR GetReg(T_CONTEXT * context, int Regnum)
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+ _ASSERTE(Regnum >= 0 && Regnum < 32 );
+ return context->X[Regnum];
+}
+
+inline void SetReg(T_CONTEXT * context, int Regnum, PCODE RegContent)
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+ _ASSERTE(Regnum >= 0 && Regnum <=28 );
+ context->X[Regnum] = RegContent;
+}
+inline void SetSimdReg(T_CONTEXT * context, int Regnum, NEON128 RegContent)
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+ _ASSERTE(Regnum >= 0 && Regnum <= 28);
+ context->V[Regnum] = RegContent;
}
extern "C" LPVOID __stdcall GetCurrentSP();
@@ -176,6 +201,40 @@ inline TADDR GetFP(const T_CONTEXT * context)
return (TADDR)(context->Fp);
}
+inline NEON128 GetSimdMem(PCODE ip)
+{
+ NEON128 mem;
+ LIMITED_METHOD_DAC_CONTRACT;
+ EX_TRY
+ {
+ mem.Low = dac_cast<PCODE>(ip);
+ mem.High = dac_cast<PCODE>(ip + sizeof(PCODE));
+ }
+ EX_CATCH
+ {
+ _ASSERTE(!"Memory read within jitted Code Failed, this should not happen!!!!");
+ }
+ EX_END_CATCH(SwallowAllExceptions);
+
+ return mem;
+}
+inline TADDR GetMem(PCODE ip)
+{
+ TADDR mem;
+ LIMITED_METHOD_DAC_CONTRACT;
+ EX_TRY
+ {
+ mem = dac_cast<TADDR>(ip);
+ }
+ EX_CATCH
+ {
+ _ASSERTE(!"Memory read within jitted Code Failed, this should not happen!!!!");
+ }
+ EX_END_CATCH(SwallowAllExceptions);
+ return mem;
+}
+
+
#ifdef FEATURE_COMINTEROP
void emitCOMStubCall (ComCallMethodDesc *pCOMMethod, PCODE target);
#endif // FEATURE_COMINTEROP
diff --git a/src/vm/arm64/stubs.cpp b/src/vm/arm64/stubs.cpp
index bb2a6cf256..7db8a31f20 100644
--- a/src/vm/arm64/stubs.cpp
+++ b/src/vm/arm64/stubs.cpp
@@ -1051,23 +1051,6 @@ AdjustContextForVirtualStub(
}
#endif // !(DACCESS_COMPILE && CROSSGEN_COMPILE)
-extern "C" {
-
-void FuncEvalHijack(void)
-{
- _ASSERTE(!"ARM64:NYI");
-}
-
-void ExceptionHijack(void)
-{
- _ASSERTE(!"ARM64:NYI");
-}
-void ExceptionHijackEnd(void)
-{
- _ASSERTE(!"ARM64:NYI");
-}
-};
-
#ifdef FEATURE_COMINTEROP
extern "C" void GenericComPlusCallStub(void)
{
diff --git a/src/vm/exceptionhandling.cpp b/src/vm/exceptionhandling.cpp
index a99a20b312..e59f10e070 100644
--- a/src/vm/exceptionhandling.cpp
+++ b/src/vm/exceptionhandling.cpp
@@ -2457,7 +2457,7 @@ CLRUnwindStatus ExceptionTracker::ProcessManagedCallFrame(
PTR_EXCEPTION_CLAUSE_TOKEN pLimitClauseToken = NULL;
if (!fIgnoreThisFrame && !fIsFirstPass && !m_sfResumeStackFrame.IsNull() && (sf >= m_sfResumeStackFrame))
{
- CONSISTENCY_CHECK_MSG(sf == m_sfResumeStackFrame, "Passed initial resume frame and fIgnoreThisFrame wasn't set!");
+ EH_LOG((LL_INFO100, " RESUMEFRAME: sf is %p and m_sfResumeStackFrame: %p\n", sf.SP, m_sfResumeStackFrame.SP));
EH_LOG((LL_INFO100, " RESUMEFRAME: %s initial resume frame: %p\n", (sf == m_sfResumeStackFrame) ? "REACHED" : "PASSED" , m_sfResumeStackFrame.SP));
// process this frame to call handlers
@@ -2469,6 +2469,7 @@ CLRUnwindStatus ExceptionTracker::ProcessManagedCallFrame(
// as the last clause we process in the "inital resume frame". Anything further
// down the list of clauses is skipped along with all call frames up to the actual
// resume frame.
+ CONSISTENCY_CHECK_MSG(sf == m_sfResumeStackFrame, "Passed initial resume frame and fIgnoreThisFrame wasn't set!");
}
//
// END resume frame code
diff --git a/src/vm/stubmgr.cpp b/src/vm/stubmgr.cpp
index d648262078..39f4c25a7d 100644
--- a/src/vm/stubmgr.cpp
+++ b/src/vm/stubmgr.cpp
@@ -2313,6 +2313,18 @@ BOOL DelegateInvokeStubManager::TraceManager(Thread *thread, TraceDestination *t
else
offsetOfNextDest = DelegateObject::GetOffsetOfMethodPtrAux();
destAddr = *(PCODE*)(pThis + offsetOfNextDest);
+#elif defined(_TARGET_ARM64_)
+ (*pRetAddr) = (BYTE *)(size_t)(pContext->Lr);
+ pThis = (BYTE*)(size_t)(pContext->X0);
+
+ // Could be in the singlecast invoke stub (in which case the next destination is in _methodPtr) or a
+ // shuffle thunk (destination in _methodPtrAux).
+ int offsetOfNextDest;
+ if (pc == GetEEFuncEntryPoint(SinglecastDelegateInvokeStub))
+ offsetOfNextDest = DelegateObject::GetOffsetOfMethodPtr();
+ else
+ offsetOfNextDest = DelegateObject::GetOffsetOfMethodPtrAux();
+ destAddr = *(PCODE*)(pThis + offsetOfNextDest);
#else
PORTABILITY_ASSERT("DelegateInvokeStubManager::TraceManager");
destAddr = NULL;
diff --git a/src/vm/stubmgr.h b/src/vm/stubmgr.h
index eecd616b7a..f0098c9d55 100644
--- a/src/vm/stubmgr.h
+++ b/src/vm/stubmgr.h
@@ -933,7 +933,7 @@ public:
#elif defined(_TARGET_ARM_)
return pContext->R12;
#elif defined(_TARGET_ARM64_)
- return pContext->X15;
+ return pContext->X12;
#else
PORTABILITY_ASSERT("StubManagerHelpers::GetHiddenArg");
return NULL;
diff --git a/src/vm/util.cpp b/src/vm/util.cpp
index 7a05624113..f7185c744f 100644
--- a/src/vm/util.cpp
+++ b/src/vm/util.cpp
@@ -739,6 +739,46 @@ SIZE_T GetRegOffsInCONTEXT(ICorDebugInfo::RegNum regNum)
case ICorDebugInfo::REGNUM_AMBIENT_SP: return offsetof(T_CONTEXT, Sp);
default: _ASSERTE(!"Bad regNum"); return (SIZE_T)(-1);
}
+#elif defined(_TARGET_ARM64_)
+
+ switch(regNum)
+ {
+ case ICorDebugInfo::REGNUM_X0: return offsetof(T_CONTEXT, X0);
+ case ICorDebugInfo::REGNUM_X1: return offsetof(T_CONTEXT, X1);
+ case ICorDebugInfo::REGNUM_X2: return offsetof(T_CONTEXT, X2);
+ case ICorDebugInfo::REGNUM_X3: return offsetof(T_CONTEXT, X3);
+ case ICorDebugInfo::REGNUM_X4: return offsetof(T_CONTEXT, X4);
+ case ICorDebugInfo::REGNUM_X5: return offsetof(T_CONTEXT, X5);
+ case ICorDebugInfo::REGNUM_X6: return offsetof(T_CONTEXT, X6);
+ case ICorDebugInfo::REGNUM_X7: return offsetof(T_CONTEXT, X7);
+ case ICorDebugInfo::REGNUM_X8: return offsetof(T_CONTEXT, X8);
+ case ICorDebugInfo::REGNUM_X9: return offsetof(T_CONTEXT, X9);
+ case ICorDebugInfo::REGNUM_X10: return offsetof(T_CONTEXT, X10);
+ case ICorDebugInfo::REGNUM_X11: return offsetof(T_CONTEXT, X11);
+ case ICorDebugInfo::REGNUM_X12: return offsetof(T_CONTEXT, X12);
+ case ICorDebugInfo::REGNUM_X13: return offsetof(T_CONTEXT, X13);
+ case ICorDebugInfo::REGNUM_X14: return offsetof(T_CONTEXT, X14);
+ case ICorDebugInfo::REGNUM_X15: return offsetof(T_CONTEXT, X15);
+ case ICorDebugInfo::REGNUM_X16: return offsetof(T_CONTEXT, X16);
+ case ICorDebugInfo::REGNUM_X17: return offsetof(T_CONTEXT, X17);
+ case ICorDebugInfo::REGNUM_X18: return offsetof(T_CONTEXT, X18);
+ case ICorDebugInfo::REGNUM_X19: return offsetof(T_CONTEXT, X19);
+ case ICorDebugInfo::REGNUM_X20: return offsetof(T_CONTEXT, X20);
+ case ICorDebugInfo::REGNUM_X21: return offsetof(T_CONTEXT, X21);
+ case ICorDebugInfo::REGNUM_X22: return offsetof(T_CONTEXT, X22);
+ case ICorDebugInfo::REGNUM_X23: return offsetof(T_CONTEXT, X23);
+ case ICorDebugInfo::REGNUM_X24: return offsetof(T_CONTEXT, X24);
+ case ICorDebugInfo::REGNUM_X25: return offsetof(T_CONTEXT, X25);
+ case ICorDebugInfo::REGNUM_X26: return offsetof(T_CONTEXT, X26);
+ case ICorDebugInfo::REGNUM_X27: return offsetof(T_CONTEXT, X27);
+ case ICorDebugInfo::REGNUM_X28: return offsetof(T_CONTEXT, X28);
+ case ICorDebugInfo::REGNUM_FP: return offsetof(T_CONTEXT, Fp);
+ case ICorDebugInfo::REGNUM_LR: return offsetof(T_CONTEXT, Lr);
+ case ICorDebugInfo::REGNUM_SP: return offsetof(T_CONTEXT, Sp);
+ case ICorDebugInfo::REGNUM_PC: return offsetof(T_CONTEXT, Pc);
+ case ICorDebugInfo::REGNUM_AMBIENT_SP: return offsetof(T_CONTEXT, Sp);
+ default: _ASSERTE(!"Bad regNum"); return (SIZE_T)(-1);
+ }
#else
PORTABILITY_ASSERT("GetRegOffsInCONTEXT is not implemented on this platform.");
return (SIZE_T) -1;