Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* 6.1: Fix gcc 3.5.0 failure in sim
@ 2004-04-19 20:55 Maciej W. Rozycki
       [not found] ` <mailpost.1082408135.5083@news-sj1-1>
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej W. Rozycki @ 2004-04-19 20:55 UTC (permalink / raw)
  To: gdb-patches

Hello,

 Building sim for mipsel-linux fails with gcc 3.5.0 with an "invalid
lvalue in assignment" error.  Here's a fix.

2004-04-19  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>

	* mips/sim-main.h (COP0_BADVADDR): Remove a cast.

 Please apply.

  Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

gdb-6.1-sim-gcc3.patch
diff -up --recursive --new-file gdb-6.1.macro/sim/mips/sim-main.h gdb-6.1/sim/mips/sim-main.h
--- gdb-6.1.macro/sim/mips/sim-main.h	2003-01-05 07:56:59.000000000 +0000
+++ gdb-6.1/sim/mips/sim-main.h	2004-04-15 06:53:58.000000000 +0000
@@ -383,7 +383,7 @@ struct _sim_cpu {
 #define NR_COP0_GPR	32
   unsigned_word cop0_gpr[NR_COP0_GPR];
 #define COP0_GPR	((CPU)->cop0_gpr)
-#define COP0_BADVADDR ((unsigned32)(COP0_GPR[8]))
+#define COP0_BADVADDR (COP0_GPR[8])
 
   /* While space is allocated for the floating point registers in the
      main registers array, they are stored separatly.  This is because


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

* Re: 6.1: Fix gcc 3.5.0 failure in sim
       [not found] ` <mailpost.1082408135.5083@news-sj1-1>
@ 2004-04-19 21:02   ` cgd
  2004-04-20 13:12     ` Maciej W. Rozycki
  0 siblings, 1 reply; 4+ messages in thread
From: cgd @ 2004-04-19 21:02 UTC (permalink / raw)
  To: macro; +Cc: gdb-patches

At Mon, 19 Apr 2004 20:55:35 +0000 (UTC), "Maciej W. Rozycki" wrote:
>  Building sim for mipsel-linux fails with gcc 3.5.0 with an "invalid
> lvalue in assignment" error.  Here's a fix.

Did you test the simulator in any way, once you'd made this change?
(I wouldn't expect a difference, but it's important to know what you
tested, if anything.)



cgd

