From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>, qemu-arm <qemu-arm@nongnu.org>
Subject: Re: [PATCH v3 2/4] target/arm: handle A-profile semihosting at translate time
Date: Fri, 06 Sep 2019 14:16:24 +0100 [thread overview]
Message-ID: <87a7bhzhsn.fsf@linaro.org> (raw)
In-Reply-To: <CAFEAcA84VXqw+ZGP9Nv=Wy069ZU_C0WkVdv0h28GVbnzyx6w6w@mail.gmail.com>
Peter Maydell <peter.maydell@linaro.org> writes:
> On Fri, 6 Sep 2019 at 13:47, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> As for the other semihosting calls we can resolve this at translate
>> time.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>
>> ---
>> v2
>> - update for change to gen_exception_internal_insn API
>> v3
>> - update for decode tree, merge T32 & A32 commits
>> - dropped r-b due to changes
>> ---
>> target/arm/translate.c | 19 +++++++++++++++----
>> 1 file changed, 15 insertions(+), 4 deletions(-)
>>
>> diff --git a/target/arm/translate.c b/target/arm/translate.c
>> index 4cda7812bcb..ed4a97cfb44 100644
>> --- a/target/arm/translate.c
>> +++ b/target/arm/translate.c
>> @@ -10222,14 +10222,25 @@ static bool trans_CBZ(DisasContext *s, arg_CBZ *a)
>> }
>>
>> /*
>> - * Supervisor call
>> + * Supervisor call - both T32 & A32 come here so we need to check
>> + * which mode we are in when checking for semihosting.
>> */
>>
>> static bool trans_SVC(DisasContext *s, arg_SVC *a)
>> {
>> - gen_set_pc_im(s, s->base.pc_next);
>> - s->svc_imm = a->imm;
>> - s->base.is_jmp = DISAS_SWI;
>> + const uint32_t semihost_imm = s->thumb ? 0xab : 0x123456;
>> +
>> + if (semihosting_enabled() &&
>> +#ifndef CONFIG_USER_ONLY
>> + s->current_el != 0 &&
>> +#endif
>> + (a->imm == semihost_imm)) {
>> + gen_exception_internal_insn(s, s->base.pc_next, EXCP_SEMIHOST);
>> + } else {
>> + gen_set_pc_im(s, s->base.pc_next);
>> + s->svc_imm = a->imm;
>> + s->base.is_jmp = DISAS_SWI;
>> + }
>> return true;
>> }
>
> Doesn't this accidentally enable semihosting via SVC for
> M-profile ?
We must have done that before then. Just gate it with &&
!arm_dc_feature(s, ARM_FEATURE_M) then?
>
> thanks
> -- PMM
--
Alex Bennée
WARNING: multiple messages have this Message-ID (diff)
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm <qemu-arm@nongnu.org>, QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v3 2/4] target/arm: handle A-profile semihosting at translate time
Date: Fri, 06 Sep 2019 14:16:24 +0100 [thread overview]
Message-ID: <87a7bhzhsn.fsf@linaro.org> (raw)
In-Reply-To: <CAFEAcA84VXqw+ZGP9Nv=Wy069ZU_C0WkVdv0h28GVbnzyx6w6w@mail.gmail.com>
Peter Maydell <peter.maydell@linaro.org> writes:
> On Fri, 6 Sep 2019 at 13:47, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> As for the other semihosting calls we can resolve this at translate
>> time.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>
>> ---
>> v2
>> - update for change to gen_exception_internal_insn API
>> v3
>> - update for decode tree, merge T32 & A32 commits
>> - dropped r-b due to changes
>> ---
>> target/arm/translate.c | 19 +++++++++++++++----
>> 1 file changed, 15 insertions(+), 4 deletions(-)
>>
>> diff --git a/target/arm/translate.c b/target/arm/translate.c
>> index 4cda7812bcb..ed4a97cfb44 100644
>> --- a/target/arm/translate.c
>> +++ b/target/arm/translate.c
>> @@ -10222,14 +10222,25 @@ static bool trans_CBZ(DisasContext *s, arg_CBZ *a)
>> }
>>
>> /*
>> - * Supervisor call
>> + * Supervisor call - both T32 & A32 come here so we need to check
>> + * which mode we are in when checking for semihosting.
>> */
>>
>> static bool trans_SVC(DisasContext *s, arg_SVC *a)
>> {
>> - gen_set_pc_im(s, s->base.pc_next);
>> - s->svc_imm = a->imm;
>> - s->base.is_jmp = DISAS_SWI;
>> + const uint32_t semihost_imm = s->thumb ? 0xab : 0x123456;
>> +
>> + if (semihosting_enabled() &&
>> +#ifndef CONFIG_USER_ONLY
>> + s->current_el != 0 &&
>> +#endif
>> + (a->imm == semihost_imm)) {
>> + gen_exception_internal_insn(s, s->base.pc_next, EXCP_SEMIHOST);
>> + } else {
>> + gen_set_pc_im(s, s->base.pc_next);
>> + s->svc_imm = a->imm;
>> + s->base.is_jmp = DISAS_SWI;
>> + }
>> return true;
>> }
>
> Doesn't this accidentally enable semihosting via SVC for
> M-profile ?
We must have done that before then. Just gate it with &&
!arm_dc_feature(s, ARM_FEATURE_M) then?
>
> thanks
> -- PMM
--
Alex Bennée
next prev parent reply other threads:[~2019-09-06 13:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-06 12:47 [PATCH v3 0/4] semihosting fixes Alex Bennée
2019-09-06 12:47 ` [Qemu-devel] " Alex Bennée
2019-09-06 12:47 ` [PATCH v3 1/4] target/arm: handle M-profile semihosting at translate time Alex Bennée
2019-09-06 12:47 ` [Qemu-devel] " Alex Bennée
2019-09-06 15:03 ` Richard Henderson
2019-09-06 15:03 ` [Qemu-devel] " Richard Henderson
2019-09-06 12:47 ` [PATCH v3 2/4] target/arm: handle A-profile " Alex Bennée
2019-09-06 12:47 ` [Qemu-devel] " Alex Bennée
2019-09-06 12:54 ` Peter Maydell
2019-09-06 12:54 ` [Qemu-devel] " Peter Maydell
2019-09-06 13:16 ` Alex Bennée [this message]
2019-09-06 13:16 ` Alex Bennée
2019-09-06 13:33 ` Peter Maydell
2019-09-06 13:33 ` [Qemu-devel] " Peter Maydell
2019-09-06 15:05 ` Richard Henderson
2019-09-06 12:47 ` [PATCH v3 3/4] target/arm: remove run time semihosting checks Alex Bennée
2019-09-06 12:47 ` [Qemu-devel] " Alex Bennée
2019-09-06 12:47 ` [PATCH v3 4/4] atomic_template: fix indentation in GEN_ATOMIC_HELPER Alex Bennée
2019-09-06 12:47 ` [Qemu-devel] " Alex Bennée
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=87a7bhzhsn.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.