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
  • uspace/lib/libc/arch/ia32/src/syscall.S

    r1d132ae rf2ef7fd  
    2929.text
    3030
    31 /** Syscall wrapper.
     31/** Syscall wrapper - INT $0x30 version.
    3232 *
    3333 * Mind the order of arguments. First two arguments and the syscall number go to
     
    3535 * could benefit from this and not save unused registers on the stack.
    3636 */
    37 .global __syscall
    38 __syscall:
     37.global __syscall_int
     38__syscall_int:
    3939        pushl %ebx
    4040        pushl %esi
     
    5454        popl %ebx
    5555        ret
     56
     57
     58/** Syscall wrapper - SYSENTER version.
     59 *
     60 * This is an optimized version of syscall for four or less arguments.  Note
     61 * that EBP and EDI are used to remember user stack address and the return
     62 * address. The kernel part doesn't save DS, ES and FS so the handler restores
     63 * these to the selector immediately following CS (it must be the flat data
     64 * segment, otherwise the SYSENTER wouldn't work in the first place).
     65 */
     66.global __syscall_sysenter
     67__syscall_sysenter:
     68        pushl %ebx
     69        pushl %esi
     70        pushl %edi
     71        pushl %ebp
     72        mov %esp, %ebp
     73        lea ra, %edi
     74        movl 20(%esp), %edx     # First argument.
     75        movl 24(%esp), %ecx     # Second argument.
     76        movl 28(%esp), %ebx     # Third argument.
     77        movl 32(%esp), %esi     # Fourth argument.
     78        movl 44(%esp), %eax     # Syscall number.
     79        sysenter
     80ra:
     81        movw %cs, %cx
     82        addw $8, %cx
     83        movw %cx, %ds
     84        movw %cx, %es
     85        movw %cx, %fs
     86        popl %ebp
     87        popl %edi
     88        popl %esi
     89        popl %ebx
     90        ret
Note: See TracChangeset for help on using the changeset viewer.