Don't use wine's headers and wintrnl.h for exception handling in crt. Instead include ndk and add the few definitions we need to cppexcept.h

svn path=/trunk/; revision=38278
This commit is contained in:
Timo Kreuzer 2008-12-22 20:32:47 +00:00
parent 53c3a69e0c
commit 6da76aad1d
5 changed files with 59 additions and 49 deletions

View file

@ -19,28 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/config.h"
#include "wine/port.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winternl.h"
#include "wine/exception.h"
#include "winnt.h"
#include "excpt.h"
#include "wine/debug.h"
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>
#include <precomp.h>
#include <internal/wine/msvcrt.h>
#include <internal/wine/cppexcept.h>
#include <internal/mtdll.h>
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
typedef exception bad_cast;
typedef exception bad_typeid;
@ -76,7 +58,6 @@ typedef struct _rtti_object_locator
const rtti_object_hierarchy *type_hierarchy;
} rtti_object_locator;
#ifdef __i386__ /* thiscall functions are i386-specific */
#define THISCALL(func) __thiscall_ ## func

View file

@ -23,20 +23,11 @@
* www.thecodeproject.com.
*/
#include "wine/config.h"
#include "wine/port.h"
#define __WINE_DEBUG_CHANNEL__
#include <precomp.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winternl.h"
#include <internal/wine/msvcrt.h>
#include "wine/exception.h"
#include "excpt.h"
#include "wine/debug.h"
#include <internal/wine/cppexcept.h>
#ifdef __i386__ /* CxxFrameHandler is not supported on non-i386 */
@ -328,7 +319,7 @@ static inline void call_catch_block( PEXCEPTION_RECORD rec, cxx_exception_frame
/* setup an exception block for nested exceptions */
nested_frame.frame.Handler = (PEXCEPTION_HANDLER)catch_function_nested_handler;
nested_frame.frame.Handler = (PEXCEPTION_ROUTINE)catch_function_nested_handler;
nested_frame.prev_rec = thread_data->exc_record;
nested_frame.cxx_frame = frame;
nested_frame.descr = descr;

View file

@ -21,6 +21,57 @@
#ifndef __MSVCRT_CPPEXCEPT_H
#define __MSVCRT_CPPEXCEPT_H
#include <pseh/pseh2.h>
/* Macros to define assembler functions somewhat portably */
#define __ASM_FUNC(name) ".def " __ASM_NAME(name) "; .scl 2; .type 32; .endef"
#define __ASM_NAME(name) "_" name
#ifdef __GNUC__
# define __ASM_GLOBAL_FUNC(name,code) \
__asm__( ".align 4\n\t" \
".globl " __ASM_NAME(#name) "\n\t" \
__ASM_FUNC(#name) "\n" \
__ASM_NAME(#name) ":\n\t" \
code );
#else /* __GNUC__ */
# define __ASM_GLOBAL_FUNC(name,code) \
void __asm_dummy_##name(void) { \
asm( ".align 4\n\t" \
".globl " __ASM_NAME(#name) "\n\t" \
__ASM_FUNC(#name) "\n" \
__ASM_NAME(#name) ":\n\t" \
code ); \
}
#endif /* __GNUC__ */
#define EH_NONCONTINUABLE 0x01
#define EH_UNWINDING 0x02
#define EH_EXIT_UNWIND 0x04
#define EH_STACK_INVALID 0x08
#define EH_NESTED_CALL 0x10
static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame )
{
frame->Next = (struct _EXCEPTION_REGISTRATION_RECORD *)__readfsdword(0);
__writefsdword(0, (unsigned long)frame);
return frame->Next;
}
static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTRATION_RECORD *frame )
{
__writefsdword(0, (unsigned long)frame->Next);
return frame->Next;
}
#define __TRY _SEH2_TRY
#define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation()))
#define __EXCEPT_PAGE_FAULT _SEH2_EXCEPT(_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION)
#define __EXCEPT_ALL _SEH2_EXCEPT(_SEH_EXECUTE_HANDLER)
#define __ENDTRY _SEH2_END
#define __FINALLY(func) _SEH2_FINALLY { func(!_SEH2_AbnormalTermination()); }
#define CXX_FRAME_MAGIC 0x19930520
#define CXX_EXCEPTION 0xe06d7363

View file

@ -39,7 +39,9 @@
/* kernelmode libcnt should not include Wine-debugging crap */
#ifndef _LIBCNT_
#include "wine/debug.h"
#ifndef __WINE_DEBUG_CHANNEL__
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
#endif
#else
#include <debug.h>
#define TRACE DPRINT

View file

@ -19,27 +19,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "wine/config.h"
#include "wine/port.h"
#define __WINE_DEBUG_CHANNEL__
#include <precomp.h>
#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winternl.h"
#include "wine/exception.h"
#include "winnt.h"
#include "excpt.h"
#include "wine/debug.h"
#include <malloc.h>
#include <stdlib.h>
#include <internal/wine/msvcrt.h>
#include <internal/wine/cppexcept.h>
#include <internal/mtdll.h>
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);