From 874d077ca6d60f457dcf79f0604d519a4bee78d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Tue, 26 Feb 2013 23:42:33 +0100 Subject: [PATCH] msvcrt: Add a new file for the ARM exception handling. --- dlls/crtdll/crtdll.spec | 4 +- dlls/msvcr100/msvcr100.spec | 18 ++-- dlls/msvcr70/msvcr70.spec | 10 +- dlls/msvcr71/msvcr71.spec | 12 +-- dlls/msvcr80/msvcr80.spec | 16 +-- dlls/msvcr90/msvcr90.spec | 16 +-- dlls/msvcrt/Makefile.in | 1 + dlls/msvcrt/except_arm.c | 187 ++++++++++++++++++++++++++++++++++++ dlls/msvcrt/msvcrt.h | 17 ++++ dlls/msvcrt/msvcrt.spec | 18 ++-- dlls/msvcrt20/msvcrt20.spec | 6 +- dlls/msvcrt40/msvcrt40.spec | 6 +- dlls/msvcrtd/msvcrtd.spec | 6 +- include/msvcrt/setjmp.h | 22 +++++ include/winnt.h | 39 ++++++++ 15 files changed, 322 insertions(+), 56 deletions(-) create mode 100644 dlls/msvcrt/except_arm.c diff --git a/dlls/crtdll/crtdll.spec b/dlls/crtdll/crtdll.spec index cad39dacd04..47487af339e 100644 --- a/dlls/crtdll/crtdll.spec +++ b/dlls/crtdll/crtdll.spec @@ -266,7 +266,7 @@ @ cdecl _scalb(double long) msvcrt._scalb @ cdecl _searchenv(str str ptr) msvcrt._searchenv @ cdecl _seterrormode(long) msvcrt._seterrormode -@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) msvcrt._setjmp +@ cdecl -arch=i386,x86_64,arm -norelay _setjmp(ptr) msvcrt._setjmp @ cdecl _setmode(long long) msvcrt._setmode @ cdecl _setsystime(ptr long) msvcrt._setsystime @ cdecl _sleep(long) msvcrt._sleep @@ -427,7 +427,7 @@ @ cdecl localtime(ptr) msvcrt.localtime @ cdecl log(double) msvcrt.log @ cdecl log10(double) msvcrt.log10 -@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp +@ cdecl -arch=i386,x86_64,arm longjmp(ptr long) msvcrt.longjmp @ cdecl malloc(long) msvcrt.malloc @ cdecl mblen(ptr long) msvcrt.mblen @ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index a201a79d068..019a41aef4d 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -537,18 +537,18 @@ @ stub __BuildCatchObject @ stub __BuildCatchObjectHelper @ stdcall -arch=x86_64 __C_specific_handler(ptr long ptr ptr) msvcrt.__C_specific_handler -@ cdecl -arch=i386,x86_64 __CppXcptFilter(long ptr) msvcrt.__CppXcptFilter +@ cdecl -arch=i386,x86_64,arm __CppXcptFilter(long ptr) msvcrt.__CppXcptFilter @ stub __CxxCallUnwindDelDtor @ stub __CxxCallUnwindDtor @ stub __CxxCallUnwindStdDelDtor @ stub __CxxCallUnwindVecDtor -@ cdecl -arch=i386,x86_64 __CxxDetectRethrow(ptr) msvcrt.__CxxDetectRethrow +@ cdecl -arch=i386,x86_64,arm __CxxDetectRethrow(ptr) msvcrt.__CxxDetectRethrow @ stub __CxxExceptionFilter -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler2(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler2 -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler3(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler3 +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler2(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler2 +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler3(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler3 @ stdcall -i386 __CxxLongjmpUnwind(ptr) msvcrt.__CxxLongjmpUnwind -@ cdecl -arch=i386,x86_64 __CxxQueryExceptionSize() msvcrt.__CxxQueryExceptionSize +@ cdecl -arch=i386,x86_64,arm __CxxQueryExceptionSize() msvcrt.__CxxQueryExceptionSize @ stub __CxxRegisterExceptionObject @ stub __CxxUnregisterExceptionObject @ stub __DestructExceptionObject @@ -1273,9 +1273,9 @@ @ cdecl _set_printf_count_output(long) msvcrt._set_printf_count_output @ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler @ cdecl _seterrormode(long) msvcrt._seterrormode -@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) msvcrt._setjmp +@ cdecl -arch=i386,x86_64,arm -norelay _setjmp(ptr) msvcrt._setjmp @ cdecl -arch=i386 -norelay _setjmp3(ptr long) msvcrt._setjmp3 -@ cdecl -arch=x86_64 -norelay _setjmpex(ptr ptr) msvcrt._setjmpex +@ cdecl -arch=x86_64,arm -norelay _setjmpex(ptr ptr) msvcrt._setjmpex @ cdecl _setmaxstdio(long) msvcrt._setmaxstdio @ cdecl _setmbcp(long) msvcrt._setmbcp @ cdecl _setmode(long long) msvcrt._setmode @@ -1728,7 +1728,7 @@ @ cdecl -arch=x86_64 logf(float) msvcrt.logf @ cdecl log10(double) msvcrt.log10 @ cdecl -arch=x86_64 log10f(float) msvcrt.log10f -@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp +@ cdecl -arch=i386,x86_64,arm longjmp(ptr long) msvcrt.longjmp @ cdecl malloc(long) msvcrt.malloc @ cdecl mblen(ptr long) msvcrt.mblen @ cdecl mbrlen(ptr long ptr) msvcrt.mbrlen diff --git a/dlls/msvcr70/msvcr70.spec b/dlls/msvcr70/msvcr70.spec index 141b791c831..81264d5d2c3 100644 --- a/dlls/msvcr70/msvcr70.spec +++ b/dlls/msvcr70/msvcr70.spec @@ -118,11 +118,11 @@ @ cdecl _XcptFilter(long ptr) msvcrt._XcptFilter @ stub __CxxCallUnwindDtor @ stub __CxxCallUnwindVecDtor -@ cdecl -arch=i386,x86_64 __CxxDetectRethrow(ptr) msvcrt.__CxxDetectRethrow +@ cdecl -arch=i386,x86_64,arm __CxxDetectRethrow(ptr) msvcrt.__CxxDetectRethrow @ stub __CxxExceptionFilter -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler @ stdcall -i386 __CxxLongjmpUnwind(ptr) msvcrt.__CxxLongjmpUnwind -@ cdecl -arch=i386,x86_64 __CxxQueryExceptionSize() msvcrt.__CxxQueryExceptionSize +@ cdecl -arch=i386,x86_64,arm __CxxQueryExceptionSize() msvcrt.__CxxQueryExceptionSize @ stub __CxxRegisterExceptionObject @ stub __CxxUnregisterExceptionObject @ stub __DestructExceptionObject @@ -518,7 +518,7 @@ @ cdecl _set_sbh_threshold(long) msvcrt._set_sbh_threshold @ cdecl _set_security_error_handler(ptr) msvcrt._set_security_error_handler @ cdecl _seterrormode(long) msvcrt._seterrormode -@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) msvcrt._setjmp +@ cdecl -arch=i386,x86_64,arm -norelay _setjmp(ptr) msvcrt._setjmp @ cdecl -arch=i386 -norelay _setjmp3(ptr long) msvcrt._setjmp3 @ cdecl _setmaxstdio(long) msvcrt._setmaxstdio @ cdecl _setmbcp(long) msvcrt._setmbcp @@ -771,7 +771,7 @@ @ cdecl localtime(ptr) msvcrt.localtime @ cdecl log(double) msvcrt.log @ cdecl log10(double) msvcrt.log10 -@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp +@ cdecl -arch=i386,x86_64,arm longjmp(ptr long) msvcrt.longjmp @ cdecl malloc(long) msvcrt.malloc @ cdecl mblen(ptr long) msvcrt.mblen @ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs diff --git a/dlls/msvcr71/msvcr71.spec b/dlls/msvcr71/msvcr71.spec index 28bffdb36fe..43749eb7497 100644 --- a/dlls/msvcr71/msvcr71.spec +++ b/dlls/msvcr71/msvcr71.spec @@ -110,14 +110,14 @@ @ extern _HUGE msvcrt._HUGE @ cdecl _Strftime(str long str ptr ptr) msvcrt._Strftime @ cdecl _XcptFilter(long ptr) msvcrt._XcptFilter -@ cdecl -arch=i386,x86_64 __CppXcptFilter(long ptr) msvcrt.__CppXcptFilter +@ cdecl -arch=i386,x86_64,arm __CppXcptFilter(long ptr) msvcrt.__CppXcptFilter @ stub __CxxCallUnwindDtor @ stub __CxxCallUnwindVecDtor -@ cdecl -arch=i386,x86_64 __CxxDetectRethrow(ptr) msvcrt.__CxxDetectRethrow +@ cdecl -arch=i386,x86_64,arm __CxxDetectRethrow(ptr) msvcrt.__CxxDetectRethrow @ stub __CxxExceptionFilter -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler @ stdcall -i386 __CxxLongjmpUnwind(ptr) msvcrt.__CxxLongjmpUnwind -@ cdecl -arch=i386,x86_64 __CxxQueryExceptionSize() msvcrt.__CxxQueryExceptionSize +@ cdecl -arch=i386,x86_64,arm __CxxQueryExceptionSize() msvcrt.__CxxQueryExceptionSize @ stub __CxxRegisterExceptionObject @ stub __CxxUnregisterExceptionObject @ stub __DestructExceptionObject @@ -514,7 +514,7 @@ @ cdecl _set_sbh_threshold(long) msvcrt._set_sbh_threshold @ cdecl _set_security_error_handler(ptr) msvcrt._set_security_error_handler @ cdecl _seterrormode(long) msvcrt._seterrormode -@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) msvcrt._setjmp +@ cdecl -arch=i386,x86_64,arm -norelay _setjmp(ptr) msvcrt._setjmp @ cdecl -arch=i386 -norelay _setjmp3(ptr long) msvcrt._setjmp3 @ cdecl _setmaxstdio(long) msvcrt._setmaxstdio @ cdecl _setmbcp(long) msvcrt._setmbcp @@ -767,7 +767,7 @@ @ cdecl localtime(ptr) msvcrt.localtime @ cdecl log(double) msvcrt.log @ cdecl log10(double) msvcrt.log10 -@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp +@ cdecl -arch=i386,x86_64,arm longjmp(ptr long) msvcrt.longjmp @ cdecl malloc(long) msvcrt.malloc @ cdecl mblen(ptr long) msvcrt.mblen @ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index c300e5698c4..1f1aa6dbb3a 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -165,18 +165,18 @@ @ stub __BuildCatchObject @ stub __BuildCatchObjectHelper @ stdcall -arch=x86_64 __C_specific_handler(ptr long ptr ptr) msvcrt.__C_specific_handler -@ cdecl -arch=i386,x86_64 __CppXcptFilter(long ptr) msvcrt.__CppXcptFilter +@ cdecl -arch=i386,x86_64,arm __CppXcptFilter(long ptr) msvcrt.__CppXcptFilter @ stub __CxxCallUnwindDelDtor @ stub __CxxCallUnwindDtor @ stub __CxxCallUnwindStdDelDtor @ stub __CxxCallUnwindVecDtor -@ cdecl -arch=i386,x86_64 __CxxDetectRethrow(ptr) msvcrt.__CxxDetectRethrow +@ cdecl -arch=i386,x86_64,arm __CxxDetectRethrow(ptr) msvcrt.__CxxDetectRethrow @ stub __CxxExceptionFilter -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler2(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler2 -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler3(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler3 +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler2(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler2 +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler3(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler3 @ stdcall -i386 __CxxLongjmpUnwind(ptr) msvcrt.__CxxLongjmpUnwind -@ cdecl -arch=i386,x86_64 __CxxQueryExceptionSize() msvcrt.__CxxQueryExceptionSize +@ cdecl -arch=i386,x86_64,arm __CxxQueryExceptionSize() msvcrt.__CxxQueryExceptionSize @ stub __CxxRegisterExceptionObject @ stub __CxxUnregisterExceptionObject @ stub __DestructExceptionObject @@ -936,7 +936,7 @@ @ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler @ cdecl _set_sbh_threshold(long) msvcrt._set_sbh_threshold @ cdecl _seterrormode(long) msvcrt._seterrormode -@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) msvcrt._setjmp +@ cdecl -arch=i386,x86_64,arm -norelay _setjmp(ptr) msvcrt._setjmp @ cdecl -arch=i386 -norelay _setjmp3(ptr long) msvcrt._setjmp3 @ cdecl _setmaxstdio(long) msvcrt._setmaxstdio @ cdecl _setmbcp(long) msvcrt._setmbcp @@ -1378,7 +1378,7 @@ @ cdecl localeconv() msvcrt.localeconv @ cdecl log(double) msvcrt.log @ cdecl log10(double) msvcrt.log10 -@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp +@ cdecl -arch=i386,x86_64,arm longjmp(ptr long) msvcrt.longjmp @ cdecl malloc(long) msvcrt.malloc @ cdecl mblen(ptr long) msvcrt.mblen @ cdecl mbrlen(ptr long ptr) msvcrt.mbrlen diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 1f0a56aaa5d..720c056109f 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -162,18 +162,18 @@ @ stub __BuildCatchObject @ stub __BuildCatchObjectHelper @ stdcall -arch=x86_64 __C_specific_handler(ptr long ptr ptr) msvcrt.__C_specific_handler -@ cdecl -arch=i386,x86_64 __CppXcptFilter(long ptr) msvcrt.__CppXcptFilter +@ cdecl -arch=i386,x86_64,arm __CppXcptFilter(long ptr) msvcrt.__CppXcptFilter @ stub __CxxCallUnwindDelDtor @ stub __CxxCallUnwindDtor @ stub __CxxCallUnwindStdDelDtor @ stub __CxxCallUnwindVecDtor -@ cdecl -arch=i386,x86_64 __CxxDetectRethrow(ptr) msvcrt.__CxxDetectRethrow +@ cdecl -arch=i386,x86_64,arm __CxxDetectRethrow(ptr) msvcrt.__CxxDetectRethrow @ stub __CxxExceptionFilter -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler2(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler2 -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler3(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler3 +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler2(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler2 +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler3(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler3 @ stdcall -i386 __CxxLongjmpUnwind(ptr) msvcrt.__CxxLongjmpUnwind -@ cdecl -arch=i386,x86_64 __CxxQueryExceptionSize() msvcrt.__CxxQueryExceptionSize +@ cdecl -arch=i386,x86_64,arm __CxxQueryExceptionSize() msvcrt.__CxxQueryExceptionSize @ stub __CxxRegisterExceptionObject @ stub __CxxUnregisterExceptionObject @ stub __DestructExceptionObject @@ -929,7 +929,7 @@ @ cdecl _set_purecall_handler(ptr) msvcrt._set_purecall_handler @ cdecl _set_sbh_threshold(long) msvcrt._set_sbh_threshold @ cdecl _seterrormode(long) msvcrt._seterrormode -@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) msvcrt._setjmp +@ cdecl -arch=i386,x86_64,arm -norelay _setjmp(ptr) msvcrt._setjmp @ cdecl -arch=i386 -norelay _setjmp3(ptr long) msvcrt._setjmp3 @ cdecl _setmaxstdio(long) msvcrt._setmaxstdio @ cdecl _setmbcp(long) msvcrt._setmbcp @@ -1381,7 +1381,7 @@ @ cdecl log10(double) msvcrt.log10 @ cdecl -arch=x86_64 log10f(float) msvcrt.log10f @ cdecl -arch=x86_64 logf(float) msvcrt.logf -@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp +@ cdecl -arch=i386,x86_64,arm longjmp(ptr long) msvcrt.longjmp @ cdecl malloc(long) msvcrt.malloc @ cdecl mblen(ptr long) msvcrt.mblen @ cdecl mbrlen(ptr long ptr) msvcrt.mbrlen diff --git a/dlls/msvcrt/Makefile.in b/dlls/msvcrt/Makefile.in index 99310401f0a..f50a45a9060 100644 --- a/dlls/msvcrt/Makefile.in +++ b/dlls/msvcrt/Makefile.in @@ -12,6 +12,7 @@ C_SRCS = \ environ.c \ errno.c \ except.c \ + except_arm.c \ except_i386.c \ except_x86_64.c \ exit.c \ diff --git a/dlls/msvcrt/except_arm.c b/dlls/msvcrt/except_arm.c new file mode 100644 index 00000000000..247728d1210 --- /dev/null +++ b/dlls/msvcrt/except_arm.c @@ -0,0 +1,187 @@ +/* + * msvcrt C++ exception handling + * + * Copyright 2011 Alexandre Julliard + * Copyright 2013 André Hentschel + * + * 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 + */ + +#include "config.h" +#include "wine/port.h" + +#ifdef __arm__ + +#include + +#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); + +struct _DISPATCHER_CONTEXT; + +typedef LONG (WINAPI *PC_LANGUAGE_EXCEPTION_HANDLER)(EXCEPTION_POINTERS *ptrs, DWORD frame); +typedef EXCEPTION_DISPOSITION (WINAPI *PEXCEPTION_ROUTINE)(EXCEPTION_RECORD *rec, DWORD frame, + CONTEXT *context, + struct _DISPATCHER_CONTEXT *dispatch); + +typedef struct _DISPATCHER_CONTEXT +{ + DWORD ControlPc; + DWORD ImageBase; + PRUNTIME_FUNCTION FunctionEntry; + DWORD EstablisherFrame; + DWORD TargetIp; + PCONTEXT ContextRecord; + PEXCEPTION_ROUTINE LanguageHandler; + PVOID HandlerData; + PUNWIND_HISTORY_TABLE HistoryTable; + DWORD ScopeIndex; + BOOLEAN ControlPcIsUnwound; + PBYTE NonVolatileRegisters; + DWORD Reserved; +} DISPATCHER_CONTEXT; + + +/********************************************************************* + * __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 r1, #0\n\t" /* frame */ + "b " __ASM_NAME("MSVCRT__setjmpex")); + +/******************************************************************* + * _setjmpex (MSVCRT.@) + */ +__ASM_GLOBAL_FUNC(MSVCRT__setjmpex, + "str r1, [r0]\n\t" /* jmp_buf->Frame */ + "str r4, [r0, #0x4]\n\t" /* jmp_buf->R4 */ + "str r5, [r0, #0x8]\n\t" /* jmp_buf->R5 */ + "str r6, [r0, #0xc]\n\t" /* jmp_buf->R6 */ + "str r7, [r0, #0x10]\n\t" /* jmp_buf->R7 */ + "str r8, [r0, #0x14]\n\t" /* jmp_buf->R8 */ + "str r9, [r0, #0x18]\n\t" /* jmp_buf->R9 */ + "str r10, [r0, #0x1c]\n\t" /* jmp_buf->R10 */ + "str r11, [r0, #0x20]\n\t" /* jmp_buf->R11 */ + "str sp, [r0, #0x24]\n\t" /* jmp_buf->Sp */ + "str lr, [r0, #0x28]\n\t" /* jmp_buf->Pc */ + /* FIXME: Save floating point data */ + "mov r0, #0\n\t" + "bx lr"); + + +extern void DECLSPEC_NORETURN CDECL longjmp_set_regs(struct MSVCRT___JUMP_BUFFER *jmp, int retval); +__ASM_GLOBAL_FUNC(longjmp_set_regs, + "ldr r4, [r0, #0x4]\n\t" /* jmp_buf->R4 */ + "ldr r5, [r0, #0x8]\n\t" /* jmp_buf->R5 */ + "ldr r6, [r0, #0xc]\n\t" /* jmp_buf->R6 */ + "ldr r7, [r0, #0x10]\n\t" /* jmp_buf->R7 */ + "ldr r8, [r0, #0x14]\n\t" /* jmp_buf->R8 */ + "ldr r9, [r0, #0x18]\n\t" /* jmp_buf->R9 */ + "ldr r10, [r0, #0x1c]\n\t" /* jmp_buf->R10 */ + "ldr r11, [r0, #0x20]\n\t" /* jmp_buf->R11 */ + "ldr sp, [r0, #0x24]\n\t" /* jmp_buf->Sp */ + "ldr r2, [r0, #0x28]\n\t" /* jmp_buf->Pc */ + /* FIXME: Restore floating point data */ + "mov r0, r1\n\t" /* retval */ + "bx r2"); + +/******************************************************************* + * 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->Pc, &rec, IntToPtr(retval)); + } + longjmp_set_regs(jmp, retval); +} + +#endif /* __arm__ */ diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index bd692242ea7..288d18da28d 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -428,6 +428,23 @@ struct MSVCRT___JUMP_BUFFER struct MSVCRT__SETJMP_FLOAT128 Xmm14; struct MSVCRT__SETJMP_FLOAT128 Xmm15; }; +#elif defined(__arm__) +struct MSVCRT___JUMP_BUFFER +{ + unsigned long Frame; + unsigned long R4; + unsigned long R5; + unsigned long R6; + unsigned long R7; + unsigned long R8; + unsigned long R9; + unsigned long R10; + unsigned long R11; + unsigned long Sp; + unsigned long Pc; + unsigned long Fpscr; + unsigned long long D[8]; +}; #endif /* __i386__ */ struct MSVCRT__diskfree_t { diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 29b459b4b13..f5ef8b6761a 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -146,17 +146,17 @@ @ cdecl _Strftime(str long str ptr ptr) @ cdecl _XcptFilter(long ptr) @ stdcall -arch=x86_64 __C_specific_handler(ptr long ptr ptr) ntdll.__C_specific_handler -@ cdecl -arch=i386,x86_64 __CppXcptFilter(long ptr) +@ cdecl -arch=i386,x86_64,arm __CppXcptFilter(long ptr) # stub __CxxCallUnwindDelDtor # stub __CxxCallUnwindDtor # stub __CxxCallUnwindVecDtor -@ cdecl -arch=i386,x86_64 __CxxDetectRethrow(ptr) +@ cdecl -arch=i386,x86_64,arm __CxxDetectRethrow(ptr) # stub __CxxExceptionFilter -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler(ptr ptr ptr ptr) -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler2(ptr ptr ptr ptr) __CxxFrameHandler -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler3(ptr ptr ptr ptr) __CxxFrameHandler +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler(ptr ptr ptr ptr) +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler2(ptr ptr ptr ptr) __CxxFrameHandler +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler3(ptr ptr ptr ptr) __CxxFrameHandler @ stdcall -i386 __CxxLongjmpUnwind(ptr) -@ cdecl -arch=i386,x86_64 __CxxQueryExceptionSize() +@ cdecl -arch=i386,x86_64,arm __CxxQueryExceptionSize() # stub __CxxRegisterExceptionObject # stub __CxxUnregisterExceptionObject # stub __DestructExceptionObject @@ -871,9 +871,9 @@ # stub _set_output_format(long) @ cdecl _set_sbh_threshold(long) @ cdecl _seterrormode(long) -@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) MSVCRT__setjmp +@ cdecl -arch=i386,x86_64,arm -norelay _setjmp(ptr) MSVCRT__setjmp @ cdecl -arch=i386 -norelay _setjmp3(ptr long) MSVCRT__setjmp3 -@ cdecl -arch=x86_64 -norelay _setjmpex(ptr ptr) MSVCRT__setjmpex +@ cdecl -arch=x86_64,arm -norelay _setjmpex(ptr ptr) MSVCRT__setjmpex @ cdecl _setmaxstdio(long) MSVCRT__setmaxstdio @ cdecl _setmbcp(long) @ cdecl _setmode(long long) MSVCRT__setmode @@ -1325,7 +1325,7 @@ @ cdecl log10(double) MSVCRT_log10 @ cdecl -arch=x86_64 logf(float) MSVCRT_logf @ cdecl -arch=x86_64 log10f(float) MSVCRT_log10f -@ cdecl -arch=i386,x86_64 longjmp(ptr long) MSVCRT_longjmp +@ cdecl -arch=i386,x86_64,arm longjmp(ptr long) MSVCRT_longjmp @ cdecl malloc(long) MSVCRT_malloc @ cdecl mblen(ptr long) MSVCRT_mblen @ cdecl mbrlen(ptr long ptr) MSVCRT_mbrlen diff --git a/dlls/msvcrt20/msvcrt20.spec b/dlls/msvcrt20/msvcrt20.spec index ded1bca29d1..fdac1af2827 100644 --- a/dlls/msvcrt20/msvcrt20.spec +++ b/dlls/msvcrt20/msvcrt20.spec @@ -793,7 +793,7 @@ @ stdcall _CxxThrowException(long long) msvcrt._CxxThrowException @ extern _HUGE msvcrt._HUGE @ cdecl _XcptFilter(long ptr) msvcrt._XcptFilter -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler @ stdcall -i386 __CxxLongjmpUnwind(ptr) msvcrt.__CxxLongjmpUnwind @ cdecl __STRINGTOLD(ptr ptr str long) msvcrt.__STRINGTOLD @ extern __argc msvcrt.__argc @@ -1103,7 +1103,7 @@ @ cdecl _searchenv(str str ptr) msvcrt._searchenv @ stdcall -i386 __seh_longjmp_unwind@4(ptr) msvcrt._seh_longjmp_unwind @ cdecl _seterrormode(long) msvcrt._seterrormode -@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) msvcrt._setjmp +@ cdecl -arch=i386,x86_64,arm -norelay _setjmp(ptr) msvcrt._setjmp @ cdecl -arch=i386 -norelay _setjmp3(ptr long) msvcrt._setjmp3 @ cdecl _setmbcp(long) msvcrt._setmbcp @ cdecl _setmode(long long) msvcrt._setmode @@ -1359,7 +1359,7 @@ @ cdecl localtime(ptr) msvcrt.localtime @ cdecl log(double) msvcrt.log @ cdecl log10(double) msvcrt.log10 -@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp +@ cdecl -arch=i386,x86_64,arm longjmp(ptr long) msvcrt.longjmp @ cdecl malloc(long) msvcrt.malloc @ cdecl mblen(ptr long) msvcrt.mblen @ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs diff --git a/dlls/msvcrt40/msvcrt40.spec b/dlls/msvcrt40/msvcrt40.spec index a90436d2942..b795694ea21 100644 --- a/dlls/msvcrt40/msvcrt40.spec +++ b/dlls/msvcrt40/msvcrt40.spec @@ -868,7 +868,7 @@ @ cdecl -i386 -norelay _EH_prolog() msvcrt._EH_prolog @ extern _HUGE msvcrt._HUGE @ cdecl _XcptFilter(long ptr) msvcrt._XcptFilter -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler @ stdcall -i386 __CxxLongjmpUnwind(ptr) msvcrt.__CxxLongjmpUnwind @ cdecl __RTCastToVoid(ptr) msvcrt.__RTCastToVoid @ cdecl __RTDynamicCast(ptr long ptr ptr long) msvcrt.__RTDynamicCast @@ -1198,7 +1198,7 @@ @ stdcall -i386 _seh_longjmp_unwind(ptr) msvcrt._seh_longjmp_unwind @ cdecl _set_error_mode(long) msvcrt._set_error_mode @ cdecl _seterrormode(long) msvcrt._seterrormode -@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) msvcrt._setjmp +@ cdecl -arch=i386,x86_64,arm -norelay _setjmp(ptr) msvcrt._setjmp @ cdecl -arch=i386 -norelay _setjmp3(ptr long) msvcrt._setjmp3 @ cdecl _setmaxstdio(long) msvcrt._setmaxstdio @ cdecl _setmbcp(long) msvcrt._setmbcp @@ -1427,7 +1427,7 @@ @ cdecl localtime(ptr) msvcrt.localtime @ cdecl log(double) msvcrt.log @ cdecl log10(double) msvcrt.log10 -@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp +@ cdecl -arch=i386,x86_64,arm longjmp(ptr long) msvcrt.longjmp @ cdecl malloc(long) msvcrt.malloc @ cdecl mblen(ptr long) msvcrt.mblen @ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs diff --git a/dlls/msvcrtd/msvcrtd.spec b/dlls/msvcrtd/msvcrtd.spec index 044ecc6cc3f..81c07275a93 100644 --- a/dlls/msvcrtd/msvcrtd.spec +++ b/dlls/msvcrtd/msvcrtd.spec @@ -124,7 +124,7 @@ @ extern _HUGE msvcrt._HUGE @ cdecl _Strftime(str long str ptr ptr) msvcrt._Strftime @ cdecl _XcptFilter(long ptr) msvcrt._XcptFilter -@ cdecl -arch=i386,x86_64 -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler +@ cdecl -arch=i386,x86_64,arm -norelay __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler @ stdcall -i386 __CxxLongjmpUnwind(ptr) msvcrt.__CxxLongjmpUnwind @ cdecl __RTCastToVoid(ptr) msvcrt.__RTCastToVoid @ cdecl __RTDynamicCast(ptr long ptr ptr long) msvcrt.__RTDynamicCast @@ -490,7 +490,7 @@ @ cdecl _set_error_mode(long) msvcrt._set_error_mode @ cdecl _set_sbh_threshold(long) msvcrt._set_sbh_threshold @ cdecl _seterrormode(long) msvcrt._seterrormode -@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) msvcrt._setjmp +@ cdecl -arch=i386,x86_64,arm -norelay _setjmp(ptr) msvcrt._setjmp @ cdecl -arch=i386 -norelay _setjmp3(ptr long) msvcrt._setjmp3 @ cdecl _setmaxstdio(long) msvcrt._setmaxstdio @ cdecl _setmbcp(long) msvcrt._setmbcp @@ -723,7 +723,7 @@ @ cdecl localtime(ptr) msvcrt.localtime @ cdecl log(double) msvcrt.log @ cdecl log10(double) msvcrt.log10 -@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp +@ cdecl -arch=i386,x86_64,arm longjmp(ptr long) msvcrt.longjmp @ cdecl malloc(long) msvcrt.malloc @ cdecl mblen(ptr long) msvcrt.mblen @ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs diff --git a/include/msvcrt/setjmp.h b/include/msvcrt/setjmp.h index 246837325b7..3c8b9fdc750 100644 --- a/include/msvcrt/setjmp.h +++ b/include/msvcrt/setjmp.h @@ -81,6 +81,28 @@ typedef struct _JUMP_BUFFER #define _JBLEN 16 typedef SETJMP_FLOAT128 _JBTYPE; +#elif defined(__arm__) + +typedef struct _JUMP_BUFFER +{ + unsigned long Frame; + unsigned long R4; + unsigned long R5; + unsigned long R6; + unsigned long R7; + unsigned long R8; + unsigned long R9; + unsigned long R10; + unsigned long R11; + unsigned long Sp; + unsigned long Pc; + unsigned long Fpscr; + unsigned long long D[8]; +} _JUMP_BUFFER; + +#define _JBLEN 28 +#define _JBTYPE int + #else #define _JBLEN 1 diff --git a/include/winnt.h b/include/winnt.h index d4e5cb41bf4..711cda8d2ac 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -1628,6 +1628,45 @@ typedef struct _CONTEXT #define EXCEPTION_WRITE_FAULT 1 #define EXCEPTION_EXECUTE_FAULT 8 +typedef struct _RUNTIME_FUNCTION +{ + DWORD BeginAddress; + union { + DWORD UnwindData; + struct { + DWORD Flag : 2; + DWORD FunctionLength : 11; + DWORD Ret : 2; + DWORD H : 1; + DWORD Reg : 3; + DWORD R : 1; + DWORD L : 1; + DWORD C : 1; + DWORD StackAdjust : 10; + } DUMMYSTRUCTNAME; + } DUMMYUNIONNAME; +} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION; + +#define UNWIND_HISTORY_TABLE_SIZE 12 + +typedef struct _UNWIND_HISTORY_TABLE_ENTRY +{ + DWORD ImageBase; + PRUNTIME_FUNCTION FunctionEntry; +} UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY; + +typedef struct _UNWIND_HISTORY_TABLE +{ + DWORD Count; + BYTE LocalHint; + BYTE GlobalHint; + BYTE Search; + BYTE Once; + DWORD LowAddress; + DWORD HighAddress; + UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE]; +} UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE; + typedef struct _CONTEXT { /* The flags values within this flag control the contents of a CONTEXT record.