aboutsummaryrefslogtreecommitdiff
path: root/sim/lm32
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-06-15 19:22:38 +0545
committerMike Frysinger <vapier@gentoo.org>2015-06-17 13:19:51 -0400
commit7d5c6c43ca8a5dd5491f4a58e977ec5501386ee3 (patch)
treebc347f539bd5eb379bd6b8ce9adef4cdff2a9248 /sim/lm32
parent61a0c964e611eaf72489c3049ba206b2f91ea4a9 (diff)
downloadgdb-7d5c6c43ca8a5dd5491f4a58e977ec5501386ee3.zip
gdb-7d5c6c43ca8a5dd5491f4a58e977ec5501386ee3.tar.gz
gdb-7d5c6c43ca8a5dd5491f4a58e977ec5501386ee3.tar.bz2
sim: syscall: add common sim_syscall helpers
Many ports have the same sim syscall logic, so add some helpers to handle all the common details. The arches still have to deal with the unpacking and packing of the syscall arguments, but the rest of the sim<->callback glue is now shared.
Diffstat (limited to 'sim/lm32')
-rw-r--r--sim/lm32/ChangeLog5
-rw-r--r--sim/lm32/traps.c28
2 files changed, 15 insertions, 18 deletions
diff --git a/sim/lm32/ChangeLog b/sim/lm32/ChangeLog
index 4cee5da..7442ba3 100644
--- a/sim/lm32/ChangeLog
+++ b/sim/lm32/ChangeLog
@@ -1,5 +1,10 @@
2015-06-17 Mike Frysinger <vapier@gentoo.org>
+ * traps.c (lm32bf_scall_insn): Replace call to cb_syscall with
+ sim_syscall_multi.
+
+2015-06-17 Mike Frysinger <vapier@gentoo.org>
+
* traps.c: Include sim-syscall.h.
(syscall_read_mem, syscall_write_mem): Delete.
(lm32bf_scall_insn): Change syscall_read_mem/syscall_write_mem
diff --git a/sim/lm32/traps.c b/sim/lm32/traps.c
index 810ddf7..9de0910 100644
--- a/sim/lm32/traps.c
+++ b/sim/lm32/traps.c
@@ -132,26 +132,18 @@ lm32bf_scall_insn (SIM_CPU * current_cpu, IADDR pc)
|| (GET_H_GR (8) == TARGET_SYS_exit))
{
/* Delegate system call to host O/S. */
- CB_SYSCALL s;
- CB_SYSCALL_INIT (&s);
- s.p1 = (PTR) sd;
- s.p2 = (PTR) current_cpu;
- s.read_mem = sim_syscall_read_mem;
- s.write_mem = sim_syscall_write_mem;
- /* Extract parameters. */
- s.func = GET_H_GR (8);
- s.arg1 = GET_H_GR (1);
- s.arg2 = GET_H_GR (2);
- s.arg3 = GET_H_GR (3);
- /* Halt the simulator if the requested system call is _exit. */
- if (s.func == TARGET_SYS_exit)
- sim_engine_halt (sd, current_cpu, NULL, pc, sim_exited, s.arg1);
+ long result, result2;
+ int errcode;
+
/* Perform the system call. */
- cb_syscall (cb, &s);
+ sim_syscall_multi (current_cpu, GET_H_GR (8), GET_H_GR (1), GET_H_GR (2),
+ GET_H_GR (3), GET_H_GR (4), &result, &result2,
+ &errcode);
/* Store the return value in the CPU's registers. */
- SET_H_GR (1, s.result);
- SET_H_GR (2, s.result2);
- SET_H_GR (3, s.errcode);
+ SET_H_GR (1, result);
+ SET_H_GR (2, result2);
+ SET_H_GR (3, errcode);
+
/* Skip over scall instruction. */
return pc + 4;
}