Changeset 636d115b


Ignore:
Timestamp:
Aug 21, 2020, 7:44:29 AM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c5cbc099
Parents:
d685cb0
Message:

formatting, documentation

Location:
libcfa/src/concurrency
Files:
2 edited

Legend:

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

    rd685cb0 r636d115b  
    1010// Created On       : Tue Dec 6 12:27:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 21 22:29:25 2017
    13 // Update Count     : 1
    14 //
    15 // This  library is free  software; you  can redistribute  it and/or  modify it
    16 // under the terms of the GNU Lesser General Public License as published by the
    17 // Free Software  Foundation; either  version 2.1 of  the License, or  (at your
    18 // option) any later version.
    19 //
    20 // This library is distributed in the  hope that it will be useful, but WITHOUT
    21 // ANY  WARRANTY;  without even  the  implied  warranty  of MERCHANTABILITY  or
    22 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
    23 // for more details.
    24 //
    25 // You should  have received a  copy of the  GNU Lesser General  Public License
    26 // along  with this library.
     12// Last Modified On : Sun Aug 16 08:46:22 2020
     13// Update Count     : 4
    2714//
    2815
    29 // This context switch routine depends on the fact that the stack of a new
    30 // thread has been set up to look like the thread has saved its context in
    31 // the normal manner.
    32 //
    33 // void CtxSwitch( machine_context *from, machine_context *to );
     16// The context switch routine requires the initial the stack of a thread to
     17// look like the thread has saved its context in the normal manner.
    3418
    35 // Offsets in the context structure. This needs to be synchronized with the
    36 // high level code a little better.
     19// Offsets must synchronized with the __stack_context_t in invoke.h.
    3720
    3821#define PTR_BYTE        4
    3922#define SP_OFFSET       ( 0 * PTR_BYTE )
    4023#define FP_OFFSET       ( 1 * PTR_BYTE )
    41 #define PC_OFFSET       ( 2 * PTR_BYTE )
    4224
     25// Context switch between coroutines/tasks.
     26//   void __cfactx_switch( struct __stack_context_t * from, struct __stack_context_t * to ) ;
     27// Arguments "from" in register 4(%esp), "to" in register 20(%esp)
     28
     29        .file "CtxSwitch-i386.S"
    4330        .text
    4431        .align 2
    45         .globl __cfactx_switch
    46         .type  __cfactx_switch, @function
     32        .global __cfactx_switch
     33        .type __cfactx_switch, @function
    4734__cfactx_switch:
    4835
     
    8370
    8471        ret
    85         .size  __cfactx_switch, .-__cfactx_switch
     72        .size __cfactx_switch, .-__cfactx_switch
    8673
    8774// Local Variables: //
  • libcfa/src/concurrency/CtxSwitch-x86_64.S

    rd685cb0 r636d115b  
    77// CtxSwitch-x86_64.S --
    88//
    9 // Author           : Thierry Delisle
    10 // Created On       : Mon Nov 28 12:27:26 2016
     9// Author           : Peter A. Buhr
     10// Created On       : Mon Aug 10 08:10:26 2020
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 21 22:28:11 2017
    13 // Update Count     : 1
    14 //
    15 // This  library is free  software; you  can redistribute  it and/or  modify it
    16 // under the terms of the GNU Lesser General Public License as published by the
    17 // Free Software  Foundation; either  version 2.1 of  the License, or  (at your
    18 // option) any later version.
    19 //
    20 // This library is distributed in the  hope that it will be useful, but WITHOUT
    21 // ANY  WARRANTY;  without even  the  implied  warranty  of MERCHANTABILITY  or
    22 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
    23 // for more details.
    24 //
    25 // You should  have received a  copy of the  GNU Lesser General  Public License
    26 // along  with this library.
     12// Last Modified On : Thu Aug 20 18:09:32 2020
     13// Update Count     : 9
    2714//
    2815
    29 // This context switch routine depends on the fact that the stack of a new
    30 // thread has been set up to look like the thread has saved its context in
    31 // the normal manner.
    32 //
    33 // void CtxSwitch( machine_context *from, machine_context *to );
     16// The context switch routine requires the initial the stack of a thread to
     17// look like the thread has saved its context in the normal manner.
    3418
    35 // Offsets in the context structure. This needs to be synchronized with the
    36 // high level code a little better.
     19// Offsets must synchronized with the __stack_context_t in invoke.h.
    3720
    3821#define PTR_BYTE        8
     
    4023#define FP_OFFSET       ( 1 * PTR_BYTE )
    4124
    42 //-----------------------------------------------------------------------------
    43 // Regular context switch routine which enables switching from one context to anouther
     25// Context switch between coroutines/tasks.
     26//   void __cfactx_switch( struct __stack_context_t * from, struct __stack_context_t * to ) ;
     27// Arguments "from" in register rdi, "to" in register rsi.
     28
     29        .file "CtxSwitch-x86_64.S"
    4430        .text
    4531        .align 2
    46         .globl __cfactx_switch
    47         .type  __cfactx_switch, @function
     32        .global __cfactx_switch
     33        .type __cfactx_switch, @function
    4834__cfactx_switch:
    4935
     
    7763
    7864        ret
    79         .size  __cfactx_switch, .-__cfactx_switch
     65        .size __cfactx_switch, .-__cfactx_switch
    8066
    81 //-----------------------------------------------------------------------------
    82 // Stub used to create new stacks which are ready to be context switched to
     67// Stub to create new stacks which can be context switched to
     68//   void __cfactx_invoke_stub( void );
     69
    8370        .text
    8471        .align 2
    85         .globl __cfactx_invoke_stub
    86         .type    __cfactx_invoke_stub, @function
     72        .global __cfactx_invoke_stub
     73        .type __cfactx_invoke_stub, @function
    8774__cfactx_invoke_stub:
    88         movq %rbx, %rdi
     75        movq %rbx, %rdi                                         // move main and this to first two arguments
    8976        movq %r12, %rsi
    90         jmp *%r13
    91         .size  __cfactx_invoke_stub, .-__cfactx_invoke_stub
     77        jmp *%r13                                                       // jmp to invoke
     78        .size __cfactx_invoke_stub, .-__cfactx_invoke_stub
    9279
    9380// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.