'oldlwp' is never NULL now, so remove the NULL checks.diff -r1.14 -r1.15 src/sys/arch/x86/x86/dbregs.c
(maxv)
--- src/sys/arch/x86/x86/dbregs.c 2019/01/14 18:54:07 1.14
+++ src/sys/arch/x86/x86/dbregs.c 2020/01/31 08:55:38 1.15
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: dbregs.c,v 1.14 2019/01/14 18:54:07 maxv Exp $ */ | 1 | /* $NetBSD: dbregs.c,v 1.15 2020/01/31 08:55:38 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2016 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2016 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -287,33 +287,30 @@ x86_dbregs_write(struct lwp *l, const st | @@ -287,33 +287,30 @@ x86_dbregs_write(struct lwp *l, const st | |||
287 | memcpy(pcb->pcb_dbregs, regs, sizeof(*regs)); | 287 | memcpy(pcb->pcb_dbregs, regs, sizeof(*regs)); | |
288 | pcb->pcb_flags |= PCB_DBREGS; | 288 | pcb->pcb_flags |= PCB_DBREGS; | |
289 | } | 289 | } | |
290 | 290 | |||
291 | /* | 291 | /* | |
292 | * Called with preemption disabled. | 292 | * Called with preemption disabled. | |
293 | */ | 293 | */ | |
294 | void | 294 | void | |
295 | x86_dbregs_switch(struct lwp *oldlwp, struct lwp *newlwp) | 295 | x86_dbregs_switch(struct lwp *oldlwp, struct lwp *newlwp) | |
296 | { | 296 | { | |
297 | struct pcb *oldpcb, *newpcb; | 297 | struct pcb *oldpcb, *newpcb; | |
298 | bool olddb, newdb; | 298 | bool olddb, newdb; | |
299 | 299 | |||
300 | oldpcb = (oldlwp != NULL) ? lwp_getpcb(oldlwp) : NULL; | 300 | oldpcb = lwp_getpcb(oldlwp); | |
301 | newpcb = lwp_getpcb(newlwp); | 301 | newpcb = lwp_getpcb(newlwp); | |
302 | 302 | |||
303 | olddb = false; | 303 | olddb = (oldpcb->pcb_flags & PCB_DBREGS) != 0; | |
304 | if (oldpcb) { | |||
305 | olddb = (oldpcb->pcb_flags & PCB_DBREGS) != 0; | |||
306 | } | |||
307 | newdb = (newpcb->pcb_flags & PCB_DBREGS) != 0; | 304 | newdb = (newpcb->pcb_flags & PCB_DBREGS) != 0; | |
308 | 305 | |||
309 | if (__predict_true(!olddb && !newdb)) { | 306 | if (__predict_true(!olddb && !newdb)) { | |
310 | /* fast path */ | 307 | /* fast path */ | |
311 | return; | 308 | return; | |
312 | } | 309 | } | |
313 | 310 | |||
314 | if (olddb) { | 311 | if (olddb) { | |
315 | x86_dbregs_save(oldlwp); | 312 | x86_dbregs_save(oldlwp); | |
316 | } | 313 | } | |
317 | if (newdb) { | 314 | if (newdb) { | |
318 | x86_dbregs_restore(newlwp); | 315 | x86_dbregs_restore(newlwp); | |
319 | } else if (olddb) { | 316 | } else if (olddb) { |
--- src/sys/arch/x86/x86/fpu.c 2019/11/27 06:24:33 1.60
+++ src/sys/arch/x86/x86/fpu.c 2020/01/31 08:55:38 1.61
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: fpu.c,v 1.60 2019/11/27 06:24:33 maxv Exp $ */ | 1 | /* $NetBSD: fpu.c,v 1.61 2020/01/31 08:55:38 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc. All | 4 | * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc. All | |
5 | * rights reserved. | 5 | * rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software developed for The NetBSD Foundation | 7 | * This code is derived from software developed for The NetBSD Foundation | |
8 | * by Andrew Doran and Maxime Villard. | 8 | * by Andrew Doran and Maxime Villard. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -86,27 +86,27 @@ | @@ -86,27 +86,27 @@ | |||
86 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 86 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
87 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 87 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
88 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 88 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
89 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 89 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
90 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 90 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
91 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 91 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
92 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 92 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
93 | * SUCH DAMAGE. | 93 | * SUCH DAMAGE. | |
94 | * | 94 | * | |
95 | * @(#)npx.c 7.2 (Berkeley) 5/12/91 | 95 | * @(#)npx.c 7.2 (Berkeley) 5/12/91 | |
96 | */ | 96 | */ | |
97 | 97 | |||
98 | #include <sys/cdefs.h> | 98 | #include <sys/cdefs.h> | |
99 | __KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.60 2019/11/27 06:24:33 maxv Exp $"); | 99 | __KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.61 2020/01/31 08:55:38 maxv Exp $"); | |
100 | 100 | |||
101 | #include "opt_multiprocessor.h" | 101 | #include "opt_multiprocessor.h" | |
102 | 102 | |||
103 | #include <sys/param.h> | 103 | #include <sys/param.h> | |
104 | #include <sys/systm.h> | 104 | #include <sys/systm.h> | |
105 | #include <sys/conf.h> | 105 | #include <sys/conf.h> | |
106 | #include <sys/cpu.h> | 106 | #include <sys/cpu.h> | |
107 | #include <sys/file.h> | 107 | #include <sys/file.h> | |
108 | #include <sys/proc.h> | 108 | #include <sys/proc.h> | |
109 | #include <sys/kernel.h> | 109 | #include <sys/kernel.h> | |
110 | #include <sys/sysctl.h> | 110 | #include <sys/sysctl.h> | |
111 | #include <sys/xcall.h> | 111 | #include <sys/xcall.h> | |
112 | 112 | |||
@@ -291,27 +291,27 @@ fpu_area_restore(void *area, uint64_t xs | @@ -291,27 +291,27 @@ fpu_area_restore(void *area, uint64_t xs | |||
291 | 291 | |||
292 | void | 292 | void | |
293 | fpu_handle_deferred(void) | 293 | fpu_handle_deferred(void) | |
294 | { | 294 | { | |
295 | struct pcb *pcb = lwp_getpcb(curlwp); | 295 | struct pcb *pcb = lwp_getpcb(curlwp); | |
296 | fpu_area_restore(&pcb->pcb_savefpu, x86_xsave_features); | 296 | fpu_area_restore(&pcb->pcb_savefpu, x86_xsave_features); | |
297 | } | 297 | } | |
298 | 298 | |||
299 | void | 299 | void | |
300 | fpu_switch(struct lwp *oldlwp, struct lwp *newlwp) | 300 | fpu_switch(struct lwp *oldlwp, struct lwp *newlwp) | |
301 | { | 301 | { | |
302 | struct pcb *pcb; | 302 | struct pcb *pcb; | |
303 | 303 | |||
304 | if ((oldlwp != NULL) && (oldlwp->l_md.md_flags & MDL_FPU_IN_CPU)) { | 304 | if (oldlwp->l_md.md_flags & MDL_FPU_IN_CPU) { | |
305 | KASSERT(!(oldlwp->l_flag & LW_SYSTEM)); | 305 | KASSERT(!(oldlwp->l_flag & LW_SYSTEM)); | |
306 | pcb = lwp_getpcb(oldlwp); | 306 | pcb = lwp_getpcb(oldlwp); | |
307 | fpu_area_save(&pcb->pcb_savefpu, x86_xsave_features); | 307 | fpu_area_save(&pcb->pcb_savefpu, x86_xsave_features); | |
308 | oldlwp->l_md.md_flags &= ~MDL_FPU_IN_CPU; | 308 | oldlwp->l_md.md_flags &= ~MDL_FPU_IN_CPU; | |
309 | } | 309 | } | |
310 | KASSERT(!(newlwp->l_md.md_flags & MDL_FPU_IN_CPU)); | 310 | KASSERT(!(newlwp->l_md.md_flags & MDL_FPU_IN_CPU)); | |
311 | } | 311 | } | |
312 | 312 | |||
313 | void | 313 | void | |
314 | fpu_lwp_fork(struct lwp *l1, struct lwp *l2) | 314 | fpu_lwp_fork(struct lwp *l1, struct lwp *l2) | |
315 | { | 315 | { | |
316 | struct pcb *pcb2 = lwp_getpcb(l2); | 316 | struct pcb *pcb2 = lwp_getpcb(l2); | |
317 | union savefpu *fpu_save; | 317 | union savefpu *fpu_save; |
--- src/sys/arch/x86/x86/spectre.c 2019/12/12 16:49:20 1.32
+++ src/sys/arch/x86/x86/spectre.c 2020/01/31 08:55:38 1.33
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: spectre.c,v 1.32 2019/12/12 16:49:20 maxv Exp $ */ | 1 | /* $NetBSD: spectre.c,v 1.33 2020/01/31 08:55:38 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2018-2019 NetBSD Foundation, Inc. | 4 | * Copyright (c) 2018-2019 NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Maxime Villard. | 8 | * by Maxime Villard. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * Mitigations for the SpectreV2, SpectreV4, MDS and TAA CPU flaws. | 33 | * Mitigations for the SpectreV2, SpectreV4, MDS and TAA CPU flaws. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.32 2019/12/12 16:49:20 maxv Exp $"); | 37 | __KERNEL_RCSID(0, "$NetBSD: spectre.c,v 1.33 2020/01/31 08:55:38 maxv Exp $"); | |
38 | 38 | |||
39 | #include "opt_spectre.h" | 39 | #include "opt_spectre.h" | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | #include <sys/systm.h> | 42 | #include <sys/systm.h> | |
43 | #include <sys/cpu.h> | 43 | #include <sys/cpu.h> | |
44 | #include <sys/sysctl.h> | 44 | #include <sys/sysctl.h> | |
45 | #include <sys/xcall.h> | 45 | #include <sys/xcall.h> | |
46 | 46 | |||
47 | #include <machine/cpufunc.h> | 47 | #include <machine/cpufunc.h> | |
48 | #include <machine/cpuvar.h> | 48 | #include <machine/cpuvar.h> | |
49 | #include <machine/specialreg.h> | 49 | #include <machine/specialreg.h> | |
50 | #include <machine/frameasm.h> | 50 | #include <machine/frameasm.h> | |
@@ -956,28 +956,27 @@ void speculation_barrier(struct lwp *, s | @@ -956,28 +956,27 @@ void speculation_barrier(struct lwp *, s | |||
956 | 956 | |||
957 | void | 957 | void | |
958 | speculation_barrier(struct lwp *oldlwp, struct lwp *newlwp) | 958 | speculation_barrier(struct lwp *oldlwp, struct lwp *newlwp) | |
959 | { | 959 | { | |
960 | /* | 960 | /* | |
961 | * Speculation barriers are applicable only to Spectre V2. | 961 | * Speculation barriers are applicable only to Spectre V2. | |
962 | */ | 962 | */ | |
963 | if (!v2_mitigation_enabled) | 963 | if (!v2_mitigation_enabled) | |
964 | return; | 964 | return; | |
965 | 965 | |||
966 | /* | 966 | /* | |
967 | * From kernel thread to kernel thread, no need for a barrier. | 967 | * From kernel thread to kernel thread, no need for a barrier. | |
968 | */ | 968 | */ | |
969 | if ((oldlwp != NULL && (oldlwp->l_flag & LW_SYSTEM)) && | 969 | if ((oldlwp->l_flag & LW_SYSTEM) && (newlwp->l_flag & LW_SYSTEM)) | |
970 | (newlwp->l_flag & LW_SYSTEM)) | |||
971 | return; | 970 | return; | |
972 | 971 | |||
973 | switch (v2_mitigation_method) { | 972 | switch (v2_mitigation_method) { | |
974 | case V2_MITIGATION_INTEL_IBRS: | 973 | case V2_MITIGATION_INTEL_IBRS: | |
975 | wrmsr(MSR_IA32_PRED_CMD, IA32_PRED_CMD_IBPB); | 974 | wrmsr(MSR_IA32_PRED_CMD, IA32_PRED_CMD_IBPB); | |
976 | break; | 975 | break; | |
977 | default: | 976 | default: | |
978 | /* nothing */ | 977 | /* nothing */ | |
979 | break; | 978 | break; | |
980 | } | 979 | } | |
981 | } | 980 | } | |
982 | 981 | |||
983 | /* | 982 | /* |
--- src/sys/arch/x86/x86/svs.c 2019/12/08 20:42:48 1.31
+++ src/sys/arch/x86/x86/svs.c 2020/01/31 08:55:38 1.32
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: svs.c,v 1.31 2019/12/08 20:42:48 ad Exp $ */ | 1 | /* $NetBSD: svs.c,v 1.32 2020/01/31 08:55:38 maxv Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2018-2019 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2018-2019 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Maxime Villard. | 8 | * by Maxime Villard. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.31 2019/12/08 20:42:48 ad Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.32 2020/01/31 08:55:38 maxv Exp $"); | |
34 | 34 | |||
35 | #include "opt_svs.h" | 35 | #include "opt_svs.h" | |
36 | #include "opt_user_ldt.h" | 36 | #include "opt_user_ldt.h" | |
37 | 37 | |||
38 | #include <sys/param.h> | 38 | #include <sys/param.h> | |
39 | #include <sys/systm.h> | 39 | #include <sys/systm.h> | |
40 | #include <sys/proc.h> | 40 | #include <sys/proc.h> | |
41 | #include <sys/cpu.h> | 41 | #include <sys/cpu.h> | |
42 | #include <sys/kauth.h> | 42 | #include <sys/kauth.h> | |
43 | #include <sys/sysctl.h> | 43 | #include <sys/sysctl.h> | |
44 | #include <sys/xcall.h> | 44 | #include <sys/xcall.h> | |
45 | #include <sys/reboot.h> | 45 | #include <sys/reboot.h> | |
46 | 46 | |||
@@ -530,27 +530,27 @@ svs_lwp_switch(struct lwp *oldlwp, struc | @@ -530,27 +530,27 @@ svs_lwp_switch(struct lwp *oldlwp, struc | |||
530 | { | 530 | { | |
531 | struct cpu_info *ci = curcpu(); | 531 | struct cpu_info *ci = curcpu(); | |
532 | struct svs_utls *utls; | 532 | struct svs_utls *utls; | |
533 | struct pcb *pcb; | 533 | struct pcb *pcb; | |
534 | pt_entry_t *pte; | 534 | pt_entry_t *pte; | |
535 | uintptr_t rsp0; | 535 | uintptr_t rsp0; | |
536 | vaddr_t va; | 536 | vaddr_t va; | |
537 | 537 | |||
538 | if (newlwp->l_flag & LW_SYSTEM) { | 538 | if (newlwp->l_flag & LW_SYSTEM) { | |
539 | return; | 539 | return; | |
540 | } | 540 | } | |
541 | 541 | |||
542 | #ifdef DIAGNOSTIC | 542 | #ifdef DIAGNOSTIC | |
543 | if (oldlwp != NULL && !(oldlwp->l_flag & LW_SYSTEM)) { | 543 | if (!(oldlwp->l_flag & LW_SYSTEM)) { | |
544 | pcb = lwp_getpcb(oldlwp); | 544 | pcb = lwp_getpcb(oldlwp); | |
545 | rsp0 = pcb->pcb_rsp0; | 545 | rsp0 = pcb->pcb_rsp0; | |
546 | va = rounddown(rsp0, PAGE_SIZE); | 546 | va = rounddown(rsp0, PAGE_SIZE); | |
547 | KASSERT(ci->ci_svs_krsp0 == rsp0 - sizeof(struct trapframe)); | 547 | KASSERT(ci->ci_svs_krsp0 == rsp0 - sizeof(struct trapframe)); | |
548 | pte = ci->ci_svs_rsp0_pte; | 548 | pte = ci->ci_svs_rsp0_pte; | |
549 | KASSERT(*pte == L1_BASE[pl1_i(va)]); | 549 | KASSERT(*pte == L1_BASE[pl1_i(va)]); | |
550 | } | 550 | } | |
551 | #endif | 551 | #endif | |
552 | 552 | |||
553 | pcb = lwp_getpcb(newlwp); | 553 | pcb = lwp_getpcb(newlwp); | |
554 | rsp0 = pcb->pcb_rsp0; | 554 | rsp0 = pcb->pcb_rsp0; | |
555 | va = rounddown(rsp0, PAGE_SIZE); | 555 | va = rounddown(rsp0, PAGE_SIZE); | |
556 | 556 |