[context] Windows x64 fiber local storage GS offset

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[context] Windows x64 fiber local storage GS offset

Boost - Dev mailing list
The Windows x64 implementation of Boost.Context saves fiber local storage
from GS:[0x18]. For example, in jump_x86_64_ms_pe_masm.asm:

; load NT_TIB
mov  r10,  gs:[030h]
; save fiber local storage
mov  rax, [r10+018h]
mov  [rsp+0b0h], rax

However, this is the NT_TIB struct as defined in winnt.h

typedef struct _NT_TIB {
    struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
    PVOID StackBase;
    PVOID StackLimit;
    PVOID SubSystemTib;
    union {
        PVOID FiberData;
        DWORD Version;
    };
    PVOID ArbitraryUserPointer;
    struct _NT_TIB *Self;
} NT_TIB;

This implies that fiber local storage is found in GS:[0x20], not GS:[0x18].

The Windows x86 implementation uses FS:[0x10], which is consistent with the
NT_TIB struct.

Am I missing something, or does Boost.Context save/restore fiber local
storage at the wrong address in Windows x64?

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [context] Windows x64 fiber local storage GS offset

Boost - Dev mailing list
you are right, I've fixed the files
ty

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [context] Windows x64 fiber local storage GS offset

Boost - Dev mailing list

> you are right, I've fixed the files

Great, that made HPX work again when using Boost.Context on Windows (x64).

Thanks!
Regards Hartmut
---------------
http://boost-spirit.com
http://stellar.cct.lsu.edu




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [context] Windows x64 fiber local storage GS offset

Boost - Dev mailing list
2017-05-20 17:30 GMT+02:00 Hartmut Kaiser <[hidden email]>:

>
> > you are right, I've fixed the files
>
> Great, that made HPX work again when using Boost.Context on Windows (x64).
>

I suggest you do an extensive testing - Windows is not my target
development platform ...

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost