Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/CtxSwitch-x86_64.S

    r212c2187 r63364d8  
    3939#define SP_OFFSET       ( 0 * PTR_BYTE )
    4040#define FP_OFFSET       ( 1 * PTR_BYTE )
    41 #define PC_OFFSET       ( 2 * PTR_BYTE )
    4241
    43 .text
     42//-----------------------------------------------------------------------------
     43// Regular context switch routine which enables switching from one context to anouther
     44        .text
    4445        .align 2
    45 .globl  CtxSwitch
     46        .globl CtxSwitch
     47        .type  CtxSwitch, @function
    4648CtxSwitch:
    47 
    48         // Save floating & SSE control words on the stack.
    49 
    50         subq   $8,%rsp
    51         stmxcsr 0(%rsp)         // 4 bytes
    52         fnstcw  4(%rsp)         // 2 bytes
    5349
    5450        // Save volatile registers on the stack.
     
    7874        popq %r15
    7975
    80         // Load floating & SSE control words from the stack.
    81 
    82         fldcw   4(%rsp)
    83         ldmxcsr 0(%rsp)
    84         addq   $8,%rsp
    85 
    8676        // Return to thread.
    8777
    8878        ret
     79        .size  CtxSwitch, .-CtxSwitch
    8980
    90 //.text
    91 //      .align 2
    92 //.globl        CtxStore
    93 //CtxStore:
    94 //      // Save floating & SSE control words on the stack.
    95 //
    96 //      subq   $8,%rsp
    97 //      stmxcsr 0(%rsp)         // 4 bytes
    98 //      fnstcw  4(%rsp)         // 2 bytes
    99 //
    100 //      // Save volatile registers on the stack.
    101 //
    102 //      pushq %r15
    103 //      pushq %r14
    104 //      pushq %r13
    105 //      pushq %r12
    106 //      pushq %rbx
    107 //
    108 //      // Save old context in the "from" area.
    109 //
    110 //      movq %rsp,SP_OFFSET(%rdi)
    111 //      movq %rbp,FP_OFFSET(%rdi)
    112 //
    113 //      // Return to thread
    114 //
    115 //      ret
    116 //
    117 //.text
    118 //      .align 2
    119 //.globl        CtxRet
    120 //CtxRet:
    121 //      // Load new context from the "to" area.
    122 //
    123 //      movq SP_OFFSET(%rdi),%rsp
    124 //      movq FP_OFFSET(%rdi),%rbp
    125 //
    126 //      // Load volatile registers from the stack.
    127 //
    128 //      popq %rbx
    129 //      popq %r12
    130 //      popq %r13
    131 //      popq %r14
    132 //      popq %r15
    133 //
    134 //      // Load floating & SSE control words from the stack.
    135 //
    136 //      fldcw   4(%rsp)
    137 //      ldmxcsr 0(%rsp)
    138 //      addq   $8,%rsp
    139 //
    140 //      // Return to thread.
    141 //
    142 //      ret
    143 
    144 
    145 .text
     81//-----------------------------------------------------------------------------
     82// Stub used to create new stacks which are ready to be context switched to
     83        .text
    14684        .align 2
    147 .globl  CtxInvokeStub
     85        .globl CtxInvokeStub
     86        .type    CtxInvokeStub, @function
    14887CtxInvokeStub:
    14988        movq %rbx, %rdi
    15089        jmp *%r12
     90        .size  CtxInvokeStub, .-CtxInvokeStub
    15191
    15292// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.