qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, laurent@vivier.eu
Subject: Re: [PATCH v6 18/19] linux-user/s390x: Add vdso
Date: Tue, 3 Oct 2023 15:07:10 +0200	[thread overview]
Message-ID: <92c8b00d-157e-6a03-7629-c331cf41ffc5@linaro.org> (raw)
In-Reply-To: <20230930021529.987950-19-richard.henderson@linaro.org>

Hi Richard,

On 30/9/23 04:15, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/s390x/vdso-asmoffset.h |   2 +
>   linux-user/elfload.c              |   2 +
>   linux-user/s390x/signal.c         |   4 +-
>   linux-user/s390x/Makefile.vdso    |  11 +++++
>   linux-user/s390x/meson.build      |   6 +++
>   linux-user/s390x/vdso.S           |  61 ++++++++++++++++++++++++++
>   linux-user/s390x/vdso.ld          |  69 ++++++++++++++++++++++++++++++
>   linux-user/s390x/vdso.so          | Bin 0 -> 3464 bytes
>   8 files changed, 152 insertions(+), 3 deletions(-)
>   create mode 100644 linux-user/s390x/vdso-asmoffset.h
>   create mode 100644 linux-user/s390x/Makefile.vdso
>   create mode 100644 linux-user/s390x/vdso.S
>   create mode 100644 linux-user/s390x/vdso.ld
>   create mode 100755 linux-user/s390x/vdso.so


