2 * i386 linux replacement vdso.
4 * Copyright 2023 Linaro, Ltd.
6 * SPDX-License-Identifier: GPL-2.0-or-later
9 #include <asm/unistd.h>
10 #include "vdso-asmoffset.h"
14 .type \name, @function
15 .size \name, . - \name
18 .macro vdso_syscall1 name, nr
22 .cfi_register %ebx, %edx
32 .macro vdso_syscall2 name, nr
36 .cfi_register %ebx, %edx
47 .macro vdso_syscall3 name, nr
51 .cfi_adjust_cfa_offset 4
52 .cfi_rel_offset %ebx, 0
59 .cfi_adjust_cfa_offset -4
71 endf __kernel_vsyscall
73 vdso_syscall2 __vdso_clock_gettime, __NR_clock_gettime
74 vdso_syscall2 __vdso_clock_gettime64, __NR_clock_gettime64
75 vdso_syscall2 __vdso_clock_getres, __NR_clock_getres
76 vdso_syscall2 __vdso_gettimeofday, __NR_gettimeofday
77 vdso_syscall1 __vdso_time, __NR_time
78 vdso_syscall3 __vdso_getcpu, __NR_gettimeofday
81 * Signal return handlers.
88 * For convenience, put the cfa just above eip in sigcontext, and count
89 * offsets backward from there. Re-compute the cfa in the two contexts
90 * we have for signal unwinding. This is far simpler than the
91 * DW_CFA_expression form that the kernel uses, and is equally correct.
94 .cfi_def_cfa %esp, SIGFRAME_SIGCONTEXT_eip + 4
100 .cfi_offset %ecx, -20
101 .cfi_offset %edx, -24
102 .cfi_offset %ebx, -28
103 .cfi_offset %esp, -32
104 .cfi_offset %ebp, -36
105 .cfi_offset %esi, -40
106 .cfi_offset %edi, -44
109 * While this frame is marked as a signal frame, that only applies to how
110 * the return address is handled for the outer frame. The return address
111 * that arrived here, from the inner frame, is not marked as a signal frame
112 * and so the unwinder still tries to subtract 1 to examine the presumed
113 * call insn. Thus we must extend the unwind info to a nop before the start.
118 popl %eax /* pop sig */
119 .cfi_adjust_cfa_offset -4
120 movl $__NR_sigreturn, %eax
122 endf __kernel_sigreturn
124 .cfi_def_cfa_offset RT_SIGFRAME_SIGCONTEXT_eip + 4
127 __kernel_rt_sigreturn:
128 movl $__NR_rt_sigreturn, %eax
130 endf __kernel_rt_sigreturn
135 * TODO: Add elf notes. E.g.
137 * #include <linux/elfnote.h>
138 * ELFNOTE_START(Linux, 0, "a")
139 * .long LINUX_VERSION_CODE
142 * but what version number would we set for QEMU?