> 2004-04-19  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
> 
> 	* mips/sim-main.h (COP0_BADVADDR): Remove a cast.
> 
>  Please apply.
> 
>   Maciej
> 
> -- 
> +  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
> +--------------------------------------------------------------+
> +        e-mail: macro@ds2.pg.gda.pl, PGP key available        +
> 
> gdb-6.1-sim-gcc3.patch
> diff -up --recursive --new-file gdb-6.1.macro/sim/mips/sim-main.h gdb-6.1/sim/mips/sim-main.h
> --- gdb-6.1.macro/sim/mips/sim-main.h	2003-01-05 07:56:59.000000000 +0000
> +++ gdb-6.1/sim/mips/sim-main.h	2004-04-15 06:53:58.000000000 +0000
> @@ -383,7 +383,7 @@ struct _sim_cpu {
>  #define NR_COP0_GPR	32
>    unsigned_word cop0_gpr[NR_COP0_GPR];
>  #define COP0_GPR	((CPU)->cop0_gpr)
> -#define COP0_BADVADDR ((unsigned32)(COP0_GPR[8]))
> +#define COP0_BADVADDR (COP0_GPR[8])
>  
>    /* While space is allocated for the floating point registers in the
>       main registers array, they are stored separatly.  This is because


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

* Re: 6.1: Fix gcc 3.5.0 failure in sim
  2004-04-19 21:02   ` cgd
@ 2004-04-20 13:12     ` Maciej W. Rozycki
       [not found]       ` <mailpost.1082466772.363@news-sj1-1>
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej W. Rozycki @ 2004-04-20 13:12 UTC (permalink / raw)
  To: cgd; +Cc: gdb-patches

On Mon, 19 Apr 2004 cgd@broadcom.com wrote:

> >  Building sim for mipsel-linux fails with gcc 3.5.0 with an "invalid
> > lvalue in assignment" error.  Here's a fix.
> 
> Did you test the simulator in any way, once you'd made this change?

 No I didn't.  Actually, I've never used the simulator at all.

> (I wouldn't expect a difference, but it's important to know what you
> tested, if anything.)

 Well, while in the silicon the BadVAddr register has the same width as
general purpose ones, decode_coproc() appears to decode dmfc0/dmtc0 as
32-bit, so perhaps the following change is needed as well (the code looks
messy, grrr).

 Here's an updated patch.  This wasn't tested either. ;-)

2004-04-20  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>

	* mips/interp.c (decode_coproc): Sign-extend the address retrieved 
	from COP0_BADVADDR.
	* mips/sim-main.h (COP0_BADVADDR): Remove a cast.

 Please apply.

  Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

gdb-6.1-sim-gcc3.patch
diff -up --recursive --new-file gdb-6.1.macro/sim/mips/interp.c gdb-6.1/sim/mips/interp.c
--- gdb-6.1.macro/sim/mips/interp.c	2003-02-27 23:26:34.000000000 +0000
+++ gdb-6.1/sim/mips/interp.c	2004-04-20 13:03:50.000000000 +0000
@@ -2102,7 +2102,7 @@ decode_coproc (SIM_DESC sd,
 	      case 8:
 		/* 8 = BadVAddr            R4000   VR4100  VR4300 */
 		if (code == 0x00)
-		  GPR[rt] = COP0_BADVADDR;
+		  GPR[rt] = (signed_word) (signed_address) COP0_BADVADDR;
 		else
 		  COP0_BADVADDR = GPR[rt];
 		break;
diff -up --recursive --new-file gdb-6.1.macro/sim/mips/sim-main.h gdb-6.1/sim/mips/sim-main.h
--- gdb-6.1.macro/sim/mips/sim-main.h	2003-01-05 07:56:59.000000000 +0000
+++ gdb-6.1/sim/mips/sim-main.h	2004-04-20 13:03:44.000000000 +0000
@@ -383,7 +383,7 @@ struct _sim_cpu {
 #define NR_COP0_GPR	32
   unsigned_word cop0_gpr[NR_COP0_GPR];
 #define COP0_GPR	((CPU)->cop0_gpr)
-#define COP0_BADVADDR ((unsigned32)(COP0_GPR[8]))
+#define COP0_BADVADDR	(COP0_GPR[8])
 
   /* While space is allocated for the floating point registers in the
      main registers array, they are stored separatly.  This is because


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

* Re: 6.1: Fix gcc 3.5.0 failure in sim
       [not found]       ` <mailpost.1082466772.363@news-sj1-1>
@ 2004-05-12  1:59         ` cgd
  0 siblings, 0 replies; 4+ messages in thread
From: cgd @ 2004-05-12  1:59 UTC (permalink / raw)
  To: macro; +Cc: gdb-patches

At Tue, 20 Apr 2004 13:12:52 +0000 (UTC), "Maciej W. Rozycki" wrote:
> 2004-04-20  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
> 
> 	* mips/interp.c (decode_coproc): Sign-extend the address retrieved 
> 	from COP0_BADVADDR.
> 	* mips/sim-main.h (COP0_BADVADDR): Remove a cast.

I've finally gotten around to testing (not that there was much to
test) and applying this.  (The code is not right, but the patch
doesn't make it worse and obviously fixes a problem.)

I applied it to both trunk and the 6.1 branch, so that if there's a
6.1.1 it will be included.



cgd


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

end of thread, other threads:[~2004-05-12  1:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-19 20:55 6.1: Fix gcc 3.5.0 failure in sim Maciej W. Rozycki
     [not found] ` <mailpost.1082408135.5083@news-sj1-1>
2004-04-19 21:02   ` cgd
2004-04-20 13:12     ` Maciej W. Rozycki
     [not found]       ` <mailpost.1082466772.363@news-sj1-1>
2004-05-12  1:59         ` cgd

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