From: "Brian Cain" <bcain@codeaurora.org>
To: "'Al Viro'" <viro@ZenIV.linux.org.uk>,
"'Linus Torvalds'" <torvalds@linux-foundation.org>
Cc: <linux-arch@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"'David Miller'" <davem@davemloft.net>,
"'Tony Luck'" <tony.luck@intel.com>,
"'Will Deacon'" <will@kernel.org>
Subject: RE: [PATCH 33/41] hexagon: switch to ->get2()
Date: Tue, 11 Aug 2020 13:35:23 -0500 [thread overview]
Message-ID: <038001d6700e$2da6af80$88f40e80$@codeaurora.org> (raw)
In-Reply-To: <20200629182628.529995-33-viro@ZenIV.linux.org.uk>
> -----Original Message-----
> From: linux-arch-owner@vger.kernel.org <linux-arch-owner@vger.kernel.org>
> On Behalf Of Al Viro
Acked-by: Brian Cain <bcain@codeaurora.org>
> From: Al Viro <viro@zeniv.linux.org.uk>
>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
> arch/hexagon/kernel/ptrace.c | 62
+++++++++++++++-----------------------------
> 1 file changed, 21 insertions(+), 41 deletions(-)
>
> diff --git a/arch/hexagon/kernel/ptrace.c b/arch/hexagon/kernel/ptrace.c
index
> dcbf7ea960cc..fa6287d1a061 100644
> --- a/arch/hexagon/kernel/ptrace.c
> +++ b/arch/hexagon/kernel/ptrace.c
> @@ -35,58 +35,38 @@ void user_disable_single_step(struct task_struct
*child)
>
> static int genregs_get(struct task_struct *target,
> const struct user_regset *regset,
> - unsigned int pos, unsigned int count,
> - void *kbuf, void __user *ubuf)
> + srtuct membuf to)
> {
> - int ret;
> - unsigned int dummy;
> struct pt_regs *regs = task_pt_regs(target);
>
> -
> - if (!regs)
> - return -EIO;
> -
> /* The general idea here is that the copyout must happen in
> * exactly the same order in which the userspace expects these
> * regs. Now, the sequence in userspace does not match the
> * sequence in the kernel, so everything past the 32 gprs
> * happens one at a time.
> */
> - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> - ®s->r00, 0, 32*sizeof(unsigned long));
> -
> -#define ONEXT(KPT_REG, USR_REG) \
> - if (!ret) \
> - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, \
> - KPT_REG, offsetof(struct user_regs_struct, USR_REG),
> \
> - offsetof(struct user_regs_struct, USR_REG) + \
> - sizeof(unsigned long));
> -
> + membuf_write(&to, ®s->r00, 32*sizeof(unsigned long));
> /* Must be exactly same sequence as struct user_regs_struct */
> - ONEXT(®s->sa0, sa0);
> - ONEXT(®s->lc0, lc0);
> - ONEXT(®s->sa1, sa1);
> - ONEXT(®s->lc1, lc1);
> - ONEXT(®s->m0, m0);
> - ONEXT(®s->m1, m1);
> - ONEXT(®s->usr, usr);
> - ONEXT(®s->preds, p3_0);
> - ONEXT(®s->gp, gp);
> - ONEXT(®s->ugp, ugp);
> - ONEXT(&pt_elr(regs), pc);
> - dummy = pt_cause(regs);
> - ONEXT(&dummy, cause);
> - ONEXT(&pt_badva(regs), badva);
> + membuf_store(&to, regs->sa0);
> + membuf_store(&to, regs->lc0);
> + membuf_store(&to, regs->sa1);
> + membuf_store(&to, regs->lc1);
> + membuf_store(&to, regs->m0);
> + membuf_store(&to, regs->m1);
> + membuf_store(&to, regs->usr);
> + membuf_store(&to, regs->p3_0);
> + membuf_store(&to, regs->gp);
> + membuf_store(&to, regs->ugp);
> + membuf_store(&to, pt_elr(regs)); // pc
> + membuf_store(&to, (unsigned long)pt_cause(regs)); // cause
> + membuf_store(&to, pt_badva(regs)); // badva
> #if CONFIG_HEXAGON_ARCH_VERSION >=4
> - ONEXT(®s->cs0, cs0);
> - ONEXT(®s->cs1, cs1);
> + membuf_store(&to, regs->cs0);
> + membuf_store(&to, regs->cs1);
> + return membuf_zero(&to, sizeof(unsigned long)); #else
> + return membuf_zero(&to, 3 * sizeof(unsigned long));
> #endif
> -
> - /* Pad the rest with zeros, if needed */
> - if (!ret)
> - ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
> - offsetof(struct user_regs_struct,
> pad1), -1);
> - return ret;
> }
>
> static int genregs_set(struct task_struct *target, @@ -159,7 +139,7 @@
static
> const struct user_regset hexagon_regsets[] = {
> .n = ELF_NGREG,
> .size = sizeof(unsigned long),
> .align = sizeof(unsigned long),
> - .get = genregs_get,
> + .get2 = genregs_get,
> .set = genregs_set,
> },
> };
> --
> 2.11.0
next prev parent reply other threads:[~2020-08-11 18:35 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-29 18:23 [RFC][PATCHSET] regset ->get() rework Al Viro
2020-06-29 18:25 ` [PATCH 01/41] introduction of regset ->get() wrappers, switching ELF coredumps to those Al Viro
2020-06-29 18:25 ` [PATCH 02/41] x86: copy_fpstate_to_sigframe(): have fpregs_soft_get() use kernel buffer Al Viro
2020-06-29 18:25 ` [PATCH 03/41] x86: kill dump_fpu() Al Viro
2020-06-29 18:25 ` [PATCH 04/41] [ia64] sanitize elf_access_gpreg() Al Viro
2020-06-29 18:25 ` [PATCH 05/41] [ia64] teach elf_access_reg() to handle the missing range (r16..r31) Al Viro
2020-06-29 18:25 ` [PATCH 06/41] [ia64] regularize do_gpregs_[gs]et() Al Viro
2020-06-29 18:25 ` [PATCH 07/41] [ia64] access_uarea(): stop bothering with gpregs_[gs]et() Al Viro
2020-06-29 18:25 ` [PATCH 08/41] [ia64] access_uarea(): don't bother with fpregs_[gs]et() Al Viro
2020-06-29 18:25 ` [PATCH 09/41] sparc64: switch genregs32_get() to use of get_from_target() Al Viro
2020-06-29 18:25 ` [PATCH 10/41] sparc32: get rid of odd callers of copy_regset_to_user() Al Viro
2020-06-29 18:25 ` [PATCH 11/41] sparc64: " Al Viro
2020-06-29 18:25 ` [PATCH 12/41] sparc32: get rid of odd callers of copy_regset_from_user() Al Viro
2020-06-29 18:26 ` [PATCH 13/41] sparc64: " Al Viro
2020-06-29 18:26 ` [PATCH 14/41] arm64: take fetching compat reg out of pt_regs into a new helper Al Viro
2020-06-29 18:26 ` [PATCH 15/41] arm64: get rid of copy_regset_to_user() in compat_ptrace_read_user() Al Viro
2020-06-29 18:26 ` [PATCH 16/41] arm64: sanitize compat_ptrace_write_user() Al Viro
2020-06-29 18:26 ` [PATCH 17/41] copy_regset_to_user(): do all copyout at once Al Viro
2020-06-29 18:26 ` [PATCH 18/41] regset: new method and helpers for it Al Viro
2020-06-29 19:23 ` Linus Torvalds
2020-06-29 20:30 ` Al Viro
2020-06-30 13:25 ` Al Viro
2020-06-30 16:53 ` Linus Torvalds
2020-06-30 19:40 ` Al Viro
2020-06-29 18:26 ` [PATCH 19/41] x86: switch to ->get2() Al Viro
2020-06-29 18:26 ` [PATCH 20/41] powerpc: " Al Viro
2020-06-29 18:26 ` [PATCH 21/41] s390: " Al Viro
2020-06-29 18:26 ` [PATCH 22/41] sparc: " Al Viro
2020-06-30 13:16 ` Al Viro
2020-06-29 18:26 ` [PATCH 23/41] mips: " Al Viro
2020-06-29 18:26 ` [PATCH 24/41] arm64: " Al Viro
2020-06-29 18:26 ` [PATCH 25/41] sh: convert " Al Viro
2020-06-29 18:26 ` [PATCH 26/41] arm: switch " Al Viro
2020-06-29 18:26 ` [PATCH 27/41] arc: " Al Viro
2020-06-29 18:26 ` [PATCH 28/41] ia64: " Al Viro
2020-06-29 18:26 ` [PATCH 29/41] c6x: " Al Viro
2020-06-29 18:26 ` [PATCH 30/41] riscv: " Al Viro
2020-06-29 18:26 ` [PATCH 31/41] openrisc: " Al Viro
2020-06-29 18:26 ` [PATCH 32/41] h8300: " Al Viro
2020-06-29 18:26 ` [PATCH 33/41] hexagon: " Al Viro
2020-08-11 18:35 ` Brian Cain [this message]
2020-06-29 18:26 ` [PATCH 34/41] nios2: " Al Viro
2020-06-29 18:26 ` [PATCH 35/41] nds32: " Al Viro
2020-06-29 18:26 ` [PATCH 36/41] parisc: " Al Viro
2020-06-29 18:26 ` [PATCH 37/41] xtensa: " Al Viro
2020-06-29 18:26 ` [PATCH 38/41] csky: " Al Viro
2020-06-29 18:26 ` [PATCH 39/41] regset: kill ->get() Al Viro
2020-06-29 18:26 ` [PATCH 40/41] regset(): kill ->get_size() Al Viro
2020-06-29 18:26 ` [PATCH 41/41] regset: kill user_regset_copyout{,_zero}() Al Viro
2020-07-23 8:00 ` [RFC][PATCHSET] regset ->get() rework Christoph Hellwig
2020-07-23 17:27 ` Al Viro
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='038001d6700e$2da6af80$88f40e80$@codeaurora.org' \
--to=bcain@codeaurora.org \
--cc=davem@davemloft.net \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@ZenIV.linux.org.uk \
--cc=will@kernel.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).