Ticket #2038: Thread.d.64bit.patch
File Thread.d.64bit.patch, 3.5 kB (added by Marenz, 13 years ago) |
---|
replaced inout with ref |
-
tango/core/Thread.d
old new 348 348 { 349 349 __builtin_unwind_init(); 350 350 } 351 else version ( D_InlineAsm_X86_64 ) 352 { 353 asm 354 { 355 // Not sure what goes here, pushad is invalid in 64 bit code 356 push RAX ; 357 push RBX ; 358 push RCX ; 359 push RDX ; 360 push RSI ; 361 push RDI ; 362 push RBP ; 363 push R8 ; 364 push R9 ; 365 push R10 ; 366 push R11 ; 367 push R12 ; 368 push R13 ; 369 push R14 ; 370 push R15 ; 371 push EAX ; // 16 byte align the stack 372 } 373 } 351 374 else 352 375 { 353 376 static assert( false, "Architecture not supported." ); … … 411 434 { 412 435 // registers will be popped automatically 413 436 } 437 else version ( D_InlineAsm_X86_64 ) 438 { 439 asm 440 { 441 // Not sure what goes here, popad is invalid in 64 bit code 442 pop EAX ; // 16 byte align the stack 443 pop R15 ; 444 pop R14 ; 445 pop R13 ; 446 pop R12 ; 447 pop R11 ; 448 pop R10 ; 449 pop R9 ; 450 pop R8 ; 451 pop RBP ; 452 pop RDI ; 453 pop RSI ; 454 pop RDX ; 455 pop RCX ; 456 pop RBX ; 457 pop RAX ; 458 } 459 } 414 460 else 415 461 { 416 462 static assert( false, "Architecture not supported." ); … … 2670 2716 } 2671 2717 else version( AsmX86_64_Posix ) 2672 2718 { 2673 asm2719 version( DigitalMars ) asm 2674 2720 { 2675 2721 naked; 2676 2722 2677 2723 // save current stack state 2724 push RBP; 2725 mov RBP, RSP; 2726 push RBX; 2727 push R12; 2728 push R13; 2729 push R14; 2730 push R15; 2731 sub RSP, 4; 2732 stmxcsr [RSP]; 2733 sub RSP, 4; 2734 //version(SynchroFloatExcept){ 2735 fstcw [RSP]; 2736 fwait; 2737 //} else { 2738 // fnstcw [RSP]; 2739 // fnclex; 2740 //} 2741 2742 // store oldp again with more accurate address 2743 mov [RDI], RSP; 2744 // load newp to begin context switch 2745 mov RSP, RSI; 2746 2747 // load saved state from new stack 2748 fldcw [RSP]; 2749 add RSP, 4; 2750 ldmxcsr [RSP]; 2751 add RSP, 4; 2752 pop R15; 2753 pop R14; 2754 pop R13; 2755 pop R12; 2756 2757 pop RBX; 2758 pop RBP; 2759 2760 // 'return' to complete switch 2761 ret; 2762 2763 } 2764 else asm 2765 { 2766 naked; 2767 2768 // save current stack state 2678 2769 pushq RBP; 2679 2770 mov RBP, RSP; 2680 2771 pushq RBX;