Changeset 96559 in vbox for trunk/src/VBox
- Timestamp:
- Aug 31, 2022 1:20:39 AM (2 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 1 added
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r96542 r96559 2121 2121 common/compiler/vcc/guard-vcc.asm \ 2122 2122 common/compiler/vcc/stack-vcc.asm \ 2123 common/compiler/vcc/stack-except-vcc.cpp 2123 common/compiler/vcc/stack-except-vcc.cpp \ 2124 common/compiler/vcc/stack-except-seh-vcc.cpp \ 2125 common/compiler/vcc/except-seh-vcc.cpp 2124 2126 RuntimeR3_SOURCES.win.x86 = $(RuntimeBaseR3_SOURCES.win.x86) \ 2125 2127 r3/win/nocrt-atexit-win.asm \ -
trunk/src/VBox/Runtime/common/compiler/vcc/except-vcc.h
r96420 r96559 41 41 #endif 42 42 43 #define __C_specific_handler their___C_specific_handler 44 #include <iprt/win/windows.h> 45 #undef __C_specific_handler 43 46 44 47 #include <iprt/types.h> 45 48 #include <iprt/assertcompile.h> 49 50 51 RT_C_DECLS_BEGIN 46 52 47 53 #if 0 … … 128 134 { 129 135 uint32_t fEHandler : 1; 130 #define GS_HANDLER_OFF_COOKIE_IS_EHANDLER RT_BIT(0) 136 #define GS_HANDLER_OFF_COOKIE_IS_EHANDLER RT_BIT(0) /**< Handles exceptions. */ 131 137 uint32_t fUHandler : 1; 132 #define GS_HANDLER_OFF_COOKIE_IS_UHANDLER RT_BIT(1) 138 #define GS_HANDLER_OFF_COOKIE_IS_UHANDLER RT_BIT(1) /**< Handles unwind. */ 133 139 uint32_t fHasAlignment : 1; 134 #define GS_HANDLER_OFF_COOKIE_HAS_ALIGNMENT RT_BIT(2) 140 #define GS_HANDLER_OFF_COOKIE_HAS_ALIGNMENT RT_BIT(2) /**< Has the uAlignmentMask member. */ 135 141 } Bits; 136 142 #define GS_HANDLER_OFF_COOKIE_MASK UINT32_C(0xfffffff8) /**< Mask to apply to offCookie to the the value. */ … … 138 144 } u; 139 145 int32_t offAlignedBase; 146 /** This field is only there when GS_HANDLER_OFF_COOKIE_HAS_ALIGNMENT is set. 147 * it seems. */ 140 148 uint32_t uAlignmentMask; 141 149 } GS_HANDLER_DATA; … … 150 158 #endif 151 159 160 #if defined(RT_ARCH_AMD64) 161 EXCEPTION_DISPOSITION __C_specific_handler(PEXCEPTION_RECORD pXcptRec, PEXCEPTION_REGISTRATION_RECORD pXcptRegRec, 162 PCONTEXT pCpuCtx, PDISPATCHER_CONTEXT pDispCtx); 163 #endif 164 165 RT_C_DECLS_END 166 152 167 #endif /* !IPRT_INCLUDED_SRC_common_compiler_vcc_except_vcc_h */ 153 168 -
trunk/src/VBox/Runtime/common/compiler/vcc/stack-except-seh-vcc.cpp
r96556 r96559 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Visual C++ Compiler - Stack Checking, __GSHandlerCheck .3 * IPRT - Visual C++ Compiler - Stack Checking, __GSHandlerCheck_SEH. 4 4 */ 5 5 … … 41 41 #include "internal/nocrt.h" 42 42 43 #include <iprt/win/windows.h>44 45 #include <iprt/asm.h>46 #include <iprt/asm-amd64-x86.h>47 #ifndef IPRT_NOCRT_WITHOUT_FATAL_WRITE48 # include <iprt/assert.h>49 #endif50 51 #include "internal/compiler-vcc.h"52 43 #include "except-vcc.h" 53 44 … … 65 56 * triggering an exception. 66 57 * 67 * This does not call any C++ exception handlers, as it's probably (still 68 * figuring this stuff out) only used when C++ exceptions are disabled. 58 * This is called for windows' structured exception handling (SEH), i.e. the 59 * __try/__except/__finally stuff in Visual C++, for which the compiler 60 * generates somewhat different strctures compared to the plain __GSHanderCheck 61 * scenario. 69 62 * 70 63 * @returns Exception disposition. … … 76 69 */ 77 70 extern "C" __declspec(guard(suppress)) 78 EXCEPTION_DISPOSITION __GSHandlerCheck (PEXCEPTION_RECORD pXcptRec, PEXCEPTION_REGISTRATION_RECORD pXcptRegRec,79 PCONTEXT pCpuCtx, PDISPATCHER_CONTEXT pDispCtx)71 EXCEPTION_DISPOSITION __GSHandlerCheck_SEH(PEXCEPTION_RECORD pXcptRec, PEXCEPTION_REGISTRATION_RECORD pXcptRegRec, 72 PCONTEXT pCpuCtx, PDISPATCHER_CONTEXT pDispCtx) 80 73 { 81 RT_NOREF(pXcptRec, pCpuCtx); 74 /* 75 * The HandlerData points to a scope table, which is then followed by GS_HANDLER_DATA. 76 * 77 * Sample offCookie values: 0521H (tst.cpp), 02caH (installNetLwf), and 0502H (installNetFlt). 78 */ 79 SCOPE_TABLE const *pScopeTable = (SCOPE_TABLE const *)pDispCtx->HandlerData; 80 PCGS_HANDLER_DATA pHandlerData = (PCGS_HANDLER_DATA)&pScopeTable->ScopeRecord[pScopeTable->Count]; 82 81 83 82 /* 84 83 * Locate the stack cookie and call the regular stack cookie checker routine. 84 * (Same code as in __GSHandlerCheck, fixes applies both places.) 85 85 */ 86 PCGS_HANDLER_DATA pHandlerData = (PCGS_HANDLER_DATA)pDispCtx->HandlerData;87 88 86 /* Calculate the cookie address and read it. */ 89 87 uintptr_t uPtrFrame = (uintptr_t)pXcptRegRec; … … 107 105 __security_check_cookie(uCookie ^ uXorAddr); 108 106 107 108 /* 109 * Now call the handler if the GS handler data indicates that we ought to. 110 */ 111 if ( (IS_UNWINDING(pXcptRec->ExceptionFlags) ? GS_HANDLER_OFF_COOKIE_IS_UHANDLER : GS_HANDLER_OFF_COOKIE_IS_EHANDLER) 112 & pHandlerData->u.offCookie) 113 return __C_specific_handler(pXcptRec, pXcptRegRec, pCpuCtx, pDispCtx); 114 109 115 return ExceptionContinueSearch; 110 116 } -
trunk/src/VBox/Runtime/common/compiler/vcc/stack-except-vcc.cpp
r96420 r96559 41 41 #include "internal/nocrt.h" 42 42 43 #include <iprt/win/windows.h>44 45 #include <iprt/asm.h>46 #include <iprt/asm-amd64-x86.h>47 #ifndef IPRT_NOCRT_WITHOUT_FATAL_WRITE48 # include <iprt/assert.h>49 #endif50 51 #include "internal/compiler-vcc.h"52 43 #include "except-vcc.h" 53 44 … … 82 73 83 74 /* 84 * Locate the stack cookie and call the regular stack cookie checker routine.75 * Only GS handler data here. 85 76 */ 86 77 PCGS_HANDLER_DATA pHandlerData = (PCGS_HANDLER_DATA)pDispCtx->HandlerData; 87 78 79 /* 80 * Locate the stack cookie and call the regular stack cookie checker routine. 81 * (Same code as in __GSHandlerCheck_SEH, fixes applies both places.) 82 */ 88 83 /* Calculate the cookie address and read it. */ 89 84 uintptr_t uPtrFrame = (uintptr_t)pXcptRegRec;
Note:
See TracChangeset
for help on using the changeset viewer.