Changeset f2ef7fd in mainline for kernel/arch/ia32/src/asm.S


Ignore:
Timestamp:
2008-10-05T21:20:13Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6198611
Parents:
1d132ae
Message:

Support for SYSENTER on ia32.

File:
1 edited

Legend:

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

    r1d132ae rf2ef7fd  
    147147        popfl
    148148.endm   
     149
     150/*
     151 * The SYSENTER syscall mechanism can be used for syscalls with
     152 * four or fewer arguments. To pass these four arguments, we
     153 * use four registers: EDX, ECX, EBX, ESI. The syscall number
     154 * is passed in EAX. We use EDI to remember the return address
     155 * and EBP to remember the stack. The INT-based syscall mechanism
     156 * can actually handle six arguments plus the syscall number
     157 * entirely in registers.
     158 */
     159.global sysenter_handler
     160sysenter_handler:
     161        pushl %ebp      # remember user stack
     162        pushl %edi      # remember return user address
     163
     164        pushl %gs       # remember TLS
     165
     166        pushl %eax      # syscall number
     167        subl $8, %esp   # unused sixth and fifth argument
     168        pushl %esi      # fourth argument
     169        pushl %ebx      # third argument
     170        pushl %ecx      # second argument
     171        pushl %edx      # first argument
     172
     173        movw $16, %ax
     174        movw %ax, %ds
     175        movw %ax, %es
     176
     177        cld
     178        call syscall_handler
     179        addl $28, %esp  # remove arguments from stack
     180
     181        pop %gs         # restore TLS
     182
     183        pop %edx        # prepare return EIP for SYSEXIT
     184        pop %ecx        # prepare userspace ESP for SYSEXIT
     185
     186        sysexit         # return to userspace
     187
    149188
    150189## Declare interrupt handlers
Note: See TracChangeset for help on using the changeset viewer.