Changeset e74b24f in mainline for uspace/lib/c/arch/ia32/src/fibril.S


Ignore:
Timestamp:
2014-09-03T20:35:31Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5eae56a
Parents:
41f9802
Message:

Autogenerate ia32 fibril context_t and its offsets.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/ia32/src/fibril.S

    r41f9802 re74b24f  
    2727#
    2828
    29 #include <libarch/context_offset.h>
     29#include <libarch/fibril_context.h>
    3030
    3131.text
     
    4444       
    4545        # save registers to the context structure
    46         CONTEXT_SAVE_ARCH_CORE %edx %eax
     46        movl %esp, CONTEXT_OFFSET_SP(%edx)      # %esp -> ctx->sp
     47        movl %eax, CONTEXT_OFFSET_PC(%edx)      # %eip -> ctx->pc
     48        movl %ebx, CONTEXT_OFFSET_EBX(%edx)     # %ebx -> ctx->ebx
     49        movl %esi, CONTEXT_OFFSET_ESI(%edx)     # %esi -> ctx->esi
     50        movl %edi, CONTEXT_OFFSET_EDI(%edx)     # %edi -> ctx->edi
     51        movl %ebp, CONTEXT_OFFSET_EBP(%edx)     # %ebp -> ctx->ebp
    4752       
    4853        # save TLS
    4954        movl %gs:0, %eax
    50         movl %eax, OFFSET_TLS(%edx)     # tls -> ctx->tls
     55        movl %eax, CONTEXT_OFFSET_TLS(%edx)     # tls -> ctx->tls
    5156       
    52         xorl %eax, %eax     # context_save returns 1
     57        xorl %eax, %eax         # context_save returns 1
    5358        incl %eax
    5459        ret
     
    6368       
    6469        # restore registers from the context structure
    65         CONTEXT_RESTORE_ARCH_CORE %eax %edx
     70        movl CONTEXT_OFFSET_SP(%eax),%esp       # ctx->sp -> %esp
     71        movl CONTEXT_OFFSET_PC(%eax),%edx       # ctx->pc -> \pc
     72        movl CONTEXT_OFFSET_EBX(%eax),%ebx      # ctx->ebx -> %ebx
     73        movl CONTEXT_OFFSET_ESI(%eax),%esi      # ctx->esi -> %esi
     74        movl CONTEXT_OFFSET_EDI(%eax),%edi      # ctx->edi -> %edi
     75        movl CONTEXT_OFFSET_EBP(%eax),%ebp      # ctx->ebp -> %ebp
    6676       
    6777        movl %edx, 0(%esp)  # ctx->pc -> saver's return %eip
     
    6979        # set thread local storage
    7080        pushl %edx
    71         movl OFFSET_TLS(%eax), %edx  # Set arg1 to TLS addr
    72         movl $1, %eax                # Syscall SYS_TLS_SET
     81        movl CONTEXT_OFFSET_TLS(%eax), %edx     # Set arg1 to TLS addr
     82        movl $1, %eax                           # Syscall SYS_TLS_SET
    7383        int $0x30
    7484        popl %edx
    7585       
    76         xorl %eax, %eax     # context_restore returns 0
     86        xorl %eax, %eax         # context_restore returns 0
    7787        ret
     88
Note: See TracChangeset for help on using the changeset viewer.