Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 'oldlwp' is never NULL now, so remove the N...



details:   https://anonhg.NetBSD.org/src/rev/03113dbdae8b
branches:  trunk
changeset: 744377:03113dbdae8b
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Jan 31 08:55:38 2020 +0000

description:
'oldlwp' is never NULL now, so remove the NULL checks.

diffstat:

 sys/arch/x86/x86/dbregs.c  |  9 +++------
 sys/arch/x86/x86/fpu.c     |  6 +++---
 sys/arch/x86/x86/spectre.c |  7 +++----
 sys/arch/x86/x86/svs.c     |  6 +++---
 4 files changed, 12 insertions(+), 16 deletions(-)

diffs (107 lines):

diff -r 67fd73330bf1 -r 03113dbdae8b sys/arch/x86/x86/dbregs.c
--- a/sys/arch/x86/x86/dbregs.c Fri Jan 31 08:26:10 2020 +0000
+++ b/sys/arch/x86/x86/dbregs.c Fri Jan 31 08:55:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dbregs.c,v 1.14 2019/01/14 18:54:07 maxv Exp $ */
+/*     $NetBSD: dbregs.c,v 1.15 2020/01/31 08:55:38 maxv Exp $ */
 
 /*
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -297,13 +297,10 @@
        struct pcb *oldpcb, *newpcb;
        bool olddb, newdb;
 
-       oldpcb = (oldlwp != NULL) ? lwp_getpcb(oldlwp) : NULL;
+       oldpcb = lwp_getpcb(oldlwp);
        newpcb = lwp_getpcb(newlwp);
 
-       olddb = false;
-       if (oldpcb) {
-               olddb = (oldpcb->pcb_flags & PCB_DBREGS) != 0;
-       }
+       olddb = (oldpcb->pcb_flags & PCB_DBREGS) != 0;
        newdb = (newpcb->pcb_flags & PCB_DBREGS) != 0;
 
        if (__predict_true(!olddb && !newdb)) {
diff -r 67fd73330bf1 -r 03113dbdae8b sys/arch/x86/x86/fpu.c
--- a/sys/arch/x86/x86/fpu.c    Fri Jan 31 08:26:10 2020 +0000
+++ b/sys/arch/x86/x86/fpu.c    Fri Jan 31 08:55:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu.c,v 1.60 2019/11/27 06:24:33 maxv Exp $    */
+/*     $NetBSD: fpu.c,v 1.61 2020/01/31 08:55:38 maxv Exp $    */
 
 /*
  * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.  All
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.60 2019/11/27 06:24:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.61 2020/01/31 08:55:38 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -301,7 +301,7 @@
 {
        struct pcb *pcb;
 
-       if ((oldlwp != NULL) && (oldlwp->l_md.md_flags & MDL_FPU_IN_CPU)) {
+       if (oldlwp->l_md.md_flags & MDL_FPU_IN_CPU) {
                KASSERT(!(oldlwp->l_flag & LW_SYSTEM));
                pcb = lwp_getpcb(oldlwp);
                fpu_area_save(&pcb->pcb_savefpu, x86_xsave_features);
diff -r 67fd73330bf1 -r 03113dbdae8b sys/arch/x86/x86/spectre.c
--- a/sys/arch/x86/x86/spectre.c        Fri Jan 31 08:26:10 2020 +0000
+++ b/sys/arch/x86/x86/spectre.c        Fri Jan 31 08:55:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: spectre.c,v 1.32 2019/12/12 16:49:20 maxv Exp $        */
+/*     $NetBSD: spectre.c,v 1.33 2020/01/31 08:55:38 maxv Exp $        */
 
 /*
  * Copyright (c) 2018-2019 NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.32 2019/12/12 16:49:20 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.33 2020/01/31 08:55:38 maxv Exp $");
 
 #include "opt_spectre.h"
 
@@ -966,8 +966,7 @@
        /*
         * From kernel thread to kernel thread, no need for a barrier.
         */
-       if ((oldlwp != NULL && (oldlwp->l_flag & LW_SYSTEM)) &&
-           (newlwp->l_flag & LW_SYSTEM))
+       if ((oldlwp->l_flag & LW_SYSTEM) && (newlwp->l_flag & LW_SYSTEM))
                return;
 
        switch (v2_mitigation_method) {
diff -r 67fd73330bf1 -r 03113dbdae8b sys/arch/x86/x86/svs.c
--- a/sys/arch/x86/x86/svs.c    Fri Jan 31 08:26:10 2020 +0000
+++ b/sys/arch/x86/x86/svs.c    Fri Jan 31 08:55:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svs.c,v 1.31 2019/12/08 20:42:48 ad Exp $      */
+/*     $NetBSD: svs.c,v 1.32 2020/01/31 08:55:38 maxv Exp $    */
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.31 2019/12/08 20:42:48 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.32 2020/01/31 08:55:38 maxv Exp $");
 
 #include "opt_svs.h"
 #include "opt_user_ldt.h"
@@ -540,7 +540,7 @@
        }
 
 #ifdef DIAGNOSTIC
-       if (oldlwp != NULL && !(oldlwp->l_flag & LW_SYSTEM)) {
+       if (!(oldlwp->l_flag & LW_SYSTEM)) {
                pcb = lwp_getpcb(oldlwp);
                rsp0 = pcb->pcb_rsp0;
                va = rounddown(rsp0, PAGE_SIZE);



Home | Main Index | Thread Index | Old Index