Subject: current vax cannot boot and lvalue casts in arch/vax/boot
To: None <port-vax@NetBSD.org>
From: Kirk Russell <kirk@ba23.org>
List: port-vax
Date: 06/10/2006 22:37:10
Hello,

Last week, I tried building a -current VAX CDROM, with the new gcc setup,
and I got about bunch of errors about the "use of cast expressions as
lvalues".  This week, the errors are fixed in -current, but now the
VAX CDROM doesn't boot.  I would guess some of the lvalue cast fixes
might be the root cause of the booting issues.  For example, this
lvalue fix to ra.c doesn't look correct to me?  I have enclosed my
lvalue fixes for reference.  Any ideas?  Thanks!

- could this be the cause of the booting problems?
Index: ra.c
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/boot/boot/ra.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -c -r1.14 -r1.15
*** ra.c	11 Dec 2005 12:19:30 -0000	1.14
--- ra.c	8 Jun 2006 07:03:11 -0000	1.15
[...]
***************
*** 111,117 ****
  			mapregs = (int *)nexaddr + 512;
  			mapregs[494] = PG_V | (((u_int)&uda) >> 9);
  			mapregs[495] = mapregs[494] + 1;
! 			(char *)ubauda = (char *)0x3dc00 +
  			    (((u_int)(&uda))&0x1ff);
  		} else
  			ubauda = &uda;
--- 111,117 ----
  			mapregs = (int *)nexaddr + 512;
  			mapregs[494] = PG_V | (((u_int)&uda) >> 9);
  			mapregs[495] = mapregs[494] + 1;
! 			ubauda = (struct uda *)0x3dc00 +
  			    (((u_int)(&uda))&0x1ff);
  		} else
  			ubauda = &uda;

- here are errors about the lvalue casts
sys/arch/vax/boot/boot/ra.c:115: warning: use of cast expressions as lvalues is deprecated
sys/arch/vax/boot/boot/mfm.c:536: warning: use of cast expressions as lvalues is deprecated
sys/arch/vax/boot/boot/mfm.c:622: warning: use of cast expressions as lvalues is deprecated
sys/arch/vax/boot/boot/if_le.c:173: warning: use of cast expressions as lvalues is deprecated
sys/arch/vax/boot/boot/if_le.c:179: warning: use of cast expressions as lvalues is deprecated
sys/arch/vax/boot/boot/if_le.c:183: warning: use of cast expressions as lvalues is deprecated
sys/arch/vax/boot/boot/if_de.c:117: warning: use of cast expressions as lvalues is deprecated
sys/arch/vax/boot/xxboot/bootxx.c:301: warning: use of cast expressions as lvalues is deprecated
sys/arch/vax/boot/boot/autoconf.c:172: warning: use of cast expressions as lvalues is deprecated

- here are my fixes, for the lvalue casts
Index: arch/vax/boot/boot/autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/boot/boot/autoconf.c,v
retrieving revision 1.23
diff -r1.23 autoconf.c
172c172
< 		(int)scb[i] |= SCB_ISTACK;	/* Only interrupt stack */
---
> 		scb[i] = (struct ivec_dsp*)((uintptr_t)scb[i] | SCB_ISTACK);	/* Only interrupt stack */
Index: arch/vax/boot/boot/if_de.c
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/boot/boot/if_de.c,v
retrieving revision 1.2
diff -r1.2 if_de.c
117c117
< 	(int)pdc = (int)dc & VAX_PGOFSET;
---
> 	pdc = (struct de_cdata*)((uintptr_t)dc & VAX_PGOFSET);
Index: arch/vax/boot/boot/if_le.c
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/boot/boot/if_le.c,v
retrieving revision 1.8
diff -r1.8 if_le.c
68c68
< #define	QW_ALLOC(x)	(((int)alloc((x) + 7) + 7) & ~7)
---
> #define	QW_ALLOC(x)	(((uintptr_t)alloc((x) + 7) + 7) & ~7)
172,173c172,173
< 		(void *)initblock =
< 		    (char *)QW_ALLOC(sizeof(struct initblock)) + addoff;
---
> 		initblock = (struct initblock*)
> 		    (QW_ALLOC(sizeof(struct initblock)) + addoff);
179c179,180
< 		(int)rdesc = QW_ALLOC(sizeof(struct buffdesc) * NRBUF) + addoff;
---
> 		rdesc = (struct buffdesc*)
> 			(QW_ALLOC(sizeof(struct buffdesc) * NRBUF) + addoff);
183c184,185
< 		(int)tdesc = QW_ALLOC(sizeof(struct buffdesc) * NTBUF) + addoff;
---
> 		tdesc = (struct buffdesc*)
> 			(QW_ALLOC(sizeof(struct buffdesc) * NTBUF) + addoff);
Index: arch/vax/boot/boot/mfm.c
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/boot/boot/mfm.c,v
retrieving revision 1.6
diff -r1.6 mfm.c
536c536
< 		(char *)buf += *rsize;
---
> 		buf = (void*)((char *)buf + *rsize);
622c622
< 		(char *)buf += *rsize;
---
> 		buf = (void*)((char *)buf + *rsize);
Index: arch/vax/boot/boot/ra.c
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/boot/boot/ra.c,v
retrieving revision 1.14
diff -r1.14 ra.c
114,115c114,115
< 			(char *)ubauda = (char *)0x3dc00 +
< 			    (((u_int)(&uda))&0x1ff);
---
> 			ubauda = (struct uda*)((uintptr_t)0x3dc00 +
> 				(((uintptr_t)(&uda))&0x1ff));
Index: arch/vax/boot/xxboot/bootxx.c
===================================================================
RCS file: /cvsroot/src/sys/arch/vax/boot/xxboot/bootxx.c,v
retrieving revision 1.24
diff -r1.24 bootxx.c
301c301
< 			(char *)buf += 512;
---
> 			buf = (char *)buf + 512;


-- 
Kirk Russell            <kirk@ba23.org>            http://www.ba23.org/
Bridlewood Software Testers Guild                  Ottawa Ontario Canada