From: Richard Henderson <richard.henderson@linaro.org>
To: M Bazz <bazz@bazz1.com>
Cc: qemu-devel@nongnu.org, Artyom Tarasenko <atar4qemu@gmail.com>,
Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Subject: Re: [PATCH] target/sparc: resolve ASI_USERTXT correctly
Date: Mon, 15 Apr 2024 09:37:55 -0700 [thread overview]
Message-ID: <139c7bdf-a62d-4993-a076-eb46ce742748@linaro.org> (raw)
In-Reply-To: <CAMFqb-ZV9FJ3JBZNv9APpkmLWdBm1YsWRJyGkKqyN7F0HbNVZw@mail.gmail.com>
On 4/14/24 15:48, M Bazz wrote:
> I noticed that cpu_mmu_index() would have returned MMU_USER_IDX
> if the supervisor bit hadn't happened to be set (not sure if this
> execution path can occur for lda).
No, it cannot.
> Note that this check is gone in your patch.
Correct. Since 'lda' has already checked that supervisor mode has been enabled, the
translator may jump directly to the desired result of MMU_KERNEL_IDX.
> If I understand everything you've taught me, then the following patch would
> have also satisfied the permissions issue. Could you confirm this please?
> The essential change is the MMU_USER_IDX in the call to make_memop_idx()
>
> diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
> index e581bb42ac..be3c03a3b6 100644
> --- a/target/sparc/ldst_helper.c
> +++ b/target/sparc/ldst_helper.c
> @@ -702,6 +702,24 @@ uint64_t helper_ld_asi(CPUSPARCState *env,
> target_ulong addr,
> break;
> }
> break;
> + case ASI_USERTXT: /* User code access */
> + oi = make_memop_idx(memop, MMU_USER_IDX);
> + switch (size) {
> + case 1:
> + ret = cpu_ldb_code_mmu(env, addr, oi, GETPC());
> + break;
> + case 2:
> + ret = cpu_ldw_code_mmu(env, addr, oi, GETPC());
> + break;
> + default:
> + case 4:
> + ret = cpu_ldl_code_mmu(env, addr, oi, GETPC());
> + break;
> + case 8:
> + ret = cpu_ldq_code_mmu(env, addr, oi, GETPC());
> + break;
> + }
> + break;
Correct, that would also work.
r~
prev parent reply other threads:[~2024-04-15 16:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 21:29 [PATCH] target/sparc: resolve ASI_USERTXT correctly M Bazz
2024-04-11 21:55 ` Richard Henderson
2024-04-12 1:15 ` M Bazz
2024-04-12 2:16 ` Richard Henderson
2024-04-14 1:54 ` M Bazz
2024-04-14 17:20 ` Richard Henderson
2024-04-14 22:48 ` M Bazz
2024-04-15 16:37 ` Richard Henderson [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=139c7bdf-a62d-4993-a076-eb46ce742748@linaro.org \
--to=richard.henderson@linaro.org \
--cc=atar4qemu@gmail.com \
--cc=bazz@bazz1.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-devel@nongnu.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).