aboutsummaryrefslogtreecommitdiff
path: root/sim/m32r
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-06-30 20:30:43 -0400
committerMike Frysinger <vapier@gentoo.org>2021-07-01 20:38:07 -0400
commit055a3f27e8c704a459a84ef6deeadd06a4a55d23 (patch)
tree829e3b6af9bcef984e5e5054eadae517926d06f3 /sim/m32r
parent33b477e1c7fc12b21934e5f8fa799c163a554b20 (diff)
downloadgdb-055a3f27e8c704a459a84ef6deeadd06a4a55d23.zip
gdb-055a3f27e8c704a459a84ef6deeadd06a4a55d23.tar.gz
gdb-055a3f27e8c704a459a84ef6deeadd06a4a55d23.tar.bz2
sim: m32r: fix virtual environment with Linux targets
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.
Diffstat (limited to 'sim/m32r')
-rw-r--r--sim/m32r/ChangeLog5
-rw-r--r--sim/m32r/traps-linux.c11
2 files changed, 8 insertions, 8 deletions
diff --git a/sim/m32r/ChangeLog b/sim/m32r/ChangeLog
index 5243cda..19ddf8f 100644
--- a/sim/m32r/ChangeLog
+++ b/sim/m32r/ChangeLog
@@ -1,5 +1,10 @@
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_.
* traps-linux.c: Likewise. Include sim/callback.h & stdlib.h.
diff --git a/sim/m32r/traps-linux.c b/sim/m32r/traps-linux.c
index d60be7c..7aec04b 100644
--- a/sim/m32r/traps-linux.c
+++ b/sim/m32r/traps-linux.c
@@ -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. */