mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
linux-user/aarch64: Add vdso
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
6b1a9d38b5
commit
ee95fae075
8 changed files with 176 additions and 0 deletions
71
linux-user/aarch64/vdso.S
Normal file
71
linux-user/aarch64/vdso.S
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* aarch64 linux replacement vdso.
|
||||
*
|
||||
* Copyright 2023 Linaro, Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include <asm/unistd.h>
|
||||
|
||||
/* ??? These are in include/elf.h, which is not ready for inclusion in asm. */
|
||||
#define NT_GNU_PROPERTY_TYPE_0 5
|
||||
#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000
|
||||
#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0)
|
||||
#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC (1U << 1)
|
||||
|
||||
#define GNU_PROPERTY_AARCH64_FEATURE_1_DEFAULT \
|
||||
(GNU_PROPERTY_AARCH64_FEATURE_1_BTI | GNU_PROPERTY_AARCH64_FEATURE_1_PAC)
|
||||
|
||||
.section .note.gnu.property
|
||||
.align 3
|
||||
.long 2f - 1f
|
||||
.long 6f - 3f
|
||||
.long NT_GNU_PROPERTY_TYPE_0
|
||||
1: .string "GNU"
|
||||
2: .align 3
|
||||
3: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND
|
||||
.long 5f - 4f
|
||||
4: .long GNU_PROPERTY_AARCH64_FEATURE_1_DEFAULT
|
||||
5: .align 3
|
||||
6:
|
||||
|
||||
.text
|
||||
|
||||
.macro endf name
|
||||
.globl \name
|
||||
.type \name, @function
|
||||
.size \name, . - \name
|
||||
.endm
|
||||
|
||||
.macro vdso_syscall name, nr
|
||||
\name:
|
||||
bti c
|
||||
mov x8, #\nr
|
||||
svc #0
|
||||
ret
|
||||
endf \name
|
||||
.endm
|
||||
|
||||
.cfi_startproc
|
||||
|
||||
vdso_syscall __kernel_gettimeofday, __NR_gettimeofday
|
||||
vdso_syscall __kernel_clock_gettime, __NR_clock_gettime
|
||||
vdso_syscall __kernel_clock_getres, __NR_clock_getres
|
||||
|
||||
.cfi_endproc
|
||||
|
||||
|
||||
/*
|
||||
* TODO: The kernel makes a big deal of turning off the .cfi directives,
|
||||
* because they cause libgcc to crash, but that's because they're wrong.
|
||||
*
|
||||
* For now, elide the unwind info for __kernel_rt_sigreturn and rely on
|
||||
* the libgcc fallback routine as we have always done. This requires
|
||||
* that the code sequence used be exact.
|
||||
*/
|
||||
__kernel_rt_sigreturn:
|
||||
/* No BTI C insn here -- we arrive via RET. */
|
||||
mov x8, #__NR_rt_sigreturn
|
||||
svc #0
|
||||
endf __kernel_rt_sigreturn
|
Loading…
Add table
Add a link
Reference in a new issue