Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* SIM: Add support for Intel iWMMXt processor
@ 2003-03-27 17:12 Nick Clifton
       [not found] ` <mailpost.1048785176.589@news-sj1-1>
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2003-03-27 17:12 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]

Hi Guys,

  I am applying the attached patch below to add support for Intel's
  iWMMXt processor to the ARM simulator.  (The old armulator based
  one, not the cgen based one).

  There are also some patches for GDB itself but I am holding off on
  submitting these until I can them for multi-arch issues.

Cheers
        Nick

include/gdb/ChangeLog
2003-03-27  Nick Clifton  <nickc@redhat.com>

	* sim-arm.h (sim_arm_regs): Add iWMMXt registers.

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

	* configure.in: (CON_FLAGS): Define and initialise.
	(COPRO): Add iwmmxt.o if configuring for XScale.
	* configure: Regenerate.
	* Makefile.in (iwmmxt.o): Add rule to build.
	(COM_FLAGS): Define.
	(ALL_FLAGS): Add CON_FLAGS.
	* armcopro.c (ARMul_CoProInit): Initialise iWMMXt coprocessors.
	* armdefs.h (struct ARMul_State): Add 'is_iWMMXt' field.
	(ARM_iWMMXt_Prop): Define.
	* armemu.c (ARMul_Emulate16): Intercept iWMMXt instructions and
	pass to coprocessor.
	* arminit.c (ARMul_NewState): Initialise 'is_iWMMXt'.
	(ARMul_Abort): Catch branches through uninitialised vectors.
	* armos.c (softevtorcode): Update comment.
	(ARMul_OsInit): Use ARMUndefinedInstrV.
	(ARMul_OsHandleSWI): Catch SWIs for unhandled vectors.
	* wrapper.c (sim_create_inferior): Handle iWMMXt processor type.
	(sim_store_register): Handle iWMMXt registers.
	(sim_fetch_register): Handle iWMMXt registers.
	* iwmmxt.h: New file. Exported iWMMXt coprocessor emulator
	functions.
	* iwmmxt.c: New file: iWMMXt emulator.


[-- Attachment #2: iWMMXt simulator patch --]
[-- Type: application/x-bzip2, Size: 15137 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SIM: Add support for Intel iWMMXt processor
       [not found] ` <mailpost.1048785176.589@news-sj1-1>
@ 2003-03-27 17:32   ` cgd
  2003-03-27 17:48     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: cgd @ 2003-03-27 17:32 UTC (permalink / raw)
  To: nickc; +Cc: gdb-patches

At Thu, 27 Mar 2003 17:12:56 +0000 (UTC), "Nick Clifton" wrote:
>   I am applying the attached patch below to add support for Intel's
>   iWMMXt processor to the ARM simulator.  (The old armulator based
>   one, not the cgen based one).

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?


cgd


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SIM: Add support for Intel iWMMXt processor
  2003-03-27 17:32   ` cgd
@ 2003-03-27 17:48     ` Daniel Jacobowitz
  2003-03-30 10:38       ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2003-03-27 17:48 UTC (permalink / raw)
  To: nickc; +Cc: cgd, gdb-patches

On Thu, Mar 27, 2003 at 09:31:49AM -0800, cgd@broadcom.com wrote:
> At Thu, 27 Mar 2003 17:12:56 +0000 (UTC), "Nick Clifton" wrote:
> >   I am applying the attached patch below to add support for Intel's
> >   iWMMXt processor to the ARM simulator.  (The old armulator based
> >   one, not the cgen based one).
> 
> 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?

These patches also contain #if 0'd code; why introduce _new_ dead code?
I believe most of the #ifdefs can be safely removed.  I notice you
change one thing marked as "used by the FPE code" without conditioning
it on iWMMXt (search for 0x91).  Is that correct?

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

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SIM: Add support for Intel iWMMXt processor
  2003-03-27 17:48     ` Daniel Jacobowitz
@ 2003-03-30 10:38       ` Nick Clifton
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2003-03-30 10:38 UTC (permalink / raw)
  To: drow, cgd; +Cc: gdb-patches

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;
      }


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-03-30 10:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-27 17:12 SIM: Add support for Intel iWMMXt processor Nick Clifton
     [not found] ` <mailpost.1048785176.589@news-sj1-1>
2003-03-27 17:32   ` cgd
2003-03-27 17:48     ` Daniel Jacobowitz
2003-03-30 10:38       ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox