1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4//
5
6//
7// EXCEPCPU.H -
8//
9// This header file is included from Excep.h if the target platform is AMD64
10//
11
12
13#ifndef __excepamd64_h__
14#define __excepamd64_h__
15
16#include "corerror.h" // HResults for the COM+ Runtime
17
18#include "../dlls/mscorrc/resource.h"
19
20class FaultingExceptionFrame;
21
22
23#define THROW_CONTROL_FOR_THREAD_FUNCTION RedirectForThrowControl
24
25EXTERN_C void RedirectForThrowControl();
26
27#define STATUS_CLR_GCCOVER_CODE STATUS_PRIVILEGED_INSTRUCTION
28
29//
30// No FS:0, nothing to do.
31//
32#define INSTALL_EXCEPTION_HANDLING_RECORD(record)
33#define UNINSTALL_EXCEPTION_HANDLING_RECORD(record)
34
35//
36// On Win64, the COMPlusFrameHandler's work is done by our personality routine.
37//
38#define DECLARE_CPFH_EH_RECORD(pCurThread)
39
40//
41// Retrieves the redirected CONTEXT* from the stack frame of one of the
42// RedirectedHandledJITCaseForXXX_Stub's.
43//
44PTR_CONTEXT GetCONTEXTFromRedirectedStubStackFrame(DISPATCHER_CONTEXT * pDispatcherContext);
45PTR_CONTEXT GetCONTEXTFromRedirectedStubStackFrame(CONTEXT * pContext);
46
47//
48// Retrieves the FaultingExceptionFrame* from the stack frame of
49// RedirectForThrowControl or NakedThrowHelper.
50//
51FaultingExceptionFrame *GetFrameFromRedirectedStubStackFrame (DISPATCHER_CONTEXT *pDispatcherContext);
52
53//
54// Functions that wrap RtlVirtualUnwind to make sure that in the AMD64 case all the
55// breakpoints have been removed from the Epilogue if RtlVirtualUnwind is going to
56// try and disassemble it.
57//
58#if !defined(DACCESS_COMPILE)
59UCHAR GetOpcodeFromManagedBPForAddress(ULONG64 Address, BOOL* HasManagedBreakpoint, BOOL* HasUnmanagedBreakpoint);
60
61#define RtlVirtualUnwind RtlVirtualUnwind_Wrapper
62
63PEXCEPTION_ROUTINE
64RtlVirtualUnwind (
65 IN ULONG HandlerType,
66 IN ULONG64 ImageBase,
67 IN ULONG64 ControlPc,
68 IN PT_RUNTIME_FUNCTION FunctionEntry,
69 IN OUT PCONTEXT ContextRecord,
70 OUT PVOID *HandlerData,
71 OUT PULONG64 EstablisherFrame,
72 IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL
73 );
74
75PEXCEPTION_ROUTINE
76RtlVirtualUnwind_Worker (
77 IN ULONG HandlerType,
78 IN ULONG64 ImageBase,
79 IN ULONG64 ControlPc,
80 IN PT_RUNTIME_FUNCTION FunctionEntry,
81 IN OUT PCONTEXT ContextRecord,
82 OUT PVOID *HandlerData,
83 OUT PULONG64 EstablisherFrame,
84 IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL
85 );
86#endif // !DACCESS_COMPILE
87
88BOOL AdjustContextForVirtualStub(EXCEPTION_RECORD *pExceptionRecord, CONTEXT *pContext);
89
90#endif // __excepamd64_h__
91
92