2017-09-08 08:47:33 +02:00
|
|
|
/*
|
|
|
|
* msvcrt C++ exception handling
|
|
|
|
*
|
|
|
|
* Copyright 2011 Alexandre Julliard
|
|
|
|
* Copyright 2013 André Hentschel
|
|
|
|
* Copyright 2017 Martin Storsjo
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __aarch64__
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2020-11-20 12:44:42 +01:00
|
|
|
#include <fpieee.h>
|
2017-09-08 08:47:33 +02:00
|
|
|
|
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winternl.h"
|
|
|
|
#include "msvcrt.h"
|
|
|
|
#include "wine/exception.h"
|
|
|
|
#include "excpt.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "cppexcept.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(seh);
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* __CxxExceptionFilter (MSVCRT.@)
|
|
|
|
*/
|
|
|
|
int CDECL __CxxExceptionFilter( PEXCEPTION_POINTERS ptrs,
|
|
|
|
const type_info *ti, int flags, void **copy )
|
|
|
|
{
|
|
|
|
FIXME( "%p %p %x %p: not implemented\n", ptrs, ti, flags, copy );
|
|
|
|
return EXCEPTION_CONTINUE_SEARCH;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* __CxxFrameHandler (MSVCRT.@)
|
|
|
|
*/
|
|
|
|
EXCEPTION_DISPOSITION CDECL __CxxFrameHandler(EXCEPTION_RECORD *rec, DWORD frame, CONTEXT *context,
|
|
|
|
DISPATCHER_CONTEXT *dispatch)
|
|
|
|
{
|
|
|
|
FIXME("%p %x %p %p: not implemented\n", rec, frame, context, dispatch);
|
|
|
|
return ExceptionContinueSearch;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* __CppXcptFilter (MSVCRT.@)
|
|
|
|
*/
|
|
|
|
int CDECL __CppXcptFilter(NTSTATUS ex, PEXCEPTION_POINTERS ptr)
|
|
|
|
{
|
|
|
|
/* only filter c++ exceptions */
|
|
|
|
if (ex != CXX_EXCEPTION) return EXCEPTION_CONTINUE_SEARCH;
|
|
|
|
return _XcptFilter(ex, ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* __CxxDetectRethrow (MSVCRT.@)
|
|
|
|
*/
|
|
|
|
BOOL CDECL __CxxDetectRethrow(PEXCEPTION_POINTERS ptrs)
|
|
|
|
{
|
|
|
|
PEXCEPTION_RECORD rec;
|
|
|
|
|
|
|
|
if (!ptrs)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
rec = ptrs->ExceptionRecord;
|
|
|
|
|
|
|
|
if (rec->ExceptionCode == CXX_EXCEPTION &&
|
|
|
|
rec->NumberParameters == 3 &&
|
|
|
|
rec->ExceptionInformation[0] == CXX_FRAME_MAGIC_VC6 &&
|
|
|
|
rec->ExceptionInformation[2])
|
|
|
|
{
|
|
|
|
ptrs->ExceptionRecord = msvcrt_get_thread_data()->exc_record;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return (msvcrt_get_thread_data()->exc_record == rec);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* __CxxQueryExceptionSize (MSVCRT.@)
|
|
|
|
*/
|
|
|
|
unsigned int CDECL __CxxQueryExceptionSize(void)
|
|
|
|
{
|
|
|
|
return sizeof(cxx_exception_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
* _setjmp (MSVCRT.@)
|
|
|
|
*/
|
|
|
|
__ASM_GLOBAL_FUNC(MSVCRT__setjmp,
|
|
|
|
"mov x1, #0\n\t" /* frame */
|
2019-06-18 10:17:43 +02:00
|
|
|
"b " __ASM_NAME("__wine_setjmpex"));
|
2017-09-08 08:47:33 +02:00
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
* longjmp (MSVCRT.@)
|
|
|
|
*/
|
|
|
|
void __cdecl MSVCRT_longjmp(struct MSVCRT___JUMP_BUFFER *jmp, int retval)
|
|
|
|
{
|
|
|
|
EXCEPTION_RECORD rec;
|
|
|
|
|
|
|
|
if (!retval) retval = 1;
|
|
|
|
if (jmp->Frame)
|
|
|
|
{
|
|
|
|
rec.ExceptionCode = STATUS_LONGJUMP;
|
|
|
|
rec.ExceptionFlags = 0;
|
|
|
|
rec.ExceptionRecord = NULL;
|
|
|
|
rec.ExceptionAddress = NULL;
|
|
|
|
rec.NumberParameters = 1;
|
|
|
|
rec.ExceptionInformation[0] = (DWORD_PTR)jmp;
|
|
|
|
RtlUnwind((void *)jmp->Frame, (void *)jmp->Lr, &rec, IntToPtr(retval));
|
|
|
|
}
|
2019-06-18 10:17:43 +02:00
|
|
|
__wine_longjmp( (__wine_jmp_buf *)jmp, retval );
|
2017-09-08 08:47:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _fpieee_flt (MSVCRT.@)
|
|
|
|
*/
|
2020-11-20 12:44:42 +01:00
|
|
|
int __cdecl _fpieee_flt(__msvcrt_ulong exception_code, EXCEPTION_POINTERS *ep,
|
2017-09-08 08:47:33 +02:00
|
|
|
int (__cdecl *handler)(_FPIEEE_RECORD*))
|
|
|
|
{
|
2020-11-20 12:44:42 +01:00
|
|
|
FIXME("(%lx %p %p)\n", exception_code, ep, handler);
|
2017-09-08 08:47:33 +02:00
|
|
|
return EXCEPTION_CONTINUE_SEARCH;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __aarch64__ */
|