This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH] Add micromips support to the MIPS simulator
- From: Andrew Bennett <Andrew dot Bennett at imgtec dot com>
- To: Mike Frysinger <vapier at gentoo dot org>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Fri, 25 Sep 2015 12:06:31 +0000
- Subject: RE: [PATCH] Add micromips support to the MIPS simulator
- Authentication-results: sourceware.org; auth=none
- References: <0DA23CC379F5F945ACB41CF394B9827720F51185 at LEMAIL01 dot le dot imgtec dot org> <20150224054441 dot GA6655 at vapier> <0DA23CC379F5F945ACB41CF394B98277211129DE at LEMAIL01 dot le dot imgtec dot org> <20150917044236 dot GB6834 at vapier dot lan>
> > No, they are required for some of the macros used in the file so they need
> to
> > stay in.
>
> this needs to be documented as to why. other ports don't need this, and
> it sounds like something wrong with the mips port that should be fixed at
> some point.
The definitions come from the *_support.h files generated by igen and are required
because they are used in some of the macros in the micromipsrun.c file.
Unfortunately we can not just blindly include the *_support.h files to get these
definitions because some of the defines in these files are specific for a particular
configuration of the simulator for example instruction word size is 16 bits for
micromips16 and 32 bits for micromips32. This means we could break future code
changes by doing this, so a safer approach is to just extract the defines that
we need to get the file to compile.
I have added a comment above the defines which explains this. The diff from my
previous patch is below.
Ok to commit?
Many thanks,
Andrew
diff --git a/sim/mips/micromipsrun.c b/sim/mips/micromipsrun.c
index 7dd10d7..c39138b 100644
--- a/sim/mips/micromipsrun.c
+++ b/sim/mips/micromipsrun.c
@@ -26,6 +26,14 @@
#include "bfd.h"
#include "sim-engine.h"
+/* These definitions come from the *_support.h files generated by igen and are
+ required because they are used in some of the macros in the code below.
+ Unfortunately we can not just blindly include the *_support.h files to get
+ these definitions because some of the defines in these files are specific
+ for a particular configuration of the simulator for example instruction word
+ size is 16 bits for micromips16 and 32 bits for micromips32. This means we
+ could break future code changes by doing this, so a safer approach is to just
+ extract the defines that we need to get this file to compile. */
#define SD sd
#define CPU cpu