Changeset baac911 in mainline


Ignore:
Timestamp:
2008-03-15T09:43:06Z (16 years ago)
Author:
Josef Cejka <malyzelenyhnus@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1dbfe98
Parents:
1aede82
Message:

Context saving/restoring code replaced with macro.

File:
1 edited

Legend:

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

    r1aede82 rbaac911  
    2727#
    2828
     29#include <kernel/arch/context_offset.h>
     30
    2931.text
    3032
     
    4244        movl 4(%esp),%edx       # address of the context variable to save context to
    4345
    44         movl %esp,0(%edx)       # %esp -> ctx->sp
    45         movl %eax,4(%edx)       # %eip -> ctx->pc
    46         movl %ebx,8(%edx)       # %ebx -> ctx->ebx
    47         movl %esi,12(%edx)      # %esi -> ctx->esi
    48         movl %edi,16(%edx)      # %edi -> ctx->edi
    49         movl %ebp,20(%edx)      # %ebp -> ctx->ebp
     46                # save registers to given structure
     47        CONTEXT_SAVE_ARCH_CORE %edx %eax
    5048
    5149        # Save TLS
    5250        movl %gs:0, %eax
    53         movl %eax, 24(%edx)     # tls -> ctx->tls
     51        movl %eax, OFFSET_TLS(%edx)     # tls -> ctx->tls
    5452       
    5553        xorl %eax,%eax          # context_save returns 1
     
    6563context_restore:
    6664        movl 4(%esp),%eax       # address of the context variable to restore context from
    67         movl 0(%eax),%esp       # ctx->sp -> %esp
    68         movl 4(%eax),%edx       # ctx->pc -> %edx
    69         movl 8(%eax),%ebx       # ctx->ebx -> %ebx
    70         movl 12(%eax),%esi      # ctx->esi -> %esi
    71         movl 16(%eax),%edi      # ctx->edi -> %edi
    72         movl 20(%eax),%ebp      # ctx->ebp -> %ebp
     65
     66                # restore registers from jmp_buf
     67        CONTEXT_RESTORE_ARCH_CORE %eax %edx
    7368
    7469        movl %edx,0(%esp)       # ctx->pc -> saver's return %eip
     
    7671        # Set thread local storage
    7772        pushl %edx
    78         movl 24(%eax), %edx   # Set arg1 to TLS addr
     73        movl OFFSET_TLS(%eax), %edx   # Set arg1 to TLS addr
    7974        movl $1, %eax         # Syscall SYS_TLS_SET
    8075        int $0x30
Note: See TracChangeset for help on using the changeset viewer.