--- libs\context\src\asm\fcontext_i386_ms_pe_masm.asm 2012-04-23 22:19:15.000000000 +0100 +++ libs\context\src\asm\fcontext_i386_ms_pe_masm.asm 2012-06-16 12:04:38.000000000 +0100 @@ -40,18 +40,18 @@ ; | fc_mxcsr|fc_x87_cw| | ; -------------------------------------------------------------- .386 .XMM .model flat, c -_exit PROTO, value:SDWORD +_exit PROTO, value:SDWORD align_stack PROTO, vp:DWORD seh_fcontext PROTO, except:DWORD, frame:DWORD, context:DWORD, dispatch:DWORD .code -jump_fcontext PROC EXPORT +jump_fcontext_impl PROC mov ecx, [esp+04h] ; load address of the first fcontext_t arg mov [ecx], edi ; save EDI mov [ecx+04h], esi ; save ESI mov [ecx+08h], ebx ; save EBX mov [ecx+0ch], ebp ; save EBP @@ -104,15 +104,15 @@ mov esp, [ecx+010h] ; restore ESP mov [esp+04h], eax ; use third arg as first arg in context function mov ecx, [ecx+014h] ; fetch the address to return to jmp ecx ; indirect jump to context -jump_fcontext ENDP +jump_fcontext_impl ENDP -make_fcontext PROC EXPORT +make_fcontext_impl PROC mov eax, [esp+04h] ; load address of the fcontext_t arg0 mov [eax], eax ; save the address of passed context mov ecx, [esp+08h] ; load the address of the context function mov [eax+014h], ecx ; save the address of the context function mov edx, [eax+018h] ; load the stack base @@ -144,8 +144,8 @@ finish: xor eax, eax push eax ; exit code is zero call _exit ; exit application hlt -make_fcontext ENDP +make_fcontext_impl ENDP END --- libs\context\src\asm\fcontext_x86_64_ms_pe_masm.asm 2012-04-23 22:10:53.000000000 +0100 +++ libs\context\src\asm\fcontext_x86_64_ms_pe_masm.asm 2012-06-06 23:14:33.000000000 +0100 @@ -84,13 +84,13 @@ EXTERN _exit:PROC ; standard C library function EXTERN align_stack:PROC ; stack alignment EXTERN seh_fcontext:PROC ; exception handler .code -jump_fcontext PROC EXPORT FRAME:seh_fcontext +jump_fcontext_impl PROC FRAME:seh_fcontext .endprolog mov [rcx], r12 ; save R12 mov [rcx+08h], r13 ; save R13 mov [rcx+010h], r14 ; save R14 mov [rcx+018h], r15 ; save R15 @@ -165,15 +165,15 @@ mov r10, [rdx+048h] ; fetch the address to returned to mov rax, r8 ; use third arg as return value after jump mov rcx, r8 ; use third arg as first arg in context function jmp r10 ; indirect jump to caller -jump_fcontext ENDP +jump_fcontext_impl ENDP -make_fcontext PROC EXPORT FRAME ; generate function table entry in .pdata and unwind information in E +make_fcontext_impl PROC FRAME ; generate function table entry in .pdata and unwind information in E .endprolog ; .xdata for a function's structured exception handling unwind behavior mov [rcx], rcx ; store the address of current context mov [rcx+048h], rdx ; save the address of the function supposed to run mov rdx, [rcx+050h] ; load the address where the context stack beginns @@ -200,8 +200,8 @@ finish: xor rcx, rcx mov [rsp+08h], rcx call _exit ; exit application hlt -make_fcontext ENDP +make_fcontext_impl ENDP END --- libs\context\src\fcontext.cpp 2012-05-22 21:02:04.000000000 +0100 +++ libs\context\src\fcontext.cpp 2012-06-16 12:02:53.000000000 +0100 @@ -26,11 +26,29 @@ base = ( char * ) ( ( ( ( uintptr_t) base) - 15) & ~0x0F); return base; } } +// HACK: GNU linker doesn't understand masm's EXPORT directive. +extern "C" +intptr_t BOOST_CONTEXT_CALLDECL jump_fcontext_impl( fcontext_t * ofc, fcontext_t const* nfc, intptr_t vp, bool preserve_fpu); +extern "C" +void BOOST_CONTEXT_CALLDECL make_fcontext_impl( fcontext_t * fc, void (* fn)( intptr_t) ); + +extern "C" BOOST_CONTEXT_DECL +intptr_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t * ofc, fcontext_t const* nfc, intptr_t vp, bool preserve_fpu) +{ + return jump_fcontext_impl(ofc, nfc, vp, preserve_fpu); +} + +extern "C" BOOST_CONTEXT_DECL +void BOOST_CONTEXT_CALLDECL make_fcontext( fcontext_t * fc, void (* fn)( intptr_t) ) +{ + make_fcontext_impl(fc, fn); +} + }} #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif