This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Make all four mipsisa* simulators support mipsisa{32,64}{,r2}
- From: Richard Sandiford <richard at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 25 Jun 2007 12:53:22 +0100
- Subject: Make all four mipsisa* simulators support mipsisa{32,64}{,r2}
Although most mipsisa* GNU tools support all four of MIPS32, MIP32r2,
MIPS64 and MIPS64r2, the gdb simulator doesn't. So while the gcc
configurations build multilibs for all four targets, it usually isn't
possible to test them all using one configuration's simulator.
Would it be OK to:
- make the all four simulators support all four targets,
- select the target specified by the binary, if any, and
- use the target triplet to set the default architecture otherwise
? This patch does that by reusing the mips64vr* MULTI infrastructure.
I've been testing this locally for a while with no ill effects.
One specific test I tried today was to build mipsisa64-elf-run
with and without the patch, then create four tests:
1. mips32.c:
---------------------------------
int main (void)
{
asm ("maddp $2,$2");
return 0;
}
---------------------------------
compiled as:
mipsisa32r2-elf-gcc -Tidt32.ld mips32.c -mips32 \
-Wa,-msmartmips -o mips32
2. mips32r2.c:
---------------------------------
int main (void)
{
asm ("maddp $2,$2");
asm ("seb $2,$2");
return 0;
}
---------------------------------
compiled as:
mipsisa32r2-elf-gcc -Tidt32.ld mips32r2.c -mips32r2 \
-Wa,-msmartmips -o mips32r2
3. mips64.c:
---------------------------------
int main (void)
{
asm ("dmult $2,$2");
return 0;
}
---------------------------------
compiled as:
mipsisa32r2-elf-gcc -Tidt32.ld mips64.c -mips64 -o mips64
4. mips64r2.c:
---------------------------------
int main (void)
{
asm ("drotr $2,$2,1");
return 0;
}
---------------------------------
compiled as:
mipsisa32r2-elf-gcc -Tidt32.ld mips64r2.c -mips64 \
-Wa,-mips64r2 -o mips64r2
As expected, (3) worked OK with the unpatched compiler, but (1),
(2) and (4) raised a ReservedInstruction exception. (1)-(4) all
worked correctly with the patched simulator. I also tried using
the patched simulator to run the mips32r2 tests with the architecture
forced to mips32; as expected, it too raised ReservedInstruction.
I did the same thing for mips64r2 with the architecture forced
to mips64, and it failed in the same way.
OK to install?
Richard
sim/mips/
* configure.ac (sim_mipsisa3264_configs): New variable.
(mipsis32*-*-, mipsisa32r2*-*-*, mips64*-*-*, mips64r2*-*-*): Make
every configuration support all four targets, using the triplet to
determine the default.
* configure: Regenerate.
Index: sim/mips/configure.ac
===================================================================
--- sim/mips/configure.ac (revision 172263)
+++ sim/mips/configure.ac (working copy)
@@ -109,6 +109,12 @@ sim_igen_filter="32,64,f"
sim_m16_filter="16"
sim_mach_default="mips8000"
+sim_mipsisa3264_configs="\
+ mipsisa32:mips32,mips16,mips16e,smartmips:32,f:mipsisa32\
+ mipsisa32r2:mips32r2,mips16,mips16e,mdmx,dsp,dsp2,smartmips:32,f:mipsisa32r2\
+ mipsisa64:mips64,mips3d,mips16,mips16e,mdmx:32,64,f:mipsisa64\
+ mipsisa64r2:mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2:32,64,f:mipsisa64r2"
+
case "${target}" in
mips*tx39*) sim_gen=IGEN
sim_igen_filter="32,f"
@@ -152,34 +158,26 @@ case "${target}" in
sim_igen_filter="32,64,f"
sim_m16_filter="16"
;;
- mipsisa32r2*-*-*) sim_gen=M16
- sim_igen_machine="-M mips32r2,mips16,mips16e,mdmx,dsp,dsp2,smartmips"
- sim_m16_machine="-M mips16,mips16e,mips32r2"
- sim_igen_filter="32,f"
- sim_mach_default="mipsisa32r2"
- ;;
- mipsisa32*-*-*) sim_gen=M16
- sim_igen_machine="-M mips32,mips16,mips16e,smartmips"
- sim_m16_machine="-M mips16,mips16e,mips32"
- sim_igen_filter="32,f"
- sim_mach_default="mipsisa32"
- ;;
- mipsisa64r2*-*-*) sim_gen=M16
- sim_igen_machine="-M mips64r2,mips3d,mips16,mips16e,mdmx,dsp,dsp2"
- sim_m16_machine="-M mips16,mips16e,mips64r2"
- sim_igen_filter="32,64,f"
- sim_mach_default="mipsisa64r2"
+ mipsisa32r2*-*-*) sim_gen=MULTI
+ sim_multi_configs=$sim_mipsisa3264_configs
+ sim_multi_default="mipsisa32r2"
+ ;;
+ mipsisa32*-*-*) sim_gen=MULTI
+ sim_multi_configs=$sim_mipsisa3264_configs
+ sim_multi_default="mipsisa32"
+ ;;
+ mipsisa64r2*-*-*) sim_gen=MULTI
+ sim_multi_configs=$sim_mipsisa3264_configs
+ sim_multi_default="mipsisa64r2"
;;
mipsisa64sb1*-*-*) sim_gen=IGEN
sim_igen_machine="-M mips64,mips3d,sb1"
sim_igen_filter="32,64,f"
sim_mach_default="mips_sb1"
;;
- mipsisa64*-*-*) sim_gen=M16
- sim_igen_machine="-M mips64,mips3d,mips16,mips16e,mdmx"
- sim_m16_machine="-M mips16,mips16e,mips64"
- sim_igen_filter="32,64,f"
- sim_mach_default="mipsisa64"
+ mipsisa64*-*-*) sim_gen=MULTI
+ sim_multi_configs=$sim_mipsisa3264_configs
+ sim_multi_default="mipsisa64"
;;
mips*lsi*) sim_gen=M16
sim_igen_machine="-M mipsIII,mips16"