Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Add CTASSERT to verify __HAVE_CPU_DATA_FIRST is cor...



details:   https://anonhg.NetBSD.org/src/rev/fdaff50045d6
branches:  trunk
changeset: 759961:fdaff50045d6
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Dec 22 02:43:23 2010 +0000

description:
Add CTASSERT to verify __HAVE_CPU_DATA_FIRST is correct defined or undefined.

diffstat:

 sys/kern/kern_cpu.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r e150e75f7885 -r fdaff50045d6 sys/kern/kern_cpu.c
--- a/sys/kern/kern_cpu.c       Wed Dec 22 02:42:27 2010 +0000
+++ b/sys/kern/kern_cpu.c       Wed Dec 22 02:43:23 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_cpu.c,v 1.44 2010/04/25 15:57:59 ad Exp $ */
+/*     $NetBSD: kern_cpu.c,v 1.45 2010/12/22 02:43:23 matt Exp $       */
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.44 2010/04/25 15:57:59 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_cpu.c,v 1.45 2010/12/22 02:43:23 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -79,6 +79,17 @@
 
 #include <uvm/uvm_extern.h>
 
+/*
+ * If the port has state that cpu_data is the first thing in cpu_info,
+ * verify the claim is true.  This will prevent the from getting out
+ * of sync.
+ */
+#ifdef __HAVE_CPU_DATA_FIRST
+CTASSERT(offsetof(struct cpu_info, ci_data) == 0);
+#else
+CTASSERT(offsetof(struct cpu_info, ci_data) != 0);
+#endif
+
 void   cpuctlattach(int);
 
 static void    cpu_xc_online(struct cpu_info *);



Home | Main Index | Thread Index | Old Index