[5/7] target/arm: Remove unnecessary '| 0xf0000000' from do_v7m_exception_exit()

Message ID 1505137930-13255-6-git-send-email-peter.maydell@linaro.org
State Superseded
Headers show
Series
  • ARMv8M: some bugfixes and prep. cleanup
Related show

Commit Message

Peter Maydell Sept. 11, 2017, 1:52 p.m.
In do_v7m_exception_exit(), there's no need to force the high 4
bits of 'type' to 1 when calling v7m_exception_taken(), because
we know that they're always 1 or we could not have got to this
"handle return to magic exception return address" code. Remove
the unnecessary ORs.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 target/arm/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.7.4

Comments

Alistair Francis Sept. 11, 2017, 5:41 p.m. | #1
On Mon, Sep 11, 2017 at 6:52 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> In do_v7m_exception_exit(), there's no need to force the high 4

> bits of 'type' to 1 when calling v7m_exception_taken(), because

> we know that they're always 1 or we could not have got to this

> "handle return to magic exception return address" code. Remove

> the unnecessary ORs.

>

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Acked-by: Alistair Francis <alistair.francis@xilinx.com>


Thanks,
Alistair

> ---

>  target/arm/helper.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)

>

> diff --git a/target/arm/helper.c b/target/arm/helper.c

> index 1741e0d..fdd5cc6 100644

> --- a/target/arm/helper.c

> +++ b/target/arm/helper.c

> @@ -6306,7 +6306,7 @@ static void do_v7m_exception_exit(ARMCPU *cpu)

>           */

>          env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;

>          armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);

> -        v7m_exception_taken(cpu, type | 0xf0000000);

> +        v7m_exception_taken(cpu, type);

>          qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing "

>                        "stackframe: failed exception return integrity check\n");

>          return;

> @@ -6348,7 +6348,7 @@ static void do_v7m_exception_exit(ARMCPU *cpu)

>          armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);

>          env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;

>          v7m_push_stack(cpu);

> -        v7m_exception_taken(cpu, type | 0xf0000000);

> +        v7m_exception_taken(cpu, type);

>          qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on new stackframe: "

>                        "failed exception return integrity check\n");

>          return;

> --

> 2.7.4

>

>
Richard Henderson Sept. 13, 2017, 4:36 p.m. | #2
On 09/11/2017 06:52 AM, Peter Maydell wrote:
> In do_v7m_exception_exit(), there's no need to force the high 4

> bits of 'type' to 1 when calling v7m_exception_taken(), because

> we know that they're always 1 or we could not have got to this

> "handle return to magic exception return address" code. Remove

> the unnecessary ORs.

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

> ---

>  target/arm/helper.c | 4 ++--

>  1 file changed, 2 insertions(+), 2 deletions(-)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>



r~

Patch

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 1741e0d..fdd5cc6 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -6306,7 +6306,7 @@  static void do_v7m_exception_exit(ARMCPU *cpu)
          */
         env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
         armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
-        v7m_exception_taken(cpu, type | 0xf0000000);
+        v7m_exception_taken(cpu, type);
         qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on existing "
                       "stackframe: failed exception return integrity check\n");
         return;
@@ -6348,7 +6348,7 @@  static void do_v7m_exception_exit(ARMCPU *cpu)
         armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
         env->v7m.cfsr[env->v7m.secure] |= R_V7M_CFSR_INVPC_MASK;
         v7m_push_stack(cpu);
-        v7m_exception_taken(cpu, type | 0xf0000000);
+        v7m_exception_taken(cpu, type);
         qemu_log_mask(CPU_LOG_INT, "...taking UsageFault on new stackframe: "
                       "failed exception return integrity check\n");
         return;