forked from Imagelibrary/binutils-gdb
sim: m32r: unify ELF & Linux traps logic
This makes the simulator work the same regardless of the target (bare metal m32r-elf or Linux m32r-linux-gnu) by unifying the traps code. It was mostly already the same with the only difference being support for trap #2 reserved for Linux syscalls. We can move that logic to runtime by checking the current environment operating mode instead.
This commit is contained in:
@@ -1,3 +1,15 @@
|
||||
2021-07-01 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* Makefile.in (TRAPS_OBJ, SIM_EXTRA_CFLAGS): Delete.
|
||||
* configure.ac (traps_obj, sim_extra_cflags): Delete.
|
||||
* sim-if.c (M32R_DEFAULT_MEM_SIZE): New define.
|
||||
(sim_create_inferior): Replace M32R_LINUX with STATE_ENVIRONMENT
|
||||
check.
|
||||
* sim-main.h (M32R_DEFAULT_MEM_SIZE): Delete.
|
||||
* traps-linux.c: Merge with ...
|
||||
* traps.c: ... this file.
|
||||
* configure: Regenerate.
|
||||
|
||||
2021-07-01 Mike Frysinger <vapier@gentoo.org>
|
||||
|
||||
* traps-linux.c (conv_endian, conv_endian16,
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
M32R_OBJS = m32r.o cpu.o decode.o sem.o model.o mloop.o
|
||||
M32RX_OBJS = m32rx.o cpux.o decodex.o modelx.o mloopx.o
|
||||
M32R2_OBJS = m32r2.o cpu2.o decode2.o model2.o mloop2.o
|
||||
TRAPS_OBJ = @traps_obj@
|
||||
|
||||
SIM_OBJS = \
|
||||
$(SIM_NEW_COMMON_OBJS) \
|
||||
@@ -32,7 +31,7 @@ SIM_OBJS = \
|
||||
$(M32R_OBJS) \
|
||||
$(M32RX_OBJS) \
|
||||
$(M32R2_OBJS) \
|
||||
$(TRAPS_OBJ)
|
||||
traps.o
|
||||
|
||||
SIM_EXTRA_HW_DEVICES = m32r_cache m32r_uart
|
||||
|
||||
@@ -42,8 +41,6 @@ SIM_EXTRA_DEPS = \
|
||||
arch.h cpuall.h m32r-sim.h $(srcdir)/../../opcodes/m32r-desc.h \
|
||||
eng.h engx.h eng2.h
|
||||
|
||||
SIM_EXTRA_CFLAGS = @sim_extra_cflags@
|
||||
|
||||
SIM_EXTRA_CLEAN = m32r-clean
|
||||
|
||||
# Code doesn't build cleanly yet.
|
||||
|
||||
15
sim/m32r/configure
vendored
15
sim/m32r/configure
vendored
@@ -590,8 +590,6 @@ sim_reserved_bits
|
||||
sim_float
|
||||
sim_bitsize
|
||||
cgen_breaks
|
||||
sim_extra_cflags
|
||||
traps_obj
|
||||
target_alias
|
||||
host_alias
|
||||
build_alias
|
||||
@@ -1670,19 +1668,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
|
||||
case "${target_alias}" in
|
||||
m32r*-linux*)
|
||||
traps_obj=traps-linux.o
|
||||
sim_extra_cflags="-DM32R_LINUX"
|
||||
;;
|
||||
*)
|
||||
traps_obj=traps.o
|
||||
sim_extra_cflags="-DM32R_ELF"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
cgen_breaks=""
|
||||
if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
|
||||
cgen_breaks="break cgen_rtx_error";
|
||||
|
||||
@@ -2,17 +2,4 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(Makefile.in)
|
||||
AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
|
||||
|
||||
case "${target_alias}" in
|
||||
m32r*-linux*)
|
||||
traps_obj=traps-linux.o
|
||||
sim_extra_cflags="-DM32R_LINUX"
|
||||
;;
|
||||
*)
|
||||
traps_obj=traps.o
|
||||
sim_extra_cflags="-DM32R_ELF"
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(traps_obj)
|
||||
AC_SUBST(sim_extra_cflags)
|
||||
|
||||
SIM_AC_OUTPUT
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
#include "dv-m32r_uart.h"
|
||||
|
||||
#define M32R_DEFAULT_MEM_SIZE 0x2000000 /* 32M */
|
||||
|
||||
static void free_state (SIM_DESC);
|
||||
static void print_m32r_misc_cpu (SIM_CPU *cpu, int verbose);
|
||||
|
||||
@@ -158,12 +160,13 @@ sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char * const *argv,
|
||||
addr = 0;
|
||||
sim_pc_set (current_cpu, addr);
|
||||
|
||||
#ifdef M32R_LINUX
|
||||
m32rbf_h_cr_set (current_cpu,
|
||||
m32r_decode_gdb_ctrl_regnum(SPI_REGNUM), 0x1f00000);
|
||||
m32rbf_h_cr_set (current_cpu,
|
||||
m32r_decode_gdb_ctrl_regnum(SPU_REGNUM), 0x1f00000);
|
||||
#endif
|
||||
if (STATE_ENVIRONMENT (sd) == USER_ENVIRONMENT)
|
||||
{
|
||||
m32rbf_h_cr_set (current_cpu,
|
||||
m32r_decode_gdb_ctrl_regnum(SPI_REGNUM), 0x1f00000);
|
||||
m32rbf_h_cr_set (current_cpu,
|
||||
m32r_decode_gdb_ctrl_regnum(SPU_REGNUM), 0x1f00000);
|
||||
}
|
||||
|
||||
/* Standalone mode (i.e. `run`) will take care of the argv for us in
|
||||
sim_open() -> sim_parse_args(). But in debug mode (i.e. 'target sim'
|
||||
|
||||
@@ -56,11 +56,4 @@ extern SIM_CORE_SIGNAL_FN m32r_core_signal;
|
||||
m32r_core_signal ((SD), (CPU), (CIA), (MAP), (NR_BYTES), (ADDR), \
|
||||
(TRANSFER), (ERROR))
|
||||
|
||||
/* Default memory size. */
|
||||
#ifdef M32R_LINUX
|
||||
#define M32R_DEFAULT_MEM_SIZE 0x2000000 /* 32M */
|
||||
#else
|
||||
#define M32R_DEFAULT_MEM_SIZE 0x800000 /* 8M */
|
||||
#endif
|
||||
|
||||
#endif /* SIM_MAIN_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
1199
sim/m32r/traps.c
1199
sim/m32r/traps.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user