Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amd64/amd64 Use KASSERTs supported by CTASSERTs, no...



details:   https://anonhg.NetBSD.org/src/rev/c331af965153
branches:  trunk
changeset: 813730:c331af965153
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Feb 15 20:35:59 2016 +0000

description:
Use KASSERTs supported by CTASSERTs, not __builtin_unreachable.

pcc has no __builtin_unreachable, and this is clearer anyway.

diffstat:

 sys/arch/amd64/amd64/machdep.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 9b94bbf4b6a8 -r c331af965153 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Mon Feb 15 20:33:18 2016 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Mon Feb 15 20:35:59 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.214 2015/11/22 13:41:24 maxv Exp $       */
+/*     $NetBSD: machdep.c,v 1.215 2016/02/15 20:35:59 riastradh Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.214 2015/11/22 13:41:24 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.215 2016/02/15 20:35:59 riastradh Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -2073,9 +2073,11 @@
                if (off > (len - 8))
                        return EINVAL;
        } else {
-               if (seg != GUDATA_SEL || seg != GUDATA32_SEL)
-                       return EINVAL;
-               __builtin_unreachable();
+               CTASSERT(GUDATA_SEL & SEL_LDT);
+               KASSERT(seg != GUDATA_SEL);
+               CTASSERT(GUDATA32_SEL & SEL_LDT);
+               KASSERT(seg != GUDATA32_SEL);
+               return EINVAL;
        }
 
        sdp = (struct mem_segment_descriptor *)(dt + off);



Home | Main Index | Thread Index | Old Index