SIM: Add support for Intel iWMMXt processor

Nick Clifton nickc@redhat.com
Sun Mar 30 10:38:00 GMT 2003


Hi Daniel, Hi Chris,

> > I took a look at this patch, just to see what was inside, and noticed
> > definition and uses of __IWMMXT__.  Is it "the right thing" to be
> > defining and using a macro name which (i believe 8-) is in the
> > implementation namespace?

Well it is debatable.  Since the simulator emulates SWIs and some
basic OS functions (eg read/write to stdio) it could be considered an
operating system type of thing which would place it in the
implementation name space.

However, I do agree that the ifdefs are not needed, so I will apply
the patch below to fix this.


> These patches also contain #if 0'd code; why introduce _new_ dead
> code?

Because the code is deliberately suppressed.  It contains debugging
code which is very useful to help track down stack alignment problems
when executing iWMMXt code, but which is far too verbose to be useful
in normal situations.  If you have a look at the code in question you
will see that there is a similar bit of suppressed code just above it
for detecting branch-into-uninitialised-memory bugs.

The patch adds a comment explaining what the suppressed code does.


> I notice you change one thing marked as "used by the FPE code"
> without conditioning it on iWMMXt (search for 0x91).  Is that
> correct?

Yes - this was a generic bug fix that was included with the iWMMXt
submission.  And yes it should have been submitted separately with its
own ChangeLog entry.  The patch also takes care of this.


> I understand you're eager to get this stuff out, but please pay
> attention to what you're committing.

*Sigh* it seems to be bash Nick week.

Cheers
        Nick

sim/arm/ChangeLog
2003-03-30  Nick Clifton  <nickc@redhat.com>

	* configure.in (CON_FLAGS): Remove.
	(COPRO): Unconditionally include iwmmxt.o.
	* configure: Regenerate.
	* Makefile.in (CON_FLAGS): Remove.
	* armcopro.c: Remove use of __IWMMXT__ flag.
	* wrapper.c: Likewise.
	* armemu.c: Likewise.
	Add explanatory comment for suppressed code.

2003-03-27  Nick Clifton  <nickc@redhat.com>

	* armos.c (ARMul_OsHandleSWI): Catch SWIs for unhandled vectors.

Index: sim/arm/Makefile.in
===================================================================
RCS file: /cvs/src/src/sim/arm/Makefile.in,v
retrieving revision 1.7
diff -c -3 -p -w -r1.7 Makefile.in
*** sim/arm/Makefile.in	27 Mar 2003 17:13:33 -0000	1.7
--- sim/arm/Makefile.in	30 Mar 2003 10:26:15 -0000
*************** armcopro.o: armcopro.c armdefs.h
*** 34,43 ****
  maverick.o: maverick.c armdefs.h
  iwmmxt.o: iwmmxt.c iwmmxt.h armdefs.h
  
- CON_FLAGS=@CON_FLAGS@
- 
- ALL_CFLAGS += $(CON_FLAGS)
- 
  armemu26.o: armemu.c armdefs.h armemu.h 
  	$(CC) -c $(srcdir)/armemu.c -o armemu26.o $(ALL_CFLAGS)
  
--- 34,39 ----

Index: sim/arm/armcopro.c
===================================================================
RCS file: /cvs/src/src/sim/arm/armcopro.c,v
retrieving revision 1.12
diff -c -3 -p -w -r1.12 armcopro.c
*** sim/arm/armcopro.c	27 Mar 2003 17:13:33 -0000	1.12
--- sim/arm/armcopro.c	30 Mar 2003 10:26:15 -0000
***************
*** 19,27 ****
  #include "armos.h"
  #include "armemu.h"
  #include "ansidecl.h"
- #ifdef __IWMMXT__
  #include "iwmmxt.h"
- #endif
  
  /* Dummy Co-processors.  */
  
--- 19,25 ----
*************** ARMul_CoProInit (ARMul_State * state)
*** 1368,1374 ****
  			 MMUMRC, MMUMCR, NULL, MMURead, MMUWrite);
      }
  
- #ifdef __IWMMXT__
    if (state->is_iWMMXt)
      {
        ARMul_CoProAttach (state, 0, NULL, NULL, IwmmxtLDC, IwmmxtSTC,
--- 1366,1371 ----
*************** ARMul_CoProInit (ARMul_State * state)
*** 1377,1383 ****
        ARMul_CoProAttach (state, 1, NULL, NULL, NULL, NULL,
  			 IwmmxtMRC, IwmmxtMCR, IwmmxtCDP, NULL, NULL);
      }
! #endif
    /* No handlers below here.  */
  
    /* Call all the initialisation routines.  */
--- 1374,1380 ----
        ARMul_CoProAttach (state, 1, NULL, NULL, NULL, NULL,
  			 IwmmxtMRC, IwmmxtMCR, IwmmxtCDP, NULL, NULL);
      }
! 
    /* No handlers below here.  */
  
    /* Call all the initialisation routines.  */

Index: sim/arm/armemu.c
===================================================================
RCS file: /cvs/src/src/sim/arm/armemu.c,v
retrieving revision 1.29
diff -c -3 -p -w -r1.29 armemu.c
*** sim/arm/armemu.c	27 Mar 2003 17:13:33 -0000	1.29
--- sim/arm/armemu.c	30 Mar 2003 10:26:17 -0000
***************
*** 19,27 ****
  #include "armdefs.h"
  #include "armemu.h"
  #include "armos.h"
- #ifdef __IWMMXT__
  #include "iwmmxt.h"
- #endif
  
  static ARMword  GetDPRegRHS         (ARMul_State *, ARMword);
  static ARMword  GetDPSRegRHS        (ARMul_State *, ARMword);
--- 19,25 ----
*************** ARMul_Emulate26 (ARMul_State * state)
*** 377,390 ****
  
        if (state->EventSet)
  	ARMul_EnvokeEvent (state);
! #if 0
!       /* Enable this for a helpful bit of debugging when tracing is needed.  */
        fprintf (stderr, "pc: %x, instr: %x\n", pc & ~1, instr);
        if (instr == 0)
  	abort ();
  #endif
! #ifdef __IWMMXT__
! #if 0
        {
  	static ARMword old_sp = -1;
  
--- 375,386 ----
  
        if (state->EventSet)
  	ARMul_EnvokeEvent (state);
! #if 0 /* Enable this for a helpful bit of debugging when tracing is needed.  */
        fprintf (stderr, "pc: %x, instr: %x\n", pc & ~1, instr);
        if (instr == 0)
  	abort ();
  #endif
! #if 0 /* Enable this code to help track down stack alignment bugs.  */
        {
  	static ARMword old_sp = -1;
  
*************** ARMul_Emulate26 (ARMul_State * state)
*** 396,402 ****
  	  }
        }
  #endif
- #endif
  
        if (state->Exception)
  	{
--- 392,397 ----
*************** ARMul_Emulate26 (ARMul_State * state)
*** 509,520 ****
  	      else if ((instr & 0xFC70F000) == 0xF450F000)
  		/* The PLD instruction.  Ignored.  */
  		goto donext;
- #ifdef __IWMMXT__
  	      else if (   ((instr & 0xfe500f00) == 0xfc100100)
  		       || ((instr & 0xfe500f00) == 0xfc000100))
  		/* wldrw and wstrw are unconditional.  */
  		goto mainswitch;
- #endif
  	      else
  		/* UNDEFINED in v5, UNPREDICTABLE in v3, v4, non executed in v1, v2.  */
  		ARMul_UndefInstr (state, instr);
--- 504,513 ----
*************** check_PMUintr:
*** 712,721 ****
  		      goto donext;
  		    }
  		}
! #ifdef __IWMMXT__
  	      if (ARMul_HandleIwmmxt (state, instr))
  		goto donext;
- #endif
  	    }
  
  	  switch ((int) BITS (20, 27))
--- 705,713 ----
  		      goto donext;
  		    }
  		}
! 
  	      if (ARMul_HandleIwmmxt (state, instr))
  		goto donext;
  	    }
  
  	  switch ((int) BITS (20, 27))

Index: sim/arm/configure.in
===================================================================
RCS file: /cvs/src/src/sim/arm/configure.in,v
retrieving revision 1.4
diff -c -3 -p -w -r1.4 configure.in
*** sim/arm/configure.in	27 Mar 2003 17:13:33 -0000	1.4
--- sim/arm/configure.in	30 Mar 2003 10:26:21 -0000
*************** SIM_AC_COMMON
*** 7,22 ****
  
  AC_CHECK_HEADERS(unistd.h)
  
- COPRO="armcopro.o maverick.o"
- CON_FLAGS=  
- case x$target_alias in
- 	xxscale-*)
  		COPRO="armcopro.o maverick.o iwmmxt.o"
- 		CON_FLAGS=-D__IWMMXT__
- 		;;
- esac
  
- AC_SUBST(CON_FLAGS)
  AC_SUBST(COPRO)
  
  SIM_AC_OUTPUT
--- 7,14 ----

Index: sim/arm/wrapper.c
===================================================================
RCS file: /cvs/src/src/sim/arm/wrapper.c,v
retrieving revision 1.26
diff -c -3 -p -w -r1.26 wrapper.c
*** sim/arm/wrapper.c	27 Mar 2003 17:13:33 -0000	1.26
--- sim/arm/wrapper.c	30 Mar 2003 10:26:22 -0000
*************** sim_store_register (sd, rn, memory, leng
*** 505,511 ****
        memcpy (&DSPsc, memory, sizeof DSPsc);
        return sizeof DSPsc;
  
- #ifdef __IWMMXT__
      case SIM_ARM_IWMMXT_COP0R0_REGNUM:
      case SIM_ARM_IWMMXT_COP0R1_REGNUM:
      case SIM_ARM_IWMMXT_COP0R2_REGNUM:
--- 505,510 ----
*************** sim_store_register (sd, rn, memory, leng
*** 539,545 ****
      case SIM_ARM_IWMMXT_COP1R14_REGNUM:
      case SIM_ARM_IWMMXT_COP1R15_REGNUM:
        return Store_Iwmmxt_Register (rn - SIM_ARM_IWMMXT_COP0R0_REGNUM, memory);
! #endif
      default:
        return 0;
      }
--- 538,544 ----
      case SIM_ARM_IWMMXT_COP1R14_REGNUM:
      case SIM_ARM_IWMMXT_COP1R15_REGNUM:
        return Store_Iwmmxt_Register (rn - SIM_ARM_IWMMXT_COP0R0_REGNUM, memory);
! 
      default:
        return 0;
      }
*************** sim_fetch_register (sd, rn, memory, leng
*** 619,625 ****
        memcpy (memory, & DSPsc, sizeof DSPsc);
        return sizeof DSPsc;
  
- #ifdef __IWMMXT__
      case SIM_ARM_IWMMXT_COP0R0_REGNUM:
      case SIM_ARM_IWMMXT_COP0R1_REGNUM:
      case SIM_ARM_IWMMXT_COP0R2_REGNUM:
--- 618,623 ----
*************** sim_fetch_register (sd, rn, memory, leng
*** 653,659 ****
      case SIM_ARM_IWMMXT_COP1R14_REGNUM:
      case SIM_ARM_IWMMXT_COP1R15_REGNUM:
        return Fetch_Iwmmxt_Register (rn - SIM_ARM_IWMMXT_COP0R0_REGNUM, memory);
! #endif
      default:
        return 0;
      }
--- 651,657 ----
      case SIM_ARM_IWMMXT_COP1R14_REGNUM:
      case SIM_ARM_IWMMXT_COP1R15_REGNUM:
        return Fetch_Iwmmxt_Register (rn - SIM_ARM_IWMMXT_COP0R0_REGNUM, memory);
! 
      default:
        return 0;
      }



More information about the Gdb-patches mailing list