> diff --git a/linux-user/s390x/Makefile.vdso b/linux-user/s390x/Makefile.vdso
> new file mode 100644
> index 0000000000..e82bf9e29f
> --- /dev/null
> +++ b/linux-user/s390x/Makefile.vdso
> @@ -0,0 +1,11 @@
> +include $(BUILD_DIR)/tests/tcg/s390x-linux-user/config-target.mak
> +
> +SUBDIR = $(SRC_PATH)/linux-user/s390x
> +VPATH += $(SUBDIR)
> +
> +all: $(SUBDIR)/vdso.so
> +
> +$(SUBDIR)/vdso.so: vdso.S vdso.ld vdso-asmoffset.h
> +	$(CC) -o $@ -nostdlib -shared -Wl,-h,linux-vdso64.so.1 \
> +	  -Wl,--build-id=sha1 -Wl,--hash-style=both \
> +	  -Wl,-T,$(SUBDIR)/vdso.ld $<
> diff --git a/linux-user/s390x/meson.build b/linux-user/s390x/meson.build
> index 0781ccea1d..a7a25ed9ce 100644
> --- a/linux-user/s390x/meson.build
> +++ b/linux-user/s390x/meson.build
> @@ -3,3 +3,9 @@ syscall_nr_generators += {
>                        arguments: [ meson.current_source_dir() / 'syscallhdr.sh', '@INPUT@', '@OUTPUT@', '@EXTRA_ARGS@' ],
>                        output: '@BASENAME@_nr.h')
>   }
> +
> +vdso_inc = gen_vdso.process('vdso.so', extra_args: [
> +                                '-s', '__kernel_sigreturn',
> +                                '-r', '__kernel_rt_sigreturn'
> +                            ])
> +linux_user_ss.add(when: 'TARGET_S390X', if_true: vdso_inc)
> diff --git a/linux-user/s390x/vdso.S b/linux-user/s390x/vdso.S
> new file mode 100644
> index 0000000000..3332492477
> --- /dev/null
> +++ b/linux-user/s390x/vdso.S
> @@ -0,0 +1,61 @@
> +/*
> + * s390x linux replacement vdso.
> + *
> + * Copyright 2023 Linaro, Ltd.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#include <asm/unistd.h>
> +#include "vdso-asmoffset.h"
> +
> +.macro endf name
> +	.globl	\name
> +	.type	\name, @function
> +	.size	\name, . - \name
> +.endm
> +
> +.macro raw_syscall n
> +        .ifne	\n < 0x100
> +	svc	\n
> +	.else
> +	lghi	%r1, \n
> +	svc	0
> +        .endif
> +.endm
> +
> +.macro vdso_syscall name, nr
> +\name:
> +	.cfi_startproc
> +	aghi	%r15, -(STACK_FRAME_OVERHEAD + 16)
> +	.cfi_adjust_cfa_offset STACK_FRAME_OVERHEAD + 16
> +	stg	%r14, STACK_FRAME_OVERHEAD(%r15)
> +	.cfi_rel_offset %r14, STACK_FRAME_OVERHEAD
> +	raw_syscall \nr
> +	lg	%r14, STACK_FRAME_OVERHEAD(%r15)
> +	aghi	%r15, STACK_FRAME_OVERHEAD + 16
> +	.cfi_restore %r14
> +	.cfi_adjust_cfa_offset -(STACK_FRAME_OVERHEAD + 16)
> +	br	%r14
> +	.cfi_endproc
> +endf	\name
> +.endm
> +
> +vdso_syscall __kernel_gettimeofday, __NR_gettimeofday
> +vdso_syscall __kernel_clock_gettime, __NR_clock_gettime
> +vdso_syscall __kernel_clock_getres, __NR_clock_getres
> +vdso_syscall __kernel_getcpu, __NR_getcpu
> +
> +/*
> + * TODO unwind info, though we're ok without it.
> + * The kernel supplies bogus empty unwind info, and it is likely ignored
> + * by all users.  Without it we get the fallback signal frame handling.
> + */
> +
> +__kernel_sigreturn:
> +	raw_syscall __NR_sigreturn
> +endf	__kernel_sigreturn
> +
> +__kernel_rt_sigreturn:
> +	raw_syscall __NR_rt_sigreturn
> +endf	__kernel_rt_sigreturn
> diff --git a/linux-user/s390x/vdso.ld b/linux-user/s390x/vdso.ld
> new file mode 100644
> index 0000000000..2a30ff382a
> --- /dev/null
> +++ b/linux-user/s390x/vdso.ld
> @@ -0,0 +1,69 @@
> +/*
> + * Linker script for linux x86-64 replacement vdso.
> + *
> + * Copyright 2023 Linaro, Ltd.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +VERSION {
> +        LINUX_2.6.29 {
> +        global:
> +                __kernel_gettimeofday;
> +                __kernel_clock_gettime;
> +                __kernel_clock_getres;
> +                __kernel_getcpu;
> +                __kernel_restart_syscall;

Where is __kernel_restart_syscall defined?

> +                __kernel_rt_sigreturn;
> +                __kernel_sigreturn;
> +        local: *;
> +        };
> +}



  reply	other threads:[~2023-10-03 13:08 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-30  2:15 [PATCH v6 00/19] linux-user: Implement VDSOs Richard Henderson
2023-09-30  2:15 ` [PATCH v6 01/19] linux-user: Introduce imgsrc_read, imgsrc_read_alloc Richard Henderson
2023-09-30  2:15 ` [PATCH v6 02/19] linux-user: Tidy loader_exec Richard Henderson
2023-09-30  2:15 ` [PATCH v6 03/19] linux-user: Do not clobber bprm_buf swapping ehdr Richard Henderson
2023-09-30  2:15 ` [PATCH v6 04/19] linux-user: Use ImageSource in load_elf_image Richard Henderson
2023-10-02 13:22   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 05/19] linux-user: Use ImageSource in load_symbols Richard Henderson
2023-09-30  2:15 ` [PATCH v6 06/19] linux-user: Replace bprm->fd with bprm->src.fd Richard Henderson
2023-09-30  2:15 ` [PATCH v6 07/19] linux-user: Load vdso image if available Richard Henderson
2023-10-03 12:47   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 08/19] linux-user: Add gen-vdso tool Richard Henderson
2023-10-03 13:00   ` Philippe Mathieu-Daudé
2023-10-03 23:05     ` Richard Henderson
2023-10-05 16:25       ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 09/19] linux-user/i386: Add vdso Richard Henderson
2023-10-05 16:42   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 10/19] linux-user/x86_64: " Richard Henderson
2023-10-05 16:44   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 11/19] linux-user/aarch64: " Richard Henderson
2023-10-05 16:47   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 12/19] linux-user/arm: " Richard Henderson
2023-09-30  2:15 ` [PATCH v6 13/19] linux-user/hppa: " Richard Henderson
2023-10-05 16:16   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 14/19] linux-user/riscv: " Richard Henderson
2023-10-05 16:24   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 15/19] linux-user/loongarch64: " Richard Henderson
2023-10-05 16:18   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 16/19] linux-user/ppc: " Richard Henderson
2023-10-05 16:35   ` Philippe Mathieu-Daudé
2023-09-30  2:15 ` [PATCH v6 17/19] linux-user/s390x: Rename __SIGNAL_FRAMESIZE to STACK_FRAME_OVERHEAD Richard Henderson
2023-09-30  2:15 ` [PATCH v6 18/19] linux-user/s390x: Add vdso Richard Henderson
2023-10-03 13:07   ` Philippe Mathieu-Daudé [this message]
2023-10-03 23:01     ` Richard Henderson
2023-10-05 16:14       ` Philippe Mathieu-Daudé
2023-10-06  7:30         ` Thomas Huth
2023-09-30  2:15 ` [PATCH v6 19/19] build: Add update-linux-vdso makefile rule Richard Henderson
2023-10-03 13:02   ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=92c8b00d-157e-6a03-7629-c331cf41ffc5@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).