From: "Björn Töpel" <bjorn@kernel.org>
To: Ben Dooks <ben.dooks@codethink.co.uk>, linux-riscv@lists.infradead.org
Cc: ajones@ventanamicro.com, palmer@dabbelt.com,
Ben Dooks <ben.dooks@codethink.co.uk>
Subject: Re: [PATCH v2 1/3] riscv: ptrace: add regs_set_register()
Date: Mon, 02 Dec 2024 18:09:15 +0100 [thread overview]
Message-ID: <87ser62ero.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <20241201102759.221176-2-ben.dooks@codethink.co.uk>
Ben Dooks <ben.dooks@codethink.co.uk> writes:
> Since we have regs_get_register() and we could use the set counterpart
> for things like fixing up traps, add regs_set_register() to set a pt_regs
> value from offset.
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> v2:
> - fixed Andrew Jones' suggestions for comments
> ---
> arch/riscv/include/asm/ptrace.h | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/arch/riscv/include/asm/ptrace.h b/arch/riscv/include/asm/ptrace.h
> index b5b0adcc85c1..45c503b592c8 100644
> --- a/arch/riscv/include/asm/ptrace.h
> +++ b/arch/riscv/include/asm/ptrace.h
> @@ -143,6 +143,26 @@ static inline unsigned long regs_get_register(struct pt_regs *regs,
> return *(unsigned long *)((unsigned long)regs + offset);
> }
>
> +/**
> + * regs_set_register() - set register value at its offset
> + * @regs: pt_regs to which register value is set
> + * @offset: offset of the register.
> + * @value: value to set register to
> + *
> + * regs_set_register sets the value @to to a register whose offset from @regs.
> + * The @offset is the offset of the register in struct pt_regs.
> + * If @offset is bigger than MAX_REG_OFFSET, this will ignore the write.
> + */
> +static inline void regs_set_register(struct pt_regs *regs,
> + unsigned int offset,
> + unsigned long value)
Hobby horse warning! If you're resending for drew's comments, please use
the full 100 chars!
Björn
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2024-12-02 17:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-01 10:27 Updates for asm/ptrace/insn code Ben Dooks
2024-12-01 10:27 ` [PATCH v2 1/3] riscv: ptrace: add regs_set_register() Ben Dooks
2024-12-02 9:02 ` Andrew Jones
2024-12-02 17:09 ` Björn Töpel [this message]
2024-12-01 10:27 ` [PATCH v2 2/3] riscv: traps: make insn fetch common in unknown instruction Ben Dooks
2024-12-02 9:16 ` Andrew Jones
2024-12-02 9:23 ` Ben Dooks
2024-12-02 17:30 ` Björn Töpel
2024-12-01 10:27 ` [PATCH v2 3/3] riscv: insn: add RV_EXTRACT_FUNCT3() Ben Dooks
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=87ser62ero.fsf@all.your.base.are.belong.to.us \
--to=bjorn@kernel.org \
--cc=ajones@ventanamicro.com \
--cc=ben.dooks@codethink.co.uk \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.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