Mon Apr 17 06:48:07 2023 UTC ()
Trailing whitespace


(skrll)
diff -r1.39 -r1.40 src/sys/arch/powerpc/booke/trap.c

cvs diff -r1.39 -r1.40 src/sys/arch/powerpc/booke/trap.c (expand / switch to unified diff)

--- src/sys/arch/powerpc/booke/trap.c 2022/10/26 07:35:20 1.39
+++ src/sys/arch/powerpc/booke/trap.c 2023/04/17 06:48:07 1.40
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: trap.c,v 1.39 2022/10/26 07:35:20 skrll Exp $ */ 1/* $NetBSD: trap.c,v 1.40 2023/04/17 06:48:07 skrll Exp $ */
2/*- 2/*-
3 * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. 3 * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Raytheon BBN Technologies Corp and Defense Advanced Research Projects 7 * by Raytheon BBN Technologies Corp and Defense Advanced Research Projects
8 * Agency and which was developed by Matt Thomas of 3am Software Foundry. 8 * Agency and which was developed by Matt Thomas of 3am Software Foundry.
9 * 9 *
10 * This material is based upon work supported by the Defense Advanced Research 10 * This material is based upon work supported by the Defense Advanced Research
11 * Projects Agency and Space and Naval Warfare Systems Center, Pacific, under 11 * Projects Agency and Space and Naval Warfare Systems Center, Pacific, under
12 * Contract No. N66001-09-C-2073. 12 * Contract No. N66001-09-C-2073.
13 * Approved for Public Release, Distribution Unlimited 13 * Approved for Public Release, Distribution Unlimited
14 * 14 *
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 25 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 26 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 27 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
28 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE. 34 * POSSIBILITY OF SUCH DAMAGE.
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.39 2022/10/26 07:35:20 skrll Exp $"); 38__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.40 2023/04/17 06:48:07 skrll Exp $");
39 39
40#ifdef _KERNEL_OPT 40#ifdef _KERNEL_OPT
41#include "opt_altivec.h" 41#include "opt_altivec.h"
42#include "opt_ddb.h" 42#include "opt_ddb.h"
43#endif 43#endif
44 44
45#include <sys/param.h> 45#include <sys/param.h>
46#include <sys/cpu.h> 46#include <sys/cpu.h>
47#include <sys/kauth.h> 47#include <sys/kauth.h>
48#include <sys/lwp.h> 48#include <sys/lwp.h>
49#include <sys/proc.h> 49#include <sys/proc.h>
50#include <sys/ptrace.h> 50#include <sys/ptrace.h>
51#include <sys/ras.h> 51#include <sys/ras.h>
@@ -290,27 +290,27 @@ isi_exception(struct trapframe *tf, ksig @@ -290,27 +290,27 @@ isi_exception(struct trapframe *tf, ksig
290 290
291 UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmapexechist); 291 UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmapexechist);
292 292
293 if ((pte & PTE_UNSYNCED) == PTE_UNSYNCED) { 293 if ((pte & PTE_UNSYNCED) == PTE_UNSYNCED) {
294 const paddr_t pa = pte_to_paddr(pte); 294 const paddr_t pa = pte_to_paddr(pte);
295 struct vm_page * const pg = PHYS_TO_VM_PAGE(pa); 295 struct vm_page * const pg = PHYS_TO_VM_PAGE(pa);
296 KASSERT(pg); 296 KASSERT(pg);
297 struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg); 297 struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg);
298 298
299#ifdef UVMHIST 299#ifdef UVMHIST
300 if (VM_PAGEMD_EXECPAGE_P(mdpg)) 300 if (VM_PAGEMD_EXECPAGE_P(mdpg))
301 UVMHIST_LOG(pmapexechist, 301 UVMHIST_LOG(pmapexechist,
302 "srr0=%#x pg=%p (pa %#"PRIxPADDR"): " 302 "srr0=%#x pg=%p (pa %#"PRIxPADDR"): "
303 "no syncicache (already execpage)",  303 "no syncicache (already execpage)",
304 tf->tf_srr0, (uintptr_t)pg, pa, 0); 304 tf->tf_srr0, (uintptr_t)pg, pa, 0);
305 else 305 else
306 UVMHIST_LOG(pmapexechist, 306 UVMHIST_LOG(pmapexechist,
307 "srr0=%#x pg=%p (pa %#"PRIxPADDR"): " 307 "srr0=%#x pg=%p (pa %#"PRIxPADDR"): "
308 "performed syncicache (now execpage)", 308 "performed syncicache (now execpage)",
309 tf->tf_srr0, (uintptr_t)pg, pa, 0); 309 tf->tf_srr0, (uintptr_t)pg, pa, 0);
310#endif 310#endif
311 311
312 if (!VM_PAGEMD_EXECPAGE_P(mdpg)) { 312 if (!VM_PAGEMD_EXECPAGE_P(mdpg)) {
313 ci->ci_softc->cpu_ev_exec_trap_sync.ev_count++; 313 ci->ci_softc->cpu_ev_exec_trap_sync.ev_count++;
314 dcache_wb_page(pa); 314 dcache_wb_page(pa);
315 icache_inv_page(pa); 315 icache_inv_page(pa);
316 pmap_page_set_attributes(mdpg, VM_PAGEMD_EXECPAGE); 316 pmap_page_set_attributes(mdpg, VM_PAGEMD_EXECPAGE);
@@ -449,27 +449,27 @@ emulate_opcode(struct trapframe *tf, ksi @@ -449,27 +449,27 @@ emulate_opcode(struct trapframe *tf, ksi
449} 449}
450 450
451static int 451static int
452pgm_exception(struct trapframe *tf, ksiginfo_t *ksi) 452pgm_exception(struct trapframe *tf, ksiginfo_t *ksi)
453{ 453{
454 struct cpu_info * const ci = curcpu(); 454 struct cpu_info * const ci = curcpu();
455 int rv = EPERM; 455 int rv = EPERM;
456 456
457 if (!usertrap_p(tf)) 457 if (!usertrap_p(tf))
458 return rv; 458 return rv;
459 459
460 UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmapexechist); 460 UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmapexechist);
461 461
462 UVMHIST_LOG(pmapexechist, " srr0/1=%#x/%#x esr=%#x pte=%#x",  462 UVMHIST_LOG(pmapexechist, " srr0/1=%#x/%#x esr=%#x pte=%#x",
463 tf->tf_srr0, tf->tf_srr1, tf->tf_esr, 463 tf->tf_srr0, tf->tf_srr1, tf->tf_esr,
464 *trap_pte_lookup(tf, trunc_page(tf->tf_srr0), PSL_IS)); 464 *trap_pte_lookup(tf, trunc_page(tf->tf_srr0), PSL_IS));
465 465
466 ci->ci_ev_pgm.ev_count++; 466 ci->ci_ev_pgm.ev_count++;
467 467
468 KSI_INIT_TRAP(ksi); 468 KSI_INIT_TRAP(ksi);
469 469
470 if (tf->tf_esr & ESR_PTR) { 470 if (tf->tf_esr & ESR_PTR) {
471 struct lwp * const l = curlwp; 471 struct lwp * const l = curlwp;
472 struct proc * const p = curlwp->l_proc; 472 struct proc * const p = curlwp->l_proc;
473 vaddr_t va = (vaddr_t)tf->tf_srr0; 473 vaddr_t va = (vaddr_t)tf->tf_srr0;
474 int error; 474 int error;
475 475