[Issue 9025] core.thread.Fiber seems to crash on Win64

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 15 00:01:43 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=9025



--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> 2012-11-15 00:01:38 PST ---
(In reply to comment #1)
> qword means 4 bytes, and you can't push 4 bytes in 64 bit mode. Only 8 bytes.

Aggh, that's wrong.

The source code is in src/core/thread.d, and looks like:


----------------------------------------------
                // save current stack state
                push RBP;
                mov  RBP, RSP;
                push RBX;
                push R12;
                push R13;
                push R14;
                push R15;
                push qword ptr GS:[0];
                push qword ptr GS:[8];
                push qword ptr GS:[16];

                // store oldp
                mov [RDI], RSP;
                // load newp to begin context switch
                mov RSP, RSI;

                // load saved state from new stack
                pop qword ptr GS:[16];
                pop qword ptr GS:[8];
                pop qword ptr GS:[0];
                pop R15;
                pop R14;
                pop R13;
                pop R12;
                pop RBX;
                pop RBP;

                // 'return' to complete switch
                pop RCX;
                jmp RCX;
----------------------------------------
So, if you could disassemble the code, it should be GS:[0], but I suspect the
assembler made it an offset from the program counter.

To fix,
                 xor RAX,RAX
                 push qword ptr GS:[RAX]
                 push qwork ptr GS:8[RAX]
                 ... etc. ...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list