sim: m32r: fix virtual environment with Linux targets
authorMike Frysinger <vapier@gentoo.org>
Thu, 1 Jul 2021 00:30:43 +0000 (20:30 -0400)
committerMike Frysinger <vapier@gentoo.org>
Fri, 2 Jul 2021 00:38:07 +0000 (20:38 -0400)
We don't want to handle Linux syscalls when in the virtual environment,
just the user environment, so adjust the Linux traps logic to check for
that specifically (instead of just skipping the operating environment).

Also tweak some testcases to explicitly specify the environment they run
under rather than relying on the default matching their needs.  This gets
the tests passing for all m32r targets.

sim/m32r/ChangeLog
sim/m32r/traps-linux.c
sim/testsuite/m32r/ChangeLog
sim/testsuite/m32r/hw-trap.ms
sim/testsuite/m32r/trap.cgs

index 5243cdad8289676f24b1b548ccb8813098da7e2d..19ddf8f56002dc874a7935fbf2e0c7047a6ccc92 100644 (file)
@@ -1,3 +1,8 @@
+2021-07-01  Mike Frysinger  <vapier@gentoo.org>
+
+       * traps-linux.c (m32r_trap): Change OPERATING_ENVIRONMENT check to
+       !USER_ENVIRONMENT.  Jump to default switch case.
+
 2021-07-01  Mike Frysinger  <vapier@gentoo.org>
 
        * syscall.h: Change __NR_ prefix on all symbols to TARGET_LINUX_SYS_.
index d60be7ca54b92c7dd731165b72d298e04699b12b..7aec04b5116f7df9b4da34b65b1b04a6b6652e18 100644 (file)
@@ -231,14 +231,8 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num)
         unsigned int func, arg1, arg2, arg3, arg4, arg5, arg6, arg7;
         int result, result2, errcode;
 
-        if (STATE_ENVIRONMENT (sd) == OPERATING_ENVIRONMENT)
-          {
-            /* The new pc is the trap vector entry.
-               We assume there's a branch there to some handler.
-              Use cr5 as EVB (EIT Vector Base) register.  */
-            USI new_pc = m32rbf_h_cr_get (current_cpu, 5) + 0x40 + num * 4;
-            return new_pc;
-          }
+       if (STATE_ENVIRONMENT (sd) != USER_ENVIRONMENT)
+         goto case_default;
 
        func = m32rbf_h_gr_get (current_cpu, 7);
        arg1 = m32rbf_h_gr_get (current_cpu, 0);
@@ -1344,6 +1338,7 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num)
       /* Do nothing.  */
       break;
 
+    case_default:
     default :
       {
        /* Use cr5 as EVB (EIT Vector Base) register.  */
index 6e6facbf9bd220f54ff76d3935dbd960fdc0751a..535435ac3f889ae4002f9e1cda5a4542ec9de1f5 100644 (file)
@@ -1,3 +1,8 @@
+2021-07-01  Mike Frysinger  <vapier@gentoo.org>
+
+       * hw-trap.ms: Run sim with --environment virtual.
+       * trap.cgs: Likewise.
+
 2021-04-08  Mike Frysinger  <vapier@gentoo.org>
 
        * allinsn.exp (arch): Delete.
index 2aa200b5d7093773acdbe20cd5c0fe9ac12abc83..09790248d10d3100626c7403b1f14518d63191b5 100644 (file)
@@ -1,4 +1,5 @@
 # mach(): m32r m32rx
+# sim: --environment virtual
 # output(): pass\n
 
        .include "testutils.inc"
index 59e136a01735a321b01a29abdbec1e9ee7b1bd80..f132d165367ffda30f849cbf125227b548852e77 100644 (file)
@@ -1,5 +1,6 @@
 # m32r testcase for trap #$uimm4
 # mach(): m32r m32rx
+# sim: --environment virtual
 
        .include "testutils.inc"
 
This page took 0.02929 seconds and 4 git commands to generate.