2 * AT_SYSINFO entry point
5 #include <linux/linkage.h>
6 #include <asm/dwarf2.h>
7 #include <asm/cpufeatures.h>
8 #include <asm/alternative-asm.h>
11 .globl __kernel_vsyscall
12 .type __kernel_vsyscall,@function
17 * Reshuffle regs so that all of any of the entry instructions
18 * will preserve enough state.
20 * A really nice entry sequence would be:
25 * Unfortunately, naughty Android versions between July and December
26 * 2015 actually hardcode the traditional Linux SYSENTER entry
27 * sequence. That is severely broken for a number of reasons (ask
28 * anyone with an AMD CPU, for example). Nonetheless, we try to keep
29 * it working approximately as well as it ever worked.
31 * This link may eludicate some of the history:
32 * https://android-review.googlesource.com/#/q/Iac3295376d61ef83e713ac9b528f3b50aa780cd7
33 * personally, I find it hard to understand what's going on there.
35 * Note to future user developers: DO NOT USE SYSENTER IN YOUR CODE.
36 * Execute an indirect call to the address in the AT_SYSINFO auxv
37 * entry. That is the ONLY correct way to make a fast 32-bit system
38 * call on Linux. (Open-coding int $0x80 is also fine, but it's
42 CFI_ADJUST_CFA_OFFSET 4
45 CFI_ADJUST_CFA_OFFSET 4
48 CFI_ADJUST_CFA_OFFSET 4
51 #define SYSENTER_SEQUENCE "movl %esp, %ebp; sysenter"
52 #define SYSCALL_SEQUENCE "movl %ecx, %ebp; syscall"
55 /* If SYSENTER (Intel) or SYSCALL32 (AMD) is available, use it. */
56 ALTERNATIVE_2 "", SYSENTER_SEQUENCE, X86_FEATURE_SYSENTER32, \
57 SYSCALL_SEQUENCE, X86_FEATURE_SYSCALL32
59 ALTERNATIVE "", SYSENTER_SEQUENCE, X86_FEATURE_SEP
62 /* Enter using int $0x80 */
64 GLOBAL(int80_landing_pad)
67 * Restore EDX and ECX in case they were clobbered. EBP is not
68 * clobbered (the kernel restores it), but it's cleaner and
69 * probably faster to pop it than to adjust ESP using addl.
73 CFI_ADJUST_CFA_OFFSET -4
76 CFI_ADJUST_CFA_OFFSET -4
79 CFI_ADJUST_CFA_OFFSET -4
83 .size __kernel_vsyscall,.-__kernel_vsyscall