From: Richard Henderson <rth@twiddle.net>
To: gang.chen.5i5j@gmail.com, peter.maydell@linaro.org
Cc: cmetcalf@ezchip.com, qemu-devel@nongnu.org, xili_gchen_5257@hotmail.com
Subject: Re: [Qemu-devel] [PATCH v3] target-tilegx: Support iret instruction and related special registers
Date: Fri, 2 Oct 2015 10:36:59 +1000 [thread overview]
Message-ID: <560DD1AB.7080808@twiddle.net> (raw)
In-Reply-To: <1443703035-4433-1-git-send-email-gang.chen.5i5j@gmail.com>
On 10/01/2015 10:37 PM, gang.chen.5i5j@gmail.com wrote:
> {
> mtspr INTERRUPT_CRITICAL_SECTION, r3
> shli r2, r2, SPR_EX_CONTEXT_0_1__ICS_SHIFT
> }
>
> {
> mtspr EX_CONTEXT_0_0, lr
> ori r2, r2, RETURN_PL
> }
>
> {
> or r0, r1, r0
> mtspr EX_CONTEXT_0_1, r2
> }
>
> iret
>
> jrp lr
>
> Until now, EX_CONTEXT_0_0 and EX_CONTEXT_0_1 are only used in mtspr, so
> just skip them, at present. "jrp lr" in __longjmp is for historical
> reasons, and might get removed in the future.
So, really, iret is supposed to branch to EX_CONTEXT_0_0, and (presumably)
validate the privilege level in EX_CONTEXT_0_1 continues to be user-mode.
> + case OE_RR_X1(IRET):
> + if (srca) {
> + return TILEGX_EXCP_OPCODE_UNIMPLEMENTED;
> + }
> + srca = TILEGX_R_LR;
> + mnemonic = "iret";
> + goto do_jr;
which means this is wrong, but just happens to work for __longjmp.
It appears that the entire point of this iret path is to atomically branch and
set INTERRUPT_CRITICAL_SECTION at the same time. So, this isn't complete.
What INTERRUPT_CRITICAL_SECTION is supposed to *do* at user mode, I don't know.
r~
next prev parent reply other threads:[~2015-10-02 0:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-01 12:37 [Qemu-devel] [PATCH v3] target-tilegx: Support iret instruction and related special registers gang.chen.5i5j
2015-10-02 0:36 ` Richard Henderson [this message]
[not found] ` <560DDC06.9060002@hotmail.com>
2015-10-02 1:19 ` Chen Gang
2015-10-02 1:31 ` Chris Metcalf
2015-10-02 2:02 ` Chen Gang
2015-10-02 2:26 ` Richard Henderson
2015-10-02 14:37 ` Chris Metcalf
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=560DD1AB.7080808@twiddle.net \
--to=rth@twiddle.net \
--cc=cmetcalf@ezchip.com \
--cc=gang.chen.5i5j@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=xili_gchen_5257@hotmail.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).