~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/entry/vdso/vdso32/system_call.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * AT_SYSINFO entry point
  4 */
  5 
  6 #include <linux/linkage.h>
  7 #include <asm/dwarf2.h>
  8 #include <asm/cpufeatures.h>
  9 #include <asm/alternative.h>
 10 
 11         .text
 12         .globl __kernel_vsyscall
 13         .type __kernel_vsyscall,@function
 14         ALIGN
 15 __kernel_vsyscall:
 16         CFI_STARTPROC
 17         /*
 18          * Reshuffle regs so that all of any of the entry instructions
 19          * will preserve enough state.
 20          *
 21          * A really nice entry sequence would be:
 22          *  pushl %edx
 23          *  pushl %ecx
 24          *  movl  %esp, %ecx
 25          *
 26          * Unfortunately, naughty Android versions between July and December
 27          * 2015 actually hardcode the traditional Linux SYSENTER entry
 28          * sequence.  That is severely broken for a number of reasons (ask
 29          * anyone with an AMD CPU, for example).  Nonetheless, we try to keep
 30          * it working approximately as well as it ever worked.
 31          *
 32          * This link may elucidate some of the history:
 33          *   https://android-review.googlesource.com/#/q/Iac3295376d61ef83e713ac9b528f3b50aa780cd7
 34          * personally, I find it hard to understand what's going on there.
 35          *
 36          * Note to future user developers: DO NOT USE SYSENTER IN YOUR CODE.
 37          * Execute an indirect call to the address in the AT_SYSINFO auxv
 38          * entry.  That is the ONLY correct way to make a fast 32-bit system
 39          * call on Linux.  (Open-coding int $0x80 is also fine, but it's
 40          * slow.)
 41          */
 42         pushl   %ecx
 43         CFI_ADJUST_CFA_OFFSET   4
 44         CFI_REL_OFFSET          ecx, 0
 45         pushl   %edx
 46         CFI_ADJUST_CFA_OFFSET   4
 47         CFI_REL_OFFSET          edx, 0
 48         pushl   %ebp
 49         CFI_ADJUST_CFA_OFFSET   4
 50         CFI_REL_OFFSET          ebp, 0
 51 
 52         #define SYSENTER_SEQUENCE       "movl %esp, %ebp; sysenter"
 53         #define SYSCALL_SEQUENCE        "movl %ecx, %ebp; syscall"
 54 
 55 #ifdef CONFIG_X86_64
 56         /* If SYSENTER (Intel) or SYSCALL32 (AMD) is available, use it. */
 57         ALTERNATIVE_2 "", SYSENTER_SEQUENCE, X86_FEATURE_SYSENTER32, \
 58                           SYSCALL_SEQUENCE,  X86_FEATURE_SYSCALL32
 59 #else
 60         ALTERNATIVE "", SYSENTER_SEQUENCE, X86_FEATURE_SEP
 61 #endif
 62 
 63         /* Enter using int $0x80 */
 64         int     $0x80
 65 SYM_INNER_LABEL(int80_landing_pad, SYM_L_GLOBAL)
 66 
 67         /*
 68          * Restore EDX and ECX in case they were clobbered.  EBP is not
 69          * clobbered (the kernel restores it), but it's cleaner and
 70          * probably faster to pop it than to adjust ESP using addl.
 71          */
 72         popl    %ebp
 73         CFI_RESTORE             ebp
 74         CFI_ADJUST_CFA_OFFSET   -4
 75         popl    %edx
 76         CFI_RESTORE             edx
 77         CFI_ADJUST_CFA_OFFSET   -4
 78         popl    %ecx
 79         CFI_RESTORE             ecx
 80         CFI_ADJUST_CFA_OFFSET   -4
 81         RET
 82         CFI_ENDPROC
 83 
 84         .size __kernel_vsyscall,.-__kernel_vsyscall
 85         .previous

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php