qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Ilya Leoshkevich <iii@linux.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>, Thomas Huth <thuth@redhat.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
	qemu-s390x@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH] linux-user/elfload: add s390x core dumping support
Date: Sat, 15 May 2021 22:00:53 +0200	[thread overview]
Message-ID: <9d65789b-895c-55e5-b2b7-09ed72171036@vivier.eu> (raw)
In-Reply-To: <20210413205608.22587-1-iii@linux.ibm.com>

Le 13/04/2021 à 22:56, Ilya Leoshkevich a écrit :
> Provide the following definitions required by the common code:
> 
> * ELF_NREG: with the value of sizeof(s390_regs) / sizeof(long).
> * target_elf_gregset_t: define it like all the other arches do.
> * elf_core_copy_regs(): similar to kernel's s390_regs_get().
> * USE_ELF_CORE_DUMP.
> * ELF_EXEC_PAGESIZE.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  linux-user/elfload.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index c6731013fd..4e45bd1539 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -1385,6 +1385,39 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
>      regs->gprs[15] = infop->start_stack;
>  }
>  
> +/* See linux kernel: arch/s390/include/uapi/asm/ptrace.h (s390_regs).  */
> +#define ELF_NREG 27
> +typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
> +
> +enum {
> +    TARGET_REG_PSWM = 0,
> +    TARGET_REG_PSWA = 1,
> +    TARGET_REG_GPRS = 2,
> +    TARGET_REG_ARS = 18,
> +    TARGET_REG_ORIG_R2 = 26,
> +};
> +
> +static void elf_core_copy_regs(target_elf_gregset_t *regs,
> +                               const CPUS390XState *env)
> +{
> +    int i;
> +    uint32_t *aregs;
> +
> +    (*regs)[TARGET_REG_PSWM] = tswapreg(env->psw.mask);
> +    (*regs)[TARGET_REG_PSWA] = tswapreg(env->psw.addr);
> +    for (i = 0; i < 16; i++) {
> +        (*regs)[TARGET_REG_GPRS + i] = tswapreg(env->regs[i]);
> +    }
> +    aregs = (uint32_t *)&((*regs)[TARGET_REG_ARS]);
> +    for (i = 0; i < 16; i++) {
> +        aregs[i] = tswap32(env->aregs[i]);
> +    }
> +    (*regs)[TARGET_REG_ORIG_R2] = 0;
> +}
> +
> +#define USE_ELF_CORE_DUMP
> +#define ELF_EXEC_PAGESIZE 4096
> +
>  #endif /* TARGET_S390X */
>  
>  #ifdef TARGET_RISCV
> 

Applied to my linux-user-for-6.1 branch.

Thanks,
Laurent




      reply	other threads:[~2021-05-15 20:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 20:56 [PATCH] linux-user/elfload: add s390x core dumping support Ilya Leoshkevich
2021-05-15 20:00 ` Laurent Vivier [this message]

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=9d65789b-895c-55e5-b2b7-09ed72171036@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=iii@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=thuth@redhat.com \
    /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).