sim: syscall: unify memory helpers
Almost every port implements these two callbacks in the same way, so unify them in the common layer.
This commit is contained in:
parent
6362a3f875
commit
61a0c964e6
@ -1,3 +1,10 @@
|
||||
2015-06-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c: Include sim-syscall.h.
|
||||
(syscall_read_mem, syscall_write_mem): Delete.
|
||||
(bfin_syscall): Change syscall_read_mem/syscall_write_mem to
|
||||
sim_syscall_read_mem/sim_syscall_write_mem.
|
||||
|
||||
2015-06-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* linux-targ-map.h: Update example comments.
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "gdb/callback.h"
|
||||
#include "gdb/signals.h"
|
||||
#include "sim-main.h"
|
||||
#include "sim-syscall.h"
|
||||
#include "sim-hw.h"
|
||||
|
||||
#include "targ-vals.h"
|
||||
@ -125,32 +126,6 @@ count_argc (const char * const *argv)
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Read/write functions for system call interface. */
|
||||
|
||||
static int
|
||||
syscall_read_mem (host_callback *cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
TRACE_CORE (cpu, "DBUS FETCH (syscall) %i bytes @ 0x%08lx", bytes, taddr);
|
||||
|
||||
return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
static int
|
||||
syscall_write_mem (host_callback *cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, const char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
TRACE_CORE (cpu, "DBUS STORE (syscall) %i bytes @ 0x%08lx", bytes, taddr);
|
||||
|
||||
return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
/* Simulate a monitor trap, put the result into r0 and errno into r1
|
||||
return offset by which to adjust pc. */
|
||||
|
||||
@ -192,8 +167,8 @@ bfin_syscall (SIM_CPU *cpu)
|
||||
}
|
||||
sc.p1 = (PTR) sd;
|
||||
sc.p2 = (PTR) cpu;
|
||||
sc.read_mem = syscall_read_mem;
|
||||
sc.write_mem = syscall_write_mem;
|
||||
sc.read_mem = sim_syscall_read_mem;
|
||||
sc.write_mem = sim_syscall_write_mem;
|
||||
|
||||
/* Common cb_syscall() handles most functions. */
|
||||
switch (cb_target_to_host_syscall (cb, sc.func))
|
||||
|
@ -1,3 +1,9 @@
|
||||
2015-06-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* Make-common.in (SIM_NEW_COMMON_OBJS): Add sim-syscall.o.
|
||||
* sim-syscall.c: New file.
|
||||
* sim-syscall.h: New file.
|
||||
|
||||
2015-06-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* callback.c (cb_target_map_entry, cb_host_map_entry): Define.
|
||||
|
@ -190,6 +190,7 @@ SIM_NEW_COMMON_OBJS = \
|
||||
sim-options.o \
|
||||
sim-profile.o \
|
||||
sim-signal.o \
|
||||
sim-syscall.o \
|
||||
sim-trace.o \
|
||||
sim-utils.o \
|
||||
sim-watch.o \
|
||||
|
49
sim/common/sim-syscall.c
Normal file
49
sim/common/sim-syscall.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* Simulator system call support.
|
||||
|
||||
Copyright 2002-2015 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of simulators.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "sim-main.h"
|
||||
#include "sim-syscall.h"
|
||||
|
||||
/* Read/write functions for system call interface. */
|
||||
|
||||
int
|
||||
sim_syscall_read_mem (host_callback *cb ATTRIBUTE_UNUSED, struct cb_syscall *sc,
|
||||
unsigned long taddr, char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
TRACE_MEMORY (cpu, "READ (syscall) %i bytes @ 0x%08lx", bytes, taddr);
|
||||
|
||||
return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
int
|
||||
sim_syscall_write_mem (host_callback *cb ATTRIBUTE_UNUSED, struct cb_syscall *sc,
|
||||
unsigned long taddr, const char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
TRACE_MEMORY (cpu, "WRITE (syscall) %i bytes @ 0x%08lx", bytes, taddr);
|
||||
|
||||
return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes);
|
||||
}
|
30
sim/common/sim-syscall.h
Normal file
30
sim/common/sim-syscall.h
Normal file
@ -0,0 +1,30 @@
|
||||
/* Simulator system call support.
|
||||
|
||||
Copyright 2002-2015 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of simulators.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef SIM_SYSCALL_H
|
||||
#define SIM_SYSCALL_H
|
||||
|
||||
/* Simple memory callbacks for cb_syscall's read_mem/write_mem that assume
|
||||
cb_syscall's p1 and p2 are set to the SIM_DESC and SIM_CPU respectively. */
|
||||
int sim_syscall_read_mem (host_callback *, struct cb_syscall *, unsigned long,
|
||||
char *, int);
|
||||
int sim_syscall_write_mem (host_callback *, struct cb_syscall *, unsigned long,
|
||||
const char *, int);
|
||||
|
||||
#endif
|
@ -1,3 +1,10 @@
|
||||
2015-06-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* traps.c: Include sim-syscall.h.
|
||||
(syscall_read_mem, syscall_write_mem): Delete.
|
||||
(cris_break_13_handler): Change syscall_read_mem/syscall_write_mem
|
||||
to sim_syscall_read_mem/sim_syscall_write_mem.
|
||||
|
||||
2015-06-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* traps.c (syscall_map): Fill out name field.
|
||||
|
@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "sim-main.h"
|
||||
#include "sim-syscall.h"
|
||||
#include "sim-options.h"
|
||||
#include "bfd.h"
|
||||
/* FIXME: get rid of targ-vals.h usage everywhere else. */
|
||||
@ -763,10 +764,6 @@ static const CB_TARGET_DEFS_MAP open_map[] = {
|
||||
/* Needed for the cris_pipe_nonempty and cris_pipe_empty syscalls. */
|
||||
static SIM_CPU *current_cpu_for_cb_callback;
|
||||
|
||||
static int syscall_read_mem (host_callback *, struct cb_syscall *,
|
||||
unsigned long, char *, int);
|
||||
static int syscall_write_mem (host_callback *, struct cb_syscall *,
|
||||
unsigned long, const char *, int);
|
||||
static USI create_map (SIM_DESC, struct cris_sim_mmapped_page **,
|
||||
USI addr, USI len);
|
||||
static USI unmap_pages (SIM_DESC, struct cris_sim_mmapped_page **,
|
||||
@ -776,30 +773,6 @@ static USI is_mapped (SIM_DESC, struct cris_sim_mmapped_page **,
|
||||
static void dump_statistics (SIM_CPU *current_cpu);
|
||||
static void make_first_thread (SIM_CPU *current_cpu);
|
||||
|
||||
/* Read/write functions for system call interface. */
|
||||
|
||||
static int
|
||||
syscall_read_mem (host_callback *cb ATTRIBUTE_UNUSED,
|
||||
struct cb_syscall *sc,
|
||||
unsigned long taddr, char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
static int
|
||||
syscall_write_mem (host_callback *cb ATTRIBUTE_UNUSED,
|
||||
struct cb_syscall *sc,
|
||||
unsigned long taddr, const char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
/* When we risk running self-modified code (as in trampolines), this is
|
||||
called from special-case insns. The silicon CRIS CPU:s have enough
|
||||
cache snooping implemented making this a simulator-only issue. Tests:
|
||||
@ -1496,8 +1469,8 @@ cris_break_13_handler (SIM_CPU *current_cpu, USI callnum, USI arg1,
|
||||
|
||||
s.p1 = (PTR) sd;
|
||||
s.p2 = (PTR) current_cpu;
|
||||
s.read_mem = syscall_read_mem;
|
||||
s.write_mem = syscall_write_mem;
|
||||
s.read_mem = sim_syscall_read_mem;
|
||||
s.write_mem = sim_syscall_write_mem;
|
||||
|
||||
current_cpu_for_cb_callback = current_cpu;
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
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
|
||||
to sim_syscall_read_mem/sim_syscall_write_mem.
|
||||
|
||||
2015-06-12 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* configure: Regenerate.
|
||||
|
@ -22,33 +22,10 @@
|
||||
#define WANT_CPU_LM32BF
|
||||
|
||||
#include "sim-main.h"
|
||||
#include "sim-syscall.h"
|
||||
#include "lm32-sim.h"
|
||||
#include "targ-vals.h"
|
||||
|
||||
/* Read memory function for system call interface. */
|
||||
|
||||
static int
|
||||
syscall_read_mem (host_callback * cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
/* Write memory function for system call interface. */
|
||||
|
||||
static int
|
||||
syscall_write_mem (host_callback * cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, const char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
/* Handle invalid instructions. */
|
||||
|
||||
SEM_PC
|
||||
@ -159,8 +136,8 @@ lm32bf_scall_insn (SIM_CPU * current_cpu, IADDR pc)
|
||||
CB_SYSCALL_INIT (&s);
|
||||
s.p1 = (PTR) sd;
|
||||
s.p2 = (PTR) current_cpu;
|
||||
s.read_mem = syscall_read_mem;
|
||||
s.write_mem = syscall_write_mem;
|
||||
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);
|
||||
|
@ -1,3 +1,14 @@
|
||||
2015-06-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* traps-linux.c: Include sim-syscall.h.
|
||||
(syscall_read_mem, syscall_write_mem): Delete.
|
||||
(m32r_trap): Change syscall_read_mem/syscall_write_mem
|
||||
to sim_syscall_read_mem/sim_syscall_write_mem.
|
||||
* traps.c: Include sim-syscall.h.
|
||||
(syscall_read_mem, syscall_write_mem): Delete.
|
||||
(m32r_trap): Change syscall_read_mem/syscall_write_mem
|
||||
to sim_syscall_read_mem/sim_syscall_write_mem.
|
||||
|
||||
2015-06-12 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* configure: Regenerate.
|
||||
|
@ -18,6 +18,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "sim-main.h"
|
||||
#include "sim-syscall.h"
|
||||
#include "syscall.h"
|
||||
#include "targ-vals.h"
|
||||
#include <dirent.h>
|
||||
@ -113,28 +114,6 @@ m32r_core_signal (SIM_DESC sd, SIM_CPU *current_cpu, sim_cia cia,
|
||||
transfer, sig);
|
||||
}
|
||||
|
||||
/* Read/write functions for system call interface. */
|
||||
|
||||
static int
|
||||
syscall_read_mem (host_callback *cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
static int
|
||||
syscall_write_mem (host_callback *cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, const char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
/* Translate target's address to host's address. */
|
||||
|
||||
static void *
|
||||
@ -249,8 +228,8 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num)
|
||||
|
||||
s.p1 = (PTR) sd;
|
||||
s.p2 = (PTR) current_cpu;
|
||||
s.read_mem = syscall_read_mem;
|
||||
s.write_mem = syscall_write_mem;
|
||||
s.read_mem = sim_syscall_read_mem;
|
||||
s.write_mem = sim_syscall_write_mem;
|
||||
cb_syscall (cb, &s);
|
||||
m32rbf_h_gr_set (current_cpu, 2, s.errcode);
|
||||
m32rbf_h_gr_set (current_cpu, 0, s.result);
|
||||
@ -290,8 +269,8 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num)
|
||||
|
||||
s.p1 = (PTR) sd;
|
||||
s.p2 = (PTR) current_cpu;
|
||||
s.read_mem = syscall_read_mem;
|
||||
s.write_mem = syscall_write_mem;
|
||||
s.read_mem = sim_syscall_read_mem;
|
||||
s.write_mem = sim_syscall_write_mem;
|
||||
|
||||
result = 0;
|
||||
result2 = 0;
|
||||
|
@ -18,6 +18,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "sim-main.h"
|
||||
#include "sim-syscall.h"
|
||||
#include "targ-vals.h"
|
||||
|
||||
#define TRAP_FLUSH_CACHE 12
|
||||
@ -92,28 +93,6 @@ m32r_core_signal (SIM_DESC sd, SIM_CPU *current_cpu, sim_cia cia,
|
||||
transfer, sig);
|
||||
}
|
||||
|
||||
/* Read/write functions for system call interface. */
|
||||
|
||||
static int
|
||||
syscall_read_mem (host_callback *cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
static int
|
||||
syscall_write_mem (host_callback *cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, const char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
/* Trap support.
|
||||
The result is the pc address to continue at.
|
||||
Preprocessing like saving the various registers has already been done. */
|
||||
@ -165,8 +144,8 @@ m32r_trap (SIM_CPU *current_cpu, PCADDR pc, int num)
|
||||
|
||||
s.p1 = (PTR) sd;
|
||||
s.p2 = (PTR) current_cpu;
|
||||
s.read_mem = syscall_read_mem;
|
||||
s.write_mem = syscall_write_mem;
|
||||
s.read_mem = sim_syscall_read_mem;
|
||||
s.write_mem = sim_syscall_write_mem;
|
||||
cb_syscall (cb, &s);
|
||||
m32rbf_h_gr_set (current_cpu, 2, s.errcode);
|
||||
m32rbf_h_gr_set (current_cpu, 0, s.result);
|
||||
|
@ -1,3 +1,10 @@
|
||||
2015-06-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* interp.c: Include sim-syscall.h.
|
||||
(syscall_read_mem, syscall_write_mem): Delete.
|
||||
(m32r_trap): Change syscall_read_mem/syscall_write_mem
|
||||
to sim_syscall_read_mem/sim_syscall_write_mem.
|
||||
|
||||
2015-06-12 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* configure: Regenerate.
|
||||
|
@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "sim-main.h"
|
||||
#include "sim-base.h"
|
||||
#include "sim-syscall.h"
|
||||
#include "sim-options.h"
|
||||
|
||||
#define target_big_endian (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
|
||||
@ -197,28 +198,6 @@ set_initial_gprs (SIM_CPU *scpu)
|
||||
cpu.gr[PARM4] = cpu.gr[0];
|
||||
}
|
||||
|
||||
/* Read/write functions for system call interface. */
|
||||
|
||||
static int
|
||||
syscall_read_mem (host_callback *cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
static int
|
||||
syscall_write_mem (host_callback *cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, const char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
/* Simulate a monitor trap. */
|
||||
|
||||
static void
|
||||
@ -237,8 +216,8 @@ handle_trap1 (SIM_DESC sd)
|
||||
|
||||
sc.p1 = (PTR) sd;
|
||||
sc.p2 = (PTR) STATE_CPU (sd, 0);
|
||||
sc.read_mem = syscall_read_mem;
|
||||
sc.write_mem = syscall_write_mem;
|
||||
sc.read_mem = sim_syscall_read_mem;
|
||||
sc.write_mem = sim_syscall_write_mem;
|
||||
|
||||
cb_syscall (cb, &sc);
|
||||
|
||||
|
@ -1,3 +1,11 @@
|
||||
2015-06-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* mn10300_sim.h (syscall_read_mem, syscall_write_mem): Delete.
|
||||
* op_utils.c: Include sim-syscall.h.
|
||||
(syscall_read_mem, syscall_write_mem): Delete.
|
||||
(do_syscall): Change syscall_read_mem/syscall_write_mem
|
||||
to sim_syscall_read_mem/sim_syscall_write_mem. Set syscall.p2.
|
||||
|
||||
2015-06-12 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* configure: Regenerate.
|
||||
|
@ -200,16 +200,6 @@ INLINE_SIM_MAIN (void) genericCmp (unsigned32 leftOpnd, unsigned32 rightOpnd);
|
||||
INLINE_SIM_MAIN (void) genericOr (unsigned32 source, unsigned32 destReg);
|
||||
INLINE_SIM_MAIN (void) genericXor (unsigned32 source, unsigned32 destReg);
|
||||
INLINE_SIM_MAIN (void) genericBtst (unsigned32 leftOpnd, unsigned32 rightOpnd);
|
||||
INLINE_SIM_MAIN (int) syscall_read_mem (host_callback *cb,
|
||||
struct cb_syscall *sc,
|
||||
unsigned long taddr,
|
||||
char *buf,
|
||||
int bytes);
|
||||
INLINE_SIM_MAIN (int) syscall_write_mem (host_callback *cb,
|
||||
struct cb_syscall *sc,
|
||||
unsigned long taddr,
|
||||
const char *buf,
|
||||
int bytes);
|
||||
INLINE_SIM_MAIN (void) do_syscall (void);
|
||||
void program_interrupt (SIM_DESC sd, sim_cpu *cpu, sim_cia cia, SIM_SIGNAL sig);
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "sim-main.h"
|
||||
#include "sim-syscall.h"
|
||||
#include "targ-vals.h"
|
||||
|
||||
#ifdef HAVE_UTIME_H
|
||||
@ -140,28 +141,6 @@ genericBtst(unsigned32 leftOpnd, unsigned32 rightOpnd)
|
||||
PSW |= (z ? PSW_Z : 0) | (n ? PSW_N : 0);
|
||||
}
|
||||
|
||||
/* Read/write functions for system call interface. */
|
||||
INLINE_SIM_MAIN (int)
|
||||
syscall_read_mem (host_callback *cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
sim_cpu *cpu = STATE_CPU(sd, 0);
|
||||
|
||||
return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
INLINE_SIM_MAIN (int)
|
||||
syscall_write_mem (host_callback *cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, const char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
sim_cpu *cpu = STATE_CPU(sd, 0);
|
||||
|
||||
return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
|
||||
/* syscall */
|
||||
INLINE_SIM_MAIN (void)
|
||||
do_syscall (void)
|
||||
@ -204,8 +183,9 @@ do_syscall (void)
|
||||
syscall.arg3 = PARM3;
|
||||
syscall.func = FUNC;
|
||||
syscall.p1 = (PTR) simulator;
|
||||
syscall.read_mem = syscall_read_mem;
|
||||
syscall.write_mem = syscall_write_mem;
|
||||
syscall.p2 = (PTR) STATE_CPU (simulator, 0);
|
||||
syscall.read_mem = sim_syscall_read_mem;
|
||||
syscall.write_mem = sim_syscall_write_mem;
|
||||
cb_syscall (STATE_CALLBACK (simulator), &syscall);
|
||||
RETERR = syscall.errcode;
|
||||
RETVAL = syscall.result;
|
||||
|
@ -1,3 +1,10 @@
|
||||
2015-06-17 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* msp430-sim.c: Include sim-syscall.h.
|
||||
(syscall_read_mem, syscall_write_mem): Delete.
|
||||
(maybe_perform_syscall): Change syscall_read_mem/syscall_write_mem
|
||||
to sim_syscall_read_mem/sim_syscall_write_mem.
|
||||
|
||||
2015-06-12 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* configure: Regenerate.
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "bfd.h"
|
||||
#include "opcode/msp430-decode.h"
|
||||
#include "sim-main.h"
|
||||
#include "sim-syscall.h"
|
||||
#include "dis-asm.h"
|
||||
#include "targ-vals.h"
|
||||
#include "trace.h"
|
||||
@ -949,26 +950,6 @@ binary_to_bcd (int v)
|
||||
return r;
|
||||
}
|
||||
|
||||
static int
|
||||
syscall_read_mem (host_callback *cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
return sim_core_read_buffer (sd, cpu, read_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
static int
|
||||
syscall_write_mem (host_callback *cb, struct cb_syscall *sc,
|
||||
unsigned long taddr, const char *buf, int bytes)
|
||||
{
|
||||
SIM_DESC sd = (SIM_DESC) sc->p1;
|
||||
SIM_CPU *cpu = (SIM_CPU *) sc->p2;
|
||||
|
||||
return sim_core_write_buffer (sd, cpu, write_map, buf, taddr, bytes);
|
||||
}
|
||||
|
||||
static const char *
|
||||
cond_string (int cond)
|
||||
{
|
||||
@ -1089,8 +1070,8 @@ maybe_perform_syscall (SIM_DESC sd, int call_addr)
|
||||
|
||||
sc.p1 = sd;
|
||||
sc.p2 = MSP430_CPU (sd);
|
||||
sc.read_mem = syscall_read_mem;
|
||||
sc.write_mem = syscall_write_mem;
|
||||
sc.read_mem = sim_syscall_read_mem;
|
||||
sc.write_mem = sim_syscall_write_mem;
|
||||
|
||||
cb_syscall (cb, &sc);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user