diff mbox series

[for-7.1,v6,23/51] target/nios2: Handle EXCP_UNALIGN and EXCP_UALIGND

Message ID 20220317050538.924111-24-richard.henderson@linaro.org
State Superseded
Headers show
Series target/nios2: Shadow register set, EIC and VIC | expand

Commit Message

Richard Henderson March 17, 2022, 5:05 a.m. UTC
These misaligned data and misaligned destination exceptions
are defined, but not currently raised.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/nios2/helper.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Peter Maydell March 17, 2022, 3:27 p.m. UTC | #1
On Thu, 17 Mar 2022 at 05:16, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> These misaligned data and misaligned destination exceptions
> are defined, but not currently raised.

nios2_cpu_do_unaligned_access() seems to already raise EXCP_UNALIGN.

otherwise

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

thanks
-- PMM
Richard Henderson March 17, 2022, 4:47 p.m. UTC | #2
On 3/17/22 08:27, Peter Maydell wrote:
> On Thu, 17 Mar 2022 at 05:16, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> These misaligned data and misaligned destination exceptions
>> are defined, but not currently raised.
> 
> nios2_cpu_do_unaligned_access() seems to already raise EXCP_UNALIGN.

However, we failed to set TARGET_ALIGNED_ONLY=y in configs,
and we don't set MO_ALIGN, so it never gets called.

r~
diff mbox series

Patch

diff --git a/target/nios2/helper.c b/target/nios2/helper.c
index 285f3aae1d..0392c0ea84 100644
--- a/target/nios2/helper.c
+++ b/target/nios2/helper.c
@@ -119,6 +119,12 @@  void nios2_cpu_do_interrupt(CPUState *cs)
         case EXCP_ILLEGAL:
             name = "ILLEGAL insn";
             break;
+        case EXCP_UNALIGN:
+            name = "Misaligned (data)";
+            break;
+        case EXCP_UNALIGND:
+            name = "Misaligned (destination)";
+            break;
         case EXCP_TRAP:
             name = "TRAP insn";
             break;
@@ -167,6 +173,8 @@  void nios2_cpu_do_interrupt(CPUState *cs)
     case EXCP_SUPERD:
     case EXCP_ILLEGAL:
     case EXCP_TRAP:
+    case EXCP_UNALIGN:
+    case EXCP_UNALIGND:
         do_exception(cpu, cpu->exception_addr, false);
         break;