Changeset 8078180 in mainline


Ignore:
Timestamp:
2010-07-12T16:39:58Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
35599c9, 5f83634
Parents:
b539f54
Message:

Replace a branch instruction with conditional move.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/asm.S

    rb539f54 r8078180  
    412412         * Stop stack traces here if we came from userspace.
    413413         */
     414        xorl %eax, %eax
    414415        cmpl $8, ISTATE_OFFSET_CS(%esp)
    415         jz 0f
    416         xorl %ebp, %ebp
    417        
    418         0:
    419        
    420                 movl %ebp, ISTATE_OFFSET_EBP_FRAME(%esp)
    421                 movl ISTATE_OFFSET_EIP(%esp), %eax
    422                 movl %eax, ISTATE_OFFSET_EIP_FRAME(%esp)
    423                 leal ISTATE_OFFSET_EBP_FRAME(%esp), %ebp
    424                
    425                 cld
    426                
    427                 pushl %esp   /* pass istate address */
    428                 pushl $(\i)  /* pass intnum */
    429                
    430                 /* Call exc_dispatch(intnum, istate) */
    431                 call exc_dispatch
    432                
    433                 addl $8, %esp  /* clear arguments from the stack */
    434                
    435                 /*
    436                  * Restore the selector registers.
    437                  */
    438                 movl ISTATE_OFFSET_GS(%esp), %ecx
    439                 movl ISTATE_OFFSET_FS(%esp), %edx
    440 
    441                 movl %ecx, %gs
    442                 movl %edx, %fs
    443 
    444                 movl ISTATE_OFFSET_ES(%esp), %ecx
    445                 movl ISTATE_OFFSET_DS(%esp), %edx
    446                
    447                 movl %ecx, %es
    448                 movl %edx, %ds
    449                
    450                 /*
    451                  * Restore the scratch registers and the preserved
    452                  * registers the handler cloberred itself
    453                  * (i.e. EBP).
    454                  */
    455                 movl ISTATE_OFFSET_EAX(%esp), %eax
    456                 movl ISTATE_OFFSET_ECX(%esp), %ecx
    457                 movl ISTATE_OFFSET_EDX(%esp), %edx
    458                 movl ISTATE_OFFSET_EBP(%esp), %ebp
    459                
    460                 addl $(ISTATE_SOFT_SIZE + 4), %esp
    461                 iret
     416        cmovl %eax, %ebp
     417
     418        movl %ebp, ISTATE_OFFSET_EBP_FRAME(%esp)
     419        movl ISTATE_OFFSET_EIP(%esp), %eax
     420        movl %eax, ISTATE_OFFSET_EIP_FRAME(%esp)
     421        leal ISTATE_OFFSET_EBP_FRAME(%esp), %ebp
     422               
     423        cld
     424               
     425        pushl %esp   /* pass istate address */
     426        pushl $(\i)  /* pass intnum */
     427               
     428        /* Call exc_dispatch(intnum, istate) */
     429        call exc_dispatch
     430               
     431        addl $8, %esp  /* clear arguments from the stack */
     432               
     433        /*
     434         * Restore the selector registers.
     435         */
     436        movl ISTATE_OFFSET_GS(%esp), %ecx
     437        movl ISTATE_OFFSET_FS(%esp), %edx
     438
     439        movl %ecx, %gs
     440        movl %edx, %fs
     441
     442        movl ISTATE_OFFSET_ES(%esp), %ecx
     443        movl ISTATE_OFFSET_DS(%esp), %edx
     444               
     445        movl %ecx, %es
     446        movl %edx, %ds
     447               
     448        /*
     449         * Restore the scratch registers and the preserved
     450         * registers the handler cloberred itself
     451         * (i.e. EBP).
     452         */
     453        movl ISTATE_OFFSET_EAX(%esp), %eax
     454        movl ISTATE_OFFSET_ECX(%esp), %ecx
     455        movl ISTATE_OFFSET_EDX(%esp), %edx
     456        movl ISTATE_OFFSET_EBP(%esp), %ebp
     457               
     458        addl $(ISTATE_SOFT_SIZE + 4), %esp
     459        iret
    462460.endm
    463461
Note: See TracChangeset for help on using the changeset viewer.