From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: foss@percivaleng.com, qemu-riscv@nongnu.org
Subject: Re: [PATCH 09/12] target/riscv: Fill in TCGCPUOps.pointer_wrap
Date: Mon, 26 May 2025 20:15:10 +0200 [thread overview]
Message-ID: <f1fc4726-8b87-4995-a874-60e0c969b633@linaro.org> (raw)
In-Reply-To: <702b4c82-653d-4782-8805-c4ff9a1155ae@linaro.org>
On 5/5/25 20:59, Richard Henderson wrote:
> On 5/5/25 09:47, Philippe Mathieu-Daudé wrote:
>> On 4/5/25 22:57, Richard Henderson wrote:
>>> Check 32 vs 64-bit and pointer masking state.
>>>
>>> Cc: qemu-riscv@nongnu.org
>>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>>> ---
>>> target/riscv/tcg/tcg-cpu.c | 26 ++++++++++++++++++++++++++
>>> 1 file changed, 26 insertions(+)
>>>
>>> diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c
>>> index 55e00972b7..267186e5e3 100644
>>> --- a/target/riscv/tcg/tcg-cpu.c
>>> +++ b/target/riscv/tcg/tcg-cpu.c
>>> @@ -237,6 +237,31 @@ static void riscv_restore_state_to_opc(CPUState
>>> *cs,
>>> env->excp_uw2 = data[2];
>>> }
>>> +#ifndef CONFIG_USER_ONLY
>>> +static vaddr riscv_pointer_wrap(CPUState *cs, int mmu_idx,
>>> + vaddr result, vaddr base)
>>> +{
>>> + CPURISCVState *env = cpu_env(cs);
>>> + uint32_t pm_len;
>>> + bool pm_signext;
>>> +
>>> + if (cpu_address_xl(env) == MXL_RV32) {
>>> + return (uint32_t)result;
>>> + }
>>> +
>>> + pm_len = riscv_pm_get_pmlen(riscv_pm_get_pmm(env));
>>> + if (pm_len == 0) {
>>> + return result;
>>> + }
>>> +
>>> + pm_signext = riscv_cpu_virt_mem_enabled(env);
>>> + if (pm_signext) {
>>> + return sextract64(result, 0, 64 - pm_len);
>>> + }
>>> + return extract64(result, 0, 64 - pm_len);
>>
>> Is this safe for MXL_RV128?
>
> The RV128 implementation only uses 64-bit pointers, so, yes.
Thanks.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
next prev parent reply other threads:[~2025-05-26 18:15 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-04 20:57 [PATCH 00/12] accel/tcg: Fix cross-page pointer wrapping issue Richard Henderson
2025-05-04 20:57 ` [PATCH 01/12] accel/tcg: Add TCGCPUOps.pointer_wrap Richard Henderson
2025-05-05 9:26 ` Philippe Mathieu-Daudé
2025-05-04 20:57 ` [PATCH 02/12] target: Use cpu_pointer_wrap_notreached for strict align targets Richard Henderson
2025-05-05 9:26 ` Philippe Mathieu-Daudé
2025-05-04 20:57 ` [PATCH 03/12] target: Use cpu_pointer_wrap_uint32 for 32-bit targets Richard Henderson
2025-05-05 9:26 ` Philippe Mathieu-Daudé
2025-05-05 11:34 ` Edgar E. Iglesias
2025-05-08 6:40 ` Bastian Koppelmann
2025-05-04 20:57 ` [PATCH 04/12] target/arm: Fill in TCGCPUOps.pointer_wrap Richard Henderson
2025-05-26 18:21 ` Philippe Mathieu-Daudé
2025-05-27 7:33 ` Richard Henderson
2025-05-04 20:57 ` [PATCH 05/12] target/i386: " Richard Henderson
2025-05-05 16:52 ` Philippe Mathieu-Daudé
2025-05-04 20:57 ` [PATCH 06/12] target/loongarch: " Richard Henderson
2025-05-26 18:17 ` Philippe Mathieu-Daudé
2025-05-27 0:57 ` Bibo Mao
2025-05-27 4:04 ` gaosong
2025-05-04 20:57 ` [PATCH 07/12] target/mips: " Richard Henderson
2025-05-05 14:59 ` Philippe Mathieu-Daudé
2025-05-04 20:57 ` [PATCH 08/12] target/ppc: " Richard Henderson
2025-05-05 16:50 ` Philippe Mathieu-Daudé
2025-05-05 19:00 ` Richard Henderson
2025-05-04 20:57 ` [PATCH 09/12] target/riscv: " Richard Henderson
2025-05-05 16:47 ` Philippe Mathieu-Daudé
2025-05-05 18:59 ` Richard Henderson
2025-05-26 18:15 ` Philippe Mathieu-Daudé [this message]
2025-05-19 0:17 ` Alistair Francis
2025-05-04 20:57 ` [PATCH 10/12] target/s390x: " Richard Henderson
2025-05-05 14:41 ` Philippe Mathieu-Daudé
2025-05-05 16:16 ` Richard Henderson
2025-05-26 18:16 ` Philippe Mathieu-Daudé
2025-05-04 20:57 ` [PATCH 11/12] target/sparc: " Richard Henderson
2025-05-05 14:54 ` Philippe Mathieu-Daudé
2025-05-05 16:16 ` Richard Henderson
2025-05-04 20:57 ` [PATCH 12/12] accel/tcg: Assert TCGCPUOps.pointer_wrap is set Richard Henderson
2025-05-05 9:27 ` Philippe Mathieu-Daudé
2025-05-07 16:38 ` [PATCH 00/12] accel/tcg: Fix cross-page pointer wrapping issue FOSS
2025-05-07 17:32 ` Richard Henderson
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=f1fc4726-8b87-4995-a874-60e0c969b633@linaro.org \
--to=philmd@linaro.org \
--cc=foss@percivaleng.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@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).