ntdll: Allow Unix libraries to use exception macros.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1be12eaa94
commit
2ec2e136bf
|
@ -61,7 +61,6 @@
|
|||
#include "windef.h"
|
||||
#include "winnt.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/exception.h"
|
||||
#include "wine/asm.h"
|
||||
#include "unix_private.h"
|
||||
#include "wine/debug.h"
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
#include "windef.h"
|
||||
#include "winnt.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/exception.h"
|
||||
#include "wine/asm.h"
|
||||
#include "unix_private.h"
|
||||
#include "wine/debug.h"
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
#include "winternl.h"
|
||||
#include "ddk/wdm.h"
|
||||
#include "wine/asm.h"
|
||||
#include "wine/exception.h"
|
||||
#include "unix_private.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
|
|
@ -75,7 +75,6 @@
|
|||
#include "windef.h"
|
||||
#include "winternl.h"
|
||||
#include "ddk/wdm.h"
|
||||
#include "wine/exception.h"
|
||||
#include "wine/list.h"
|
||||
#include "wine/asm.h"
|
||||
#include "unix_private.h"
|
||||
|
|
|
@ -1737,6 +1737,16 @@ NTSTATUS get_thread_context( HANDLE handle, void *context, BOOL *self, USHORT ma
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* ntdll_set_exception_jmp_buf
|
||||
*/
|
||||
void ntdll_set_exception_jmp_buf( __wine_jmp_buf *jmp )
|
||||
{
|
||||
assert( !jmp || !ntdll_get_thread_data()->jmp_buf );
|
||||
ntdll_get_thread_data()->jmp_buf = jmp;
|
||||
}
|
||||
|
||||
|
||||
BOOL get_thread_times(int unix_pid, int unix_tid, LARGE_INTEGER *kernel_time, LARGE_INTEGER *user_time)
|
||||
{
|
||||
#ifdef linux
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
#include "windef.h"
|
||||
#include "winnt.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/exception.h"
|
||||
#include "wine/list.h"
|
||||
#include "wine/rbtree.h"
|
||||
#include "unix_private.h"
|
||||
|
@ -104,35 +103,6 @@ struct file_view
|
|||
unsigned int protect; /* protection for all pages at allocation time and SEC_* flags */
|
||||
};
|
||||
|
||||
#undef __TRY
|
||||
#undef __EXCEPT
|
||||
#undef __ENDTRY
|
||||
|
||||
#define __TRY \
|
||||
do { __wine_jmp_buf __jmp; \
|
||||
int __first = 1; \
|
||||
assert( !ntdll_get_thread_data()->jmp_buf ); \
|
||||
for (;;) if (!__first) \
|
||||
{ \
|
||||
do {
|
||||
|
||||
#define __EXCEPT \
|
||||
} while(0); \
|
||||
ntdll_get_thread_data()->jmp_buf = NULL; \
|
||||
break; \
|
||||
} else { \
|
||||
if (__wine_setjmpex( &__jmp, NULL )) { \
|
||||
do {
|
||||
|
||||
#define __ENDTRY \
|
||||
} while (0); \
|
||||
break; \
|
||||
} \
|
||||
ntdll_get_thread_data()->jmp_buf = &__jmp; \
|
||||
__first = 0; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
/* per-page protection flags */
|
||||
#define VPROT_READ 0x01
|
||||
#define VPROT_WRITE 0x02
|
||||
|
|
|
@ -26,6 +26,8 @@ typedef UINT64 unixlib_handle_t;
|
|||
|
||||
extern NTSTATUS WINAPI __wine_unix_call( unixlib_handle_t handle, unsigned int code, void *args );
|
||||
|
||||
#ifdef WINE_UNIX_LIB
|
||||
|
||||
/* some useful helpers from ntdll */
|
||||
extern const char *ntdll_get_build_dir(void);
|
||||
extern const char *ntdll_get_data_dir(void);
|
||||
|
@ -33,4 +35,49 @@ extern DWORD ntdll_umbstowcs( const char *src, DWORD srclen, WCHAR *dst, DWORD d
|
|||
extern int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BOOL strict );
|
||||
extern NTSTATUS ntdll_init_syscalls( ULONG id, SYSTEM_SERVICE_TABLE *table, void **dispatcher );
|
||||
|
||||
/* exception handling */
|
||||
|
||||
#ifdef __i386__
|
||||
typedef struct { int reg[16]; } __wine_jmp_buf;
|
||||
#elif defined(__x86_64__)
|
||||
typedef struct { DECLSPEC_ALIGN(16) struct { unsigned __int64 Part[2]; } reg[16]; } __wine_jmp_buf;
|
||||
#elif defined(__arm__)
|
||||
typedef struct { int reg[28]; } __wine_jmp_buf;
|
||||
#elif defined(__aarch64__)
|
||||
typedef struct { __int64 reg[24]; } __wine_jmp_buf;
|
||||
#else
|
||||
typedef struct { int reg; } __wine_jmp_buf;
|
||||
#endif
|
||||
|
||||
extern int __cdecl __attribute__ ((__nothrow__,__returns_twice__)) __wine_setjmpex( __wine_jmp_buf *buf,
|
||||
EXCEPTION_REGISTRATION_RECORD *frame );
|
||||
extern void DECLSPEC_NORETURN __cdecl __wine_longjmp( __wine_jmp_buf *buf, int retval );
|
||||
extern void ntdll_set_exception_jmp_buf( __wine_jmp_buf *jmp );
|
||||
|
||||
#define __TRY \
|
||||
do { __wine_jmp_buf __jmp; \
|
||||
int __first = 1; \
|
||||
for (;;) if (!__first) \
|
||||
{ \
|
||||
do {
|
||||
|
||||
#define __EXCEPT \
|
||||
} while(0); \
|
||||
ntdll_set_exception_jmp_buf( NULL ); \
|
||||
break; \
|
||||
} else { \
|
||||
if (__wine_setjmpex( &__jmp, NULL )) { \
|
||||
do {
|
||||
|
||||
#define __ENDTRY \
|
||||
} while (0); \
|
||||
break; \
|
||||
} \
|
||||
ntdll_set_exception_jmp_buf( &__jmp ); \
|
||||
__first = 0; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#endif /* WINE_UNIX_LIB */
|
||||
|
||||
#endif /* __WINE_WINE_UNIXLIB_H */
|
||||
|
|
Loading…
Reference in New Issue