ReactOS  0.4.15-dev-3303-g1ade494
except_arm64.c
Go to the documentation of this file.
1 /*
2  * msvcrt C++ exception handling
3  *
4  * Copyright 2011 Alexandre Julliard
5  * Copyright 2013 AndrĂ© Hentschel
6  * Copyright 2017 Martin Storsjo
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21  */
22 
23 #include "config.h"
24 #include "wine/port.h"
25 
26 #ifdef __aarch64__
27 
28 #include <stdarg.h>
29 
30 #include "ntstatus.h"
31 #define WIN32_NO_STATUS
32 #include "windef.h"
33 #include "winbase.h"
34 #include "winternl.h"
35 #include "msvcrt.h"
36 #include "wine/exception.h"
37 #include "excpt.h"
38 #include "wine/debug.h"
39 
40 #include "cppexcept.h"
41 
43 
44 
45 /*********************************************************************
46  * __CxxExceptionFilter (MSVCRT.@)
47  */
48 int CDECL __CxxExceptionFilter( PEXCEPTION_POINTERS ptrs,
49  const type_info *ti, int flags, void **copy )
50 {
51  FIXME( "%p %p %x %p: not implemented\n", ptrs, ti, flags, copy );
53 }
54 
55 /*********************************************************************
56  * __CxxFrameHandler (MSVCRT.@)
57  */
58 EXCEPTION_DISPOSITION CDECL __CxxFrameHandler(EXCEPTION_RECORD *rec, DWORD frame, CONTEXT *context,
60 {
61  FIXME("%p %x %p %p: not implemented\n", rec, frame, context, dispatch);
63 }
64 
65 
66 /*********************************************************************
67  * __CppXcptFilter (MSVCRT.@)
68  */
70 {
71  /* only filter c++ exceptions */
73  return _XcptFilter(ex, ptr);
74 }
75 
76 
77 /*********************************************************************
78  * __CxxDetectRethrow (MSVCRT.@)
79  */
80 BOOL CDECL __CxxDetectRethrow(PEXCEPTION_POINTERS ptrs)
81 {
83 
84  if (!ptrs)
85  return FALSE;
86 
87  rec = ptrs->ExceptionRecord;
88 
89  if (rec->ExceptionCode == CXX_EXCEPTION &&
90  rec->NumberParameters == 3 &&
92  rec->ExceptionInformation[2])
93  {
94  ptrs->ExceptionRecord = msvcrt_get_thread_data()->exc_record;
95  return TRUE;
96  }
97  return (msvcrt_get_thread_data()->exc_record == rec);
98 }
99 
100 
101 /*********************************************************************
102  * __CxxQueryExceptionSize (MSVCRT.@)
103  */
104 unsigned int CDECL __CxxQueryExceptionSize(void)
105 {
106  return sizeof(cxx_exception_type);
107 }
108 
109 
110 /*******************************************************************
111  * _setjmp (MSVCRT.@)
112  */
113 __ASM_GLOBAL_FUNC(MSVCRT__setjmp,
114  "mov x1, #0\n\t" /* frame */
115  "b " __ASM_NAME("__wine_setjmpex"));
116 
117 /*******************************************************************
118  * longjmp (MSVCRT.@)
119  */
120 void __cdecl MSVCRT_longjmp(struct MSVCRT___JUMP_BUFFER *jmp, int retval)
121 {
122  EXCEPTION_RECORD rec;
123 
124  if (!retval) retval = 1;
125  if (jmp->Frame)
126  {
128  rec.ExceptionFlags = 0;
129  rec.ExceptionRecord = NULL;
130  rec.ExceptionAddress = NULL;
131  rec.NumberParameters = 1;
132  rec.ExceptionInformation[0] = (DWORD_PTR)jmp;
133  RtlUnwind((void *)jmp->Frame, (void *)jmp->Lr, &rec, IntToPtr(retval));
134  }
135  __wine_longjmp( (__wine_jmp_buf *)jmp, retval );
136 }
137 
138 /*********************************************************************
139  * _fpieee_flt (MSVCRT.@)
140  */
141 int __cdecl _fpieee_flt(ULONG exception_code, EXCEPTION_POINTERS *ep,
142  int (__cdecl *handler)(_FPIEEE_RECORD*))
143 {
144  FIXME("(%x %p %p)\n", exception_code, ep, handler);
146 }
147 
148 #endif /* __aarch64__ */
_CRTIMP int __cdecl _fpieee_flt(unsigned long _ExceptionCode, struct _EXCEPTION_POINTERS *_PtExceptionPtr, int(__cdecl *_Handler)(_FPIEEE_RECORD *))
Definition: comerr.c:44
#define DWORD_PTR
Definition: treelist.c:76
#define __cdecl
Definition: accygwin.h:79
#define CXX_FRAME_MAGIC_VC6
Definition: cppexcept.h:24
Definition: http.c:7251
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI VOID NTAPI RtlUnwind(_In_opt_ PVOID TargetFrame, _In_opt_ PVOID TargetIp, _In_opt_ PEXCEPTION_RECORD ExceptionRecord, _In_ PVOID ReturnValue)
Definition: except.c:47
PVOID ExceptionAddress
Definition: compat.h:211
#define __ASM_GLOBAL_FUNC(name, code)
Definition: port.h:201
DWORD ExceptionCode
Definition: compat.h:208
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define __ASM_NAME(name)
Definition: config.h:934
#define FIXME(fmt,...)
Definition: debug.h:111
static PVOID ptr
Definition: dispmode.c:27
#define STATUS_LONGJUMP
Definition: ntstatus.h:217
int CDECL __CppXcptFilter(NTSTATUS, PEXCEPTION_POINTERS)
#define IntToPtr(i)
Definition: basetsd.h:89
#define CXX_EXCEPTION
Definition: cppexcept.h:27
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
Definition: compat.h:213
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
thread_data_t * msvcrt_get_thread_data(void)
Definition: tls.c:31
void dispatch(HANDLE hStopEvent)
Definition: dispatch.c:70
struct __cxx_exception_type cxx_exception_type
struct _EXCEPTION_RECORD * ExceptionRecord
Definition: compat.h:210
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
#define CDECL
Definition: compat.h:29
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
enum _EXCEPTION_DISPOSITION EXCEPTION_DISPOSITION
DWORD ExceptionFlags
Definition: compat.h:209
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:200
UINT(* handler)(MSIPACKAGE *)
Definition: action.c:7786
DWORD NumberParameters
Definition: compat.h:212
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
int CDECL _XcptFilter(NTSTATUS, PEXCEPTION_POINTERS)
Definition: except.c:274