diff options
author | Tomas Rylek <trylek@microsoft.com> | 2017-06-13 03:17:17 +0300 |
---|---|---|
committer | Tomas Rylek <trylek@microsoft.com> | 2017-06-13 03:17:17 +0300 |
commit | 7af7188d9eba6d062bb43b64717b713699ed7aec (patch) | |
tree | 40cd76bc614e51491dc3d1b2f65f2349764215cd /src/Native/Runtime/amd64 | |
parent | 4656e2e04365746b8c214fec738fc2d5ab405448 (diff) |
Unify StackFrameIterator behavior w.r.t. various special addresses within MRT helpers
This change unifies StackFrameIterator behavior w.r.t. to special handling of various internal addresses within MRT helpers to the way I fixed this before for the UniversalTransitionThunk i.e. instead of exporting a public symbol in the middle of the method which is known to confuse the DIA stack unwinder, we export the pointer by means of an auxiliary data variable.
[tfs-changeset: 1661485]
Diffstat (limited to 'src/Native/Runtime/amd64')
-rw-r--r-- | src/Native/Runtime/amd64/AsmMacros.inc | 18 | ||||
-rw-r--r-- | src/Native/Runtime/amd64/CallDescrWorker.S | 12 | ||||
-rw-r--r-- | src/Native/Runtime/amd64/CallDescrWorker.asm | 12 | ||||
-rw-r--r-- | src/Native/Runtime/amd64/ExceptionHandling.S | 18 | ||||
-rw-r--r-- | src/Native/Runtime/amd64/ExceptionHandling.asm | 20 | ||||
-rw-r--r-- | src/Native/Runtime/amd64/UniversalTransition.S | 11 | ||||
-rw-r--r-- | src/Native/Runtime/amd64/UniversalTransition.asm | 14 |
7 files changed, 47 insertions, 58 deletions
diff --git a/src/Native/Runtime/amd64/AsmMacros.inc b/src/Native/Runtime/amd64/AsmMacros.inc index 4cecf334b..b9835375b 100644 --- a/src/Native/Runtime/amd64/AsmMacros.inc +++ b/src/Native/Runtime/amd64/AsmMacros.inc @@ -215,6 +215,24 @@ Name label proc PUBLIC Name endm +EXPORT_POINTER_TO_ADDRESS macro Name + + local AddressToExport + +AddressToExport label proc + + .const + + align 8 + +Name dq offset AddressToExport + + public Name + + .code + + endm + _tls_array equ 58h ;; offsetof(TEB, ThreadLocalStoragePointer) ;; diff --git a/src/Native/Runtime/amd64/CallDescrWorker.S b/src/Native/Runtime/amd64/CallDescrWorker.S index 6a980b394..a3879d517 100644 --- a/src/Native/Runtime/amd64/CallDescrWorker.S +++ b/src/Native/Runtime/amd64/CallDescrWorker.S @@ -6,17 +6,9 @@ #include <unixasmmacros.inc> NESTED_ENTRY RhCallDescrWorker, _TEXT, NoHandler -LOCAL_LABEL(ReturnFromCallDescrThunk): + + EXPORT_POINTER_TO_ADDRESS PointerToReturnFromCallDescrThunk // UNIXTODO: Implement this function int 3 NESTED_END RhCallDescrWorker, _TEXT - - .text - - .align 8 - -C_FUNC(PointerToReturnFromCallDescrThunk): - .quad LOCAL_LABEL(ReturnFromCallDescrThunk) - - .global C_FUNC(PointerToReturnFromCallDescrThunk) diff --git a/src/Native/Runtime/amd64/CallDescrWorker.asm b/src/Native/Runtime/amd64/CallDescrWorker.asm index a0d07ea45..59d4fb916 100644 --- a/src/Native/Runtime/amd64/CallDescrWorker.asm +++ b/src/Native/Runtime/amd64/CallDescrWorker.asm @@ -57,7 +57,7 @@ StackCopyLoop: ; copy the arguments to stack top-down t DoCall: call qword ptr [rbx + OFFSETOF__CallDescrData__pTarget] ; call target function -ReturnFromCallDescrThunk label proc + EXPORT_POINTER_TO_ADDRESS PointerToReturnFromCallDescrThunk ; Symbol used to identify thunk call to managed function so the special ; case unwinder can unwind through this function. Sadly we cannot directly @@ -103,14 +103,4 @@ ReturnsDouble: NESTED_END RhCallDescrWorker, _TEXT - .const - - align 8 - -PointerToReturnFromCallDescrThunk label qword - - dq offset ReturnFromCallDescrThunk - - public PointerToReturnFromCallDescrThunk - end diff --git a/src/Native/Runtime/amd64/ExceptionHandling.S b/src/Native/Runtime/amd64/ExceptionHandling.S index aa1a59df1..b9478f0a0 100644 --- a/src/Native/Runtime/amd64/ExceptionHandling.S +++ b/src/Native/Runtime/amd64/ExceptionHandling.S @@ -70,7 +70,8 @@ NESTED_ENTRY RhpThrowHwEx, _TEXT, NoHandler // rdi still contains the exception code // rsi contains the address of the ExInfo call C_FUNC(RhThrowHwEx) -ALTERNATE_ENTRY RhpThrowHwEx2 + + EXPORT_POINTER_TO_ADDRESS PointerToRhpThrowHwEx2 // no return int 3 @@ -150,7 +151,8 @@ NESTED_ENTRY RhpThrowEx, _TEXT, NoHandler // rdi still contains the exception object // rsi contains the address of the ExInfo call C_FUNC(RhThrowEx) -ALTERNATE_ENTRY RhpThrowEx2 + + EXPORT_POINTER_TO_ADDRESS PointerToRhpThrowEx2 // no return int 3 @@ -219,7 +221,8 @@ NESTED_ENTRY RhpRethrow, _TEXT, NoHandler // rdi contains the currently active ExInfo // rsi contains the address of the new ExInfo call C_FUNC(RhRethrow) -ALTERNATE_ENTRY RhpRethrow2 + + EXPORT_POINTER_TO_ADDRESS PointerToRhpRethrow2 // no return int 3 @@ -330,7 +333,8 @@ NESTED_ENTRY RhpCallCatchFunclet, _TEXT, NoHandler mov rdi, [rdx + OFFSETOF__REGDISPLAY__SP] // rdi <- establisher frame mov rsi, [rsp + locArg0] // rsi <- exception object call qword ptr [rsp + locArg1] // call handler funclet -ALTERNATE_ENTRY RhpCallCatchFunclet2 + + EXPORT_POINTER_TO_ADDRESS PointerToRhpCallCatchFunclet2 mov rdx, [rsp + locArg2] // rdx <- dispatch context @@ -468,7 +472,8 @@ NESTED_ENTRY RhpCallFinallyFunclet, _TEXT, NoHandler mov rdi, [rsi + OFFSETOF__REGDISPLAY__SP] // rdi <- establisher frame call qword ptr [rsp + locArg0] // handler funclet address -ALTERNATE_ENTRY RhpCallFinallyFunclet2 + + EXPORT_POINTER_TO_ADDRESS PointerToRhpCallFinallyFunclet2 mov rsi, [rsp + locArg1] // rsi <- regdisplay @@ -517,7 +522,8 @@ NESTED_ENTRY RhpCallFilterFunclet, _TEXT, NoHandler mov rsi, rdi // rsi <- exception object mov rdi, [rdx + OFFSETOF__REGDISPLAY__SP] // rdi <- establisher frame call rax -ALTERNATE_ENTRY RhpCallFilterFunclet2 + + EXPORT_POINTER_TO_ADDRESS PointerToRhpCallFilterFunclet2 // RAX contains the result of the filter execution diff --git a/src/Native/Runtime/amd64/ExceptionHandling.asm b/src/Native/Runtime/amd64/ExceptionHandling.asm index a8ba9ef77..ccea8d02d 100644 --- a/src/Native/Runtime/amd64/ExceptionHandling.asm +++ b/src/Native/Runtime/amd64/ExceptionHandling.asm @@ -92,14 +92,14 @@ NESTED_ENTRY RhpThrowHwEx, _TEXT ;; rcx still contains the exception code ;; rdx contains the address of the ExInfo call RhThrowHwEx -ALTERNATE_ENTRY RhpThrowHwEx2 + + EXPORT_POINTER_TO_ADDRESS PointerToRhpThrowHwEx2 ;; no return int 3 NESTED_END RhpThrowHwEx, _TEXT - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; RhpThrowEx @@ -184,7 +184,8 @@ NESTED_ENTRY RhpThrowEx, _TEXT ;; rcx still contains the exception object ;; rdx contains the address of the ExInfo call RhThrowEx -ALTERNATE_ENTRY RhpThrowEx2 + + EXPORT_POINTER_TO_ADDRESS PointerToRhpThrowEx2 ;; no return int 3 @@ -267,7 +268,8 @@ NESTED_ENTRY RhpRethrow, _TEXT ;; rcx contains the currently active ExInfo ;; rdx contains the address of the new ExInfo call RhRethrow -ALTERNATE_ENTRY RhpRethrow2 + + EXPORT_POINTER_TO_ADDRESS PointerToRhpRethrow2 ;; no return int 3 @@ -425,7 +427,8 @@ else mov rcx, [rsp + rsp_offsetof_arguments + 0h] ;; rcx <- exception object endif call qword ptr [rsp + rsp_offsetof_arguments + 8h] ;; call handler funclet -ALTERNATE_ENTRY RhpCallCatchFunclet2 + + EXPORT_POINTER_TO_ADDRESS PointerToRhpCallCatchFunclet2 mov r8, [rsp + rsp_offsetof_arguments + 10h] ;; r8 <- dispatch context @@ -584,7 +587,8 @@ endif mov rcx, [rdx + OFFSETOF__REGDISPLAY__SP] ;; rcx <- establisher frame call qword ptr [rsp + rsp_offsetof_arguments + 0h] ;; handler funclet address -ALTERNATE_ENTRY RhpCallFinallyFunclet2 + + EXPORT_POINTER_TO_ADDRESS PointerToRhpCallFinallyFunclet2 mov rdx, [rsp + rsp_offsetof_arguments + 8h] ;; rdx <- regdisplay @@ -626,7 +630,6 @@ ALTERNATE_ENTRY RhpCallFinallyFunclet2 NESTED_END RhpCallFinallyFunclet, _TEXT - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; void* FASTCALL RhpCallFilterFunclet(RtuObjectRef exceptionObj, void* pFilterIP, REGDISPLAY* pRegDisplay) @@ -653,7 +656,8 @@ else ;; RCX still contains the exception object endif call rax -ALTERNATE_ENTRY RhpCallFilterFunclet2 + + EXPORT_POINTER_TO_ADDRESS PointerToRhpCallFilterFunclet2 ;; RAX contains the result of the filter execution diff --git a/src/Native/Runtime/amd64/UniversalTransition.S b/src/Native/Runtime/amd64/UniversalTransition.S index cf421c630..0f4d0b3ef 100644 --- a/src/Native/Runtime/amd64/UniversalTransition.S +++ b/src/Native/Runtime/amd64/UniversalTransition.S @@ -125,7 +125,7 @@ NESTED_ENTRY Rhp\FunctionName, _TEXT, NoHandler lea rdi, [rsp + DISTANCE_FROM_CHILDSP_TO_RETURN_BLOCK] call r10 -LOCAL_LABEL(ReturnFrom\FunctionName): + EXPORT_POINTER_TO_ADDRESS PointerToReturnFrom\FunctionName // restore fp argument registers movdqa xmm0, [rsp + DISTANCE_FROM_CHILDSP_TO_FP_REGS + 0x00] @@ -152,15 +152,6 @@ LOCAL_LABEL(ReturnFrom\FunctionName): NESTED_END Rhp\FunctionName, _TEXT - .text - - .align 8 - -C_FUNC(PointerToReturnFrom\FunctionName): - .quad LOCAL_LABEL(ReturnFrom\FunctionName) - - .global C_FUNC(PointerToReturnFrom\FunctionName) - .endm // UNIVERSAL_TRANSITION // To enable proper step-in behavior in the debugger, we need to have two instances diff --git a/src/Native/Runtime/amd64/UniversalTransition.asm b/src/Native/Runtime/amd64/UniversalTransition.asm index 83aebaf6d..b582c9729 100644 --- a/src/Native/Runtime/amd64/UniversalTransition.asm +++ b/src/Native/Runtime/amd64/UniversalTransition.asm @@ -127,7 +127,7 @@ endif ; TRASH_SAVED_ARGUMENT_REGISTERS lea rcx, [rsp + DISTANCE_FROM_CHILDSP_TO_RETURN_BLOCK] call r10 -ReturnFrom&FunctionName label proc + EXPORT_POINTER_TO_ADDRESS PointerToReturnFrom&FunctionName ; We cannot make the label public as that tricks DIA stackwalker into thinking ; it's the beginning of a method. For this reason we export the address @@ -155,18 +155,6 @@ ReturnFrom&FunctionName label proc NESTED_END Rhp&FunctionName, _TEXT - .const - - align 8 - -PointerToReturnFrom&FunctionName label qword - - dq offset ReturnFrom&FunctionName - - public PointerToReturnFrom&FunctionName - - .code - endm ; To enable proper step-in behavior in the debugger, we need to have two instances |