Changeset 2c9de7e in mainline


Ignore:
Timestamp:
2005-09-06T22:09:25Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2bd4fdf
Parents:
2cd073bd
Message:

According to IA-32 ABI, %edx and %ecx don't have to be saved accross function calls.
Remove these registers from context_t and adjust context_save() and context_restore() to make use of this fact.

Location:
arch/ia32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/include/context.h

    r2cd073bd r2c9de7e  
    4646        __u32 pc;
    4747        __u32 ebx;
    48         __u32 ecx;
    49         __u32 edx;
    5048        __u32 esi;
    5149        __u32 edi;
  • arch/ia32/src/context.s

    r2cd073bd r2c9de7e  
    3939#
    4040context_save:
    41         push %ebx
     41        movl 0(%esp),%eax       # the caller's return %eip
     42        movl 4(%esp),%edx       # address of the kernel_context variable to save context to
    4243
    43         movl 4(%esp),%eax       # the caller's return %eip
    44         movl 8(%esp),%ebx       # address of the kernel_context variable to save context to
    45         movl %eax,4(%ebx)       # %eip -> ctx->pc
    46         movl %esp,(%ebx)        # %esp -> ctx->sp
    47 
    48         movl %ebx,%eax
    49         pop %ebx
    50 
    51         movl %ebx,8(%eax)
    52         movl %ecx,12(%eax)
    53         movl %edx,16(%eax)
    54         movl %esi,20(%eax)
    55         movl %edi,24(%eax)
    56         movl %ebp,28(%eax)
     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
    5750
    5851        xorl %eax,%eax          # context_save returns 1
     
    6861context_restore:
    6962        movl 4(%esp),%eax       # address of the kernel_context variable to restore context from
    70         movl (%eax),%esp        # ctx->sp -> %esp
    71         addl $4,%esp            # this is for the pop we don't do
     63        movl 0(%eax),%esp       # ctx->sp -> %esp
     64        movl 4(%eax),%edx       # ctx->pc -> %edx
     65        movl 8(%eax),%ebx       # ctx->ebx -> %ebx
     66        movl 12(%eax),%esi      # ctx->esi -> %esi
     67        movl 16(%eax),%edi      # ctx->edi -> %edi
     68        movl 20(%eax),%ebp      # ctx->ebp -> %ebp
    7269
    73         movl 8(%eax),%ebx
    74         movl 12(%eax),%ecx
    75         movl 16(%eax),%edx
    76         movl 20(%eax),%esi
    77         movl 24(%eax),%edi
    78         movl 28(%eax),%ebp
    79 
    80         movl 4(%eax),%eax
    81         movl %eax,(%esp)        # ctx->pc -> saver's return %eip
     70        movl %edx,0(%esp)       # ctx->pc -> saver's return %eip
    8271        xorl %eax,%eax          # context_restore returns 0
    8372        ret
Note: See TracChangeset for help on using the changeset viewer.