Subject: small db_machdep.h tweak
To: None <tech-kern@netbsd.org>
From: Krister Walfridsson <cato@df.lth.se>
List: tech-kern
Date: 03/22/2003 02:11:05
I'm linting tke kernels, and noted that all ports have bogus PC_REGS()
macros (since ít is used as a lvalue.) The cast is not neccessary,
so I'd like to remove it (as in the patches below, but for all ports).

I plan to test this by compiling the kernels with/without my changes, and
verify that the generated code is identical. (i.e. I will not change
ports that I cannot cross-build from i386.  Or should I play fast and
lose, and make all these files consistent?)

Comments?

   /Krister


Index: m68k/include/db_machdep.h
===================================================================
RCS file: /cvsroot/src/sys/arch/m68k/include/db_machdep.h,v
retrieving revision 1.22
diff -u -r1.22 db_machdep.h
--- m68k/include/db_machdep.h	2000/06/26 14:59:01	1.22
+++ m68k/include/db_machdep.h	2003/03/22 00:40:10
@@ -51,7 +51,7 @@
 extern db_regs_t	ddb_regs;	/* register state */
 #define DDB_REGS	(&ddb_regs)

-#define	PC_REGS(regs)	((db_addr_t)(regs)->tf_pc)
+#define	PC_REGS(regs)	((regs)->tf_pc)

 #define	BKPT_INST	0x4e4f		/* breakpoint instruction */
 #define	BKPT_SIZE	(2)		/* size of breakpoint inst */
Index: i386/include/db_machdep.h
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/include/db_machdep.h,v
retrieving revision 1.19
diff -u -r1.19 db_machdep.h
--- i386/include/db_machdep.h	2002/10/01 12:57:05	1.19
+++ i386/include/db_machdep.h	2003/03/22 00:40:10
@@ -50,11 +50,7 @@
 #define ddb_regs	(*ddb_regp)
 #endif

-#if defined(lint)
 #define	PC_REGS(regs)	((regs)->tf_eip)
-#else
-#define	PC_REGS(regs)	((db_addr_t)(regs)->tf_eip)
-#endif

 #define	BKPT_INST	0xcc		/* breakpoint instruction */
 #define	BKPT_SIZE	(1)		/* size of breakpoint inst */