diff mbox series

[06/10] armv7m: set CFSR.UNDEFINSTR on undefined instructions

Message ID 1485285380-10565-7-git-send-email-peter.maydell@linaro.org
State Superseded
Headers show
Series More M profile bugfixes | expand

Commit Message

Peter Maydell Jan. 24, 2017, 7:16 p.m. UTC
From: Michael Davidsaver <mdavidsaver@gmail.com>


When we take an exception for an undefined instruction, set the
appropriate CFSR bit.

Signed-off-by: Michael Davidsaver <mdavidsaver@gmail.com>

[PMM: tweaked commit message, comment]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 target/arm/helper.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.7.4

Comments

Alex Bennée Jan. 27, 2017, 1:44 p.m. UTC | #1
Peter Maydell <peter.maydell@linaro.org> writes:

> From: Michael Davidsaver <mdavidsaver@gmail.com>

>

> When we take an exception for an undefined instruction, set the

> appropriate CFSR bit.

>

> Signed-off-by: Michael Davidsaver <mdavidsaver@gmail.com>

> [PMM: tweaked commit message, comment]

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


Reviewed-by: Alex Bennée <alex.bennee@linaro.org>


> ---

>  target/arm/helper.c | 1 +

>  1 file changed, 1 insertion(+)

>

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

> index 7dc30f5..e6b1c36 100644

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

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

> @@ -6072,6 +6072,7 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)

>      switch (cs->exception_index) {

>      case EXCP_UDEF:

>          armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);

> +        env->v7m.cfsr |= R_V7M_CFSR_UNDEFINSTR_MASK;

>          return;

>      case EXCP_SWI:

>          /* The PC already points to the next instruction.  */



--
Alex Bennée
diff mbox series

Patch

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 7dc30f5..e6b1c36 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -6072,6 +6072,7 @@  void arm_v7m_cpu_do_interrupt(CPUState *cs)
     switch (cs->exception_index) {
     case EXCP_UDEF:
         armv7m_nvic_set_pending(env->nvic, ARMV7M_EXCP_USAGE);
+        env->v7m.cfsr |= R_V7M_CFSR_UNDEFINSTR_MASK;
         return;
     case EXCP_SWI:
         /* The PC already points to the next instruction.  */