Commit 37af4c37 authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Implement longjmp for x86_64.

parent 9b76c16e
......@@ -426,7 +426,7 @@
@ cdecl localtime(ptr) msvcrt.localtime
@ cdecl log(double) msvcrt.log
@ cdecl log10(double) msvcrt.log10
@ cdecl -i386 longjmp(ptr long) msvcrt.longjmp
@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp
@ cdecl malloc(long) msvcrt.malloc
@ cdecl mblen(ptr long) msvcrt.mblen
@ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs
......
......@@ -1522,7 +1522,7 @@
@ cdecl localeconv() msvcrt.localeconv
@ cdecl log(double) msvcrt.log
@ cdecl log10(double) msvcrt.log10
@ cdecl -i386 longjmp(ptr long) msvcrt.longjmp
@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp
@ cdecl malloc(long) msvcrt.malloc
@ cdecl mblen(ptr long) msvcrt.mblen
@ stub mbrlen
......
......@@ -771,7 +771,7 @@
@ cdecl localtime(ptr) msvcrt.localtime
@ cdecl log(double) msvcrt.log
@ cdecl log10(double) msvcrt.log10
@ cdecl -i386 longjmp(ptr long) msvcrt.longjmp
@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp
@ cdecl malloc(long) msvcrt.malloc
@ cdecl mblen(ptr long) msvcrt.mblen
@ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs
......
......@@ -402,7 +402,7 @@
@ cdecl _lock(long) msvcrt._lock
@ cdecl _locking(long long long) msvcrt._locking
@ cdecl _logb(double) msvcrt._logb
@ cdecl _longjmpex(ptr long) msvcrt._longjmpex
@ cdecl -arch=i386 _longjmpex(ptr long) msvcrt._longjmpex
@ cdecl _lrotl(long long) msvcrt._lrotl
@ cdecl _lrotr(long long) msvcrt._lrotr
@ cdecl _lsearch(ptr ptr long long ptr) msvcrt._lsearch
......@@ -767,7 +767,7 @@
@ cdecl localtime(ptr) msvcrt.localtime
@ cdecl log(double) msvcrt.log
@ cdecl log10(double) msvcrt.log10
@ cdecl -i386 longjmp(ptr long) msvcrt.longjmp
@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp
@ cdecl malloc(long) msvcrt.malloc
@ cdecl mblen(ptr long) msvcrt.mblen
@ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs
......
......@@ -1376,7 +1376,7 @@
@ cdecl localeconv() msvcrt.localeconv
@ cdecl log(double) msvcrt.log
@ cdecl log10(double) msvcrt.log10
@ cdecl -i386 longjmp(ptr long) msvcrt.longjmp
@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp
@ cdecl malloc(long) msvcrt.malloc
@ cdecl mblen(ptr long) msvcrt.mblen
@ stub mbrlen
......
......@@ -1360,7 +1360,7 @@
@ cdecl localeconv() msvcrt.localeconv
@ cdecl log(double) msvcrt.log
@ cdecl log10(double) msvcrt.log10
@ cdecl -i386 longjmp(ptr long) msvcrt.longjmp
@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp
@ cdecl malloc(long) msvcrt.malloc
@ cdecl mblen(ptr long) msvcrt.mblen
@ stub mbrlen
......
......@@ -26,6 +26,8 @@
#include <stdarg.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
......@@ -554,6 +556,53 @@ __ASM_GLOBAL_FUNC( MSVCRT__setjmpex,
"xorq %rax,%rax\n\t"
"retq" );
extern void DECLSPEC_NORETURN CDECL longjmp_set_regs( struct MSVCRT___JUMP_BUFFER *jmp, int retval );
__ASM_GLOBAL_FUNC( longjmp_set_regs,
"movq %rdx,%rax\n\t" /* retval */
"movq 0x8(%rcx),%rbx\n\t" /* jmp_buf->Rbx */
"movq 0x18(%rcx),%rbp\n\t" /* jmp_buf->Rbp */
"movq 0x20(%rcx),%rsi\n\t" /* jmp_buf->Rsi */
"movq 0x28(%rcx),%rdi\n\t" /* jmp_buf->Rdi */
"movq 0x30(%rcx),%r12\n\t" /* jmp_buf->R12 */
"movq 0x38(%rcx),%r13\n\t" /* jmp_buf->R13 */
"movq 0x40(%rcx),%r14\n\t" /* jmp_buf->R14 */
"movq 0x48(%rcx),%r15\n\t" /* jmp_buf->R15 */
"movdqa 0x60(%rcx),%xmm6\n\t" /* jmp_buf->Xmm6 */
"movdqa 0x70(%rcx),%xmm7\n\t" /* jmp_buf->Xmm7 */
"movdqa 0x80(%rcx),%xmm8\n\t" /* jmp_buf->Xmm8 */
"movdqa 0x90(%rcx),%xmm9\n\t" /* jmp_buf->Xmm9 */
"movdqa 0xa0(%rcx),%xmm10\n\t" /* jmp_buf->Xmm10 */
"movdqa 0xb0(%rcx),%xmm11\n\t" /* jmp_buf->Xmm11 */
"movdqa 0xc0(%rcx),%xmm12\n\t" /* jmp_buf->Xmm12 */
"movdqa 0xd0(%rcx),%xmm13\n\t" /* jmp_buf->Xmm13 */
"movdqa 0xe0(%rcx),%xmm14\n\t" /* jmp_buf->Xmm14 */
"movdqa 0xf0(%rcx),%xmm15\n\t" /* jmp_buf->Xmm15 */
"movq 0x50(%rcx),%rdx\n\t" /* jmp_buf->Rip */
"movq 0x10(%rcx),%rsp\n\t" /* jmp_buf->Rsp */
"jmp *%rdx" );
/*******************************************************************
* 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->Rip, &rec, IntToPtr(retval) );
}
longjmp_set_regs( jmp, retval );
}
#endif /* __x86_64__ */
static MSVCRT___sighandler_t sighandlers[MSVCRT_NSIG] = { MSVCRT_SIG_DFL };
......
......@@ -306,6 +306,36 @@ struct MSVCRT___JUMP_BUFFER {
unsigned long UnwindFunc;
unsigned long UnwindData[6];
};
#elif defined(__x86_64__)
struct MSVCRT__SETJMP_FLOAT128
{
unsigned __int64 DECLSPEC_ALIGN(16) Part[2];
};
struct MSVCRT___JUMP_BUFFER
{
unsigned __int64 Frame;
unsigned __int64 Rbx;
unsigned __int64 Rsp;
unsigned __int64 Rbp;
unsigned __int64 Rsi;
unsigned __int64 Rdi;
unsigned __int64 R12;
unsigned __int64 R13;
unsigned __int64 R14;
unsigned __int64 R15;
unsigned __int64 Rip;
unsigned __int64 Spare;
struct MSVCRT__SETJMP_FLOAT128 Xmm6;
struct MSVCRT__SETJMP_FLOAT128 Xmm7;
struct MSVCRT__SETJMP_FLOAT128 Xmm8;
struct MSVCRT__SETJMP_FLOAT128 Xmm9;
struct MSVCRT__SETJMP_FLOAT128 Xmm10;
struct MSVCRT__SETJMP_FLOAT128 Xmm11;
struct MSVCRT__SETJMP_FLOAT128 Xmm12;
struct MSVCRT__SETJMP_FLOAT128 Xmm13;
struct MSVCRT__SETJMP_FLOAT128 Xmm14;
struct MSVCRT__SETJMP_FLOAT128 Xmm15;
};
#endif /* __i386__ */
struct MSVCRT__diskfree_t {
......
......@@ -1314,7 +1314,7 @@
@ cdecl log10(double) MSVCRT_log10
@ cdecl -arch=x86_64 logf(float) MSVCRT_logf
@ cdecl -arch=x86_64 log10f(float) MSVCRT_log10f
@ cdecl -i386 longjmp(ptr long) MSVCRT_longjmp
@ cdecl -arch=i386,x86_64 longjmp(ptr long) MSVCRT_longjmp
@ cdecl malloc(long) MSVCRT_malloc
@ cdecl mblen(ptr long) MSVCRT_mblen
# stub mbrlen
......
......@@ -672,7 +672,7 @@
@ cdecl _local_unwind2(ptr long) msvcrt._local_unwind2
@ cdecl _locking(long long long) msvcrt._locking
@ cdecl _logb(double) msvcrt._logb
@ cdecl _longjmpex(ptr long) msvcrt._longjmpex
@ cdecl -arch=i386 _longjmpex(ptr long) msvcrt._longjmpex
@ cdecl _lrotl(long long) msvcrt._lrotl
@ cdecl _lrotr(long long) msvcrt._lrotr
@ cdecl _lsearch(ptr ptr long long ptr) msvcrt._lsearch
......@@ -1027,7 +1027,7 @@
@ cdecl localtime(ptr) msvcrt.localtime
@ cdecl log(double) msvcrt.log
@ cdecl log10(double) msvcrt.log10
@ cdecl -i386 longjmp(ptr long) msvcrt.longjmp
@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp
@ cdecl malloc(long) msvcrt.malloc
@ cdecl mblen(ptr long) msvcrt.mblen
@ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs
......
......@@ -757,7 +757,7 @@
@ cdecl _local_unwind2(ptr long) msvcrt._local_unwind2
@ cdecl _locking(long long long) msvcrt._locking
@ cdecl _logb(double) msvcrt._logb
@ cdecl _longjmpex(ptr long) msvcrt._longjmpex
@ cdecl -arch=i386 _longjmpex(ptr long) msvcrt._longjmpex
@ cdecl _lrotl(long long) msvcrt._lrotl
@ cdecl _lrotr(long long) msvcrt._lrotr
@ cdecl _lsearch(ptr ptr long long ptr) msvcrt._lsearch
......@@ -1089,7 +1089,7 @@
@ cdecl localtime(ptr) msvcrt.localtime
@ cdecl log(double) msvcrt.log
@ cdecl log10(double) msvcrt.log10
@ cdecl -i386 longjmp(ptr long) msvcrt.longjmp
@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp
@ cdecl malloc(long) msvcrt.malloc
@ cdecl mblen(ptr long) msvcrt.mblen
@ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs
......
......@@ -721,7 +721,7 @@
@ cdecl localtime(ptr) msvcrt.localtime
@ cdecl log(double) msvcrt.log
@ cdecl log10(double) msvcrt.log10
@ cdecl -i386 longjmp(ptr long) msvcrt.longjmp
@ cdecl -arch=i386,x86_64 longjmp(ptr long) msvcrt.longjmp
@ cdecl malloc(long) msvcrt.malloc
@ cdecl mblen(ptr long) msvcrt.mblen
@ cdecl mbstowcs(ptr str long) ntdll.mbstowcs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment