CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: andvar Date: Thu Feb 1 22:02:18 UTC 2024 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: s/againt/against/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.110 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.109 src/sys/arch/powerpc/ibm4xx/pmap.c:1.110 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.109 Wed Oct 5 09:03:06 2022 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Thu Feb 1 22:02:18 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.109 2022/10/05 09:03:06 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.110 2024/02/01 22:02:18 andvar Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.109 2022/10/05 09:03:06 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.110 2024/02/01 22:02:18 andvar Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1207,7 +1207,7 @@ pmap_procwr(struct proc *p, vaddr_t va, /* * For p != curproc, we cannot rely upon TLB miss handler in - * user context. Therefore, extract pa and operate againt it. + * user context. Therefore, extract pa and operate against it. * * Note that va below VM_MIN_KERNEL_ADDRESS is reserved for * direct mapping.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: andvar Date: Thu Feb 1 22:02:18 UTC 2024 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: s/againt/against/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.110 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Oct 5 09:03:06 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: ppc4xx_tlb_enter: One more style sync. No binary changes. Use hi and lo instead of th and tl for TLBHI and TLBLO, respectively, as done for other functions in pmap.c. To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Oct 5 09:03:06 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: ppc4xx_tlb_enter: One more style sync. No binary changes. Use hi and lo instead of th and tl for TLBHI and TLBLO, respectively, as done for other functions in pmap.c. To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.108 src/sys/arch/powerpc/ibm4xx/pmap.c:1.109 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.108 Wed Oct 5 08:47:52 2022 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Wed Oct 5 09:03:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.108 2022/10/05 08:47:52 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.109 2022/10/05 09:03:06 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.108 2022/10/05 08:47:52 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.109 2022/10/05 09:03:06 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1347,7 +1347,7 @@ ppc4xx_tlb_find_victim(void) void ppc4xx_tlb_enter(int ctx, vaddr_t va, u_int pte) { - u_long th, tl, i; + u_long hi, lo, i; paddr_t pa; int msr, pid, sz; @@ -1355,9 +1355,9 @@ ppc4xx_tlb_enter(int ctx, vaddr_t va, u_ sz = (pte & TTE_SZ_MASK) >> TTE_SZ_SHIFT; pa = (pte & TTE_RPN_MASK(sz)); - th = (va & TLB_EPN_MASK) | (sz << TLB_SIZE_SHFT) | TLB_VALID; - tl = (pte & ~TLB_RPN_MASK) | pa; - tl |= ppc4xx_tlbflags(va, pa); + hi = (va & TLB_EPN_MASK) | (sz << TLB_SIZE_SHFT) | TLB_VALID; + lo = (pte & ~TLB_RPN_MASK) | pa; + lo |= ppc4xx_tlbflags(va, pa); i = ppc4xx_tlb_find_victim(); @@ -1377,14 +1377,14 @@ ppc4xx_tlb_enter(int ctx, vaddr_t va, u_ MFPID(%[pid]) /* Save old PID */ MTPID(%[ctx]) /* Load translation ctx */ "isync;" - "tlbwe %[tl],%[i],1;" /* Set TLB */ - "tlbwe %[th],%[i],0;" + "tlbwe %[lo],%[i],1;" /* Set TLB */ + "tlbwe %[hi],%[i],0;" "isync;" MTPID(%[pid]) /* Restore PID */ "mtmsr %[msr];" /* and MSR */ "isync;" : [msr] "=" (msr), [pid] "=" (pid) - : [ctx] "r" (ctx), [i] "r" (i), [tl] "r" (tl), [th] "r" (th)); + : [ctx] "r" (ctx), [i] "r" (i), [lo] "r" (lo), [hi] "r" (hi)); } void
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Oct 5 08:47:52 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: Use %[foo], %[bar], ... instead of %0, %1, ... for asm codes. Unify variable names if possible. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.107 src/sys/arch/powerpc/ibm4xx/pmap.c:1.108 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.107 Wed Oct 5 08:18:00 2022 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Wed Oct 5 08:47:52 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.107 2022/10/05 08:18:00 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.108 2022/10/05 08:47:52 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.107 2022/10/05 08:18:00 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.108 2022/10/05 08:47:52 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1160,7 +1160,7 @@ pmap_procwr(struct proc *p, vaddr_t va, struct pmap *pm = p->p_vmspace->vm_map.pmap; if (__predict_true(p == curproc)) { - int msr, ctx, opid; + int msr, ctx, pid; /* * Take it easy! TLB miss handler takes care of us. @@ -1178,27 +1178,28 @@ pmap_procwr(struct proc *p, vaddr_t va, } __asm volatile ( - "mfmsr %0;" - "li %1,0x20;" /* Turn off IMMU */ - "andc %1,%0,%1;" - "ori %1,%1,0x10;" /* Turn on DMMU for sure */ - "mtmsr %1;" + "mfmsr %[msr];" + "li %[pid],0x20;" /* Turn off IMMU */ + "andc %[pid],%[msr],%[pid];" + "ori %[pid],%[pid],0x10;" /* Turn on DMMU for sure */ + "mtmsr %[pid];" "isync;" - MFPID(%1) - MTPID(%2) + MFPID(%[pid]) + MTPID(%[ctx]) "isync;" "1:" - "dcbst 0,%3;" - "icbi 0,%3;" - "add %3,%3,%5;" - "sub. %4,%4,%5;" + "dcbst 0,%[va];" + "icbi 0,%[va];" + "add %[va],%[va],%[size];" + "sub. %[len],%[len],%[size];" "bge 1b;" "sync;" - MTPID(%1) - "mtmsr %0;" + MTPID(%[pid]) + "mtmsr %[msr];" "isync;" - : "=" (msr), "=" (opid) - : "r" (ctx), "r" (va), "r" (len), "r" (CACHELINESIZE)); + : [msr] "=" (msr), [pid] "=" (pid) + : [ctx] "r" (ctx), [va] "r" (va), [len] "r" (len), + [size] "r" (CACHELINESIZE)); } else { paddr_t pa; vaddr_t tva, eva; @@ -1236,18 +1237,18 @@ tlb_invalidate_entry(int i) KASSERT(mfspr(SPR_PID) == KERNEL_PID); __asm volatile ( - "mfmsr %0;" - "li %1,0;" - "mtmsr %1;" - MFPID(%1) - "tlbre %2,%3,0;" - "andc %2,%2,%4;" - "tlbwe %2,%3,0;" - MTPID(%1) - "mtmsr %0;" + "mfmsr %[msr];" + "li %[pid],0;" + "mtmsr %[pid];" + MFPID(%[pid]) + "tlbre %[hi],%[i],0;" + "andc %[hi],%[hi],%[valid];" + "tlbwe %[hi],%[i],0;" + MTPID(%[pid]) + "mtmsr %[msr];" "isync;" - : "=" (msr), "=" (pid), "=" (hi) - : "r" (i), "r" (TLB_VALID)); + : [msr] "=" (msr), [pid] "=" (pid), [hi] "=" (hi) + : [i] "r" (i), [valid] "r" (TLB_VALID)); #else /* * Just clear entire TLBHI register. @@ -1273,24 +1274,24 @@ ppc4xx_tlb_flush(vaddr_t va, int pid) return; __asm volatile ( - MFPID(%1) /* Save PID */ - "mfmsr %2;" /* Save MSR */ - "li %0,0;" /* Now clear MSR */ - "mtmsr %0;" + MFPID(%[found]) /* Save PID */ + "mfmsr %[msr];" /* Save MSR */ + "li %[i],0;" /* Now clear MSR */ + "mtmsr %[i];" "isync;" - MTPID(%4) /* Set PID */ + MTPID(%[pid]) /* Set PID */ "isync;" - "tlbsx. %0,0,%3;" /* Search TLB */ + "tlbsx. %[i],0,%[va];" /* Search TLB */ "isync;" - MTPID(%1) /* Restore PID */ - "mtmsr %2;" /* Restore MSR */ + MTPID(%[found]) /* Restore PID */ + "mtmsr %[msr];" /* Restore MSR */ "isync;" - "li %1,1;" + "li %[found],1;" "beq 1f;" - "li %1,0;" + "li %[found],0;" "1:" - : "=" (i), "=" (found), "=" (msr) - : "r" (va), "r" (pid)); + : [i] "=" (i), [found] "=" (found), [msr] "=" (msr) + : [va] "r" (va), [pid] "r" (pid)); if (found && !TLB_LOCKED(i)) { /* Now flush translation */ @@ -1346,7 +1347,7 @@ ppc4xx_tlb_find_victim(void) void ppc4xx_tlb_enter(int ctx, vaddr_t va, u_int pte) { - u_long th, tl, idx; + u_long th, tl, i; paddr_t pa; int msr, pid, sz; @@ -1358,32 +1359,32 @@ ppc4xx_tlb_enter(int ctx, vaddr_t va, u_ tl = (pte & ~TLB_RPN_MASK) | pa; tl |= ppc4xx_tlbflags(va, pa); - idx = ppc4xx_tlb_find_victim(); + i = ppc4xx_tlb_find_victim(); - KASSERTMSG(idx >= tlb_nreserved && idx < NTLB, - "invalid entry %ld", idx); + KASSERTMSG(i >= tlb_nreserved && i < NTLB, + "invalid entry %ld", i); - tlb_info[idx].ti_va = (va & TLB_EPN_MASK); - tlb_info[idx].ti_ctx = ctx; - tlb_info[idx].ti_flags = TLBF_USED | TLBF_REF; + tlb_info[i].ti_va = (va & TLB_EPN_MASK); + tlb_info[i].ti_ctx = ctx; + tlb_info[i].ti_flags = TLBF_USED | TLBF_REF; __asm volatile ( - "mfmsr %0;" /* Save MSR */ -
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Oct 5 08:47:52 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: Use %[foo], %[bar], ... instead of %0, %1, ... for asm codes. Unify variable names if possible. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Oct 5 08:18:00 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: clock.c copyinstr.c copyoutstr.c cpu.c ibm4xx_machdep.c pmap.c trap.c Log Message: Minor style fixes to asm codes. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/powerpc/ibm4xx/clock.c cvs rdiff -u -r1.23 -r1.24 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c cvs rdiff -u -r1.38 -r1.39 src/sys/arch/powerpc/ibm4xx/cpu.c cvs rdiff -u -r1.37 -r1.38 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c cvs rdiff -u -r1.106 -r1.107 src/sys/arch/powerpc/ibm4xx/pmap.c cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/clock.c diff -u src/sys/arch/powerpc/ibm4xx/clock.c:1.32 src/sys/arch/powerpc/ibm4xx/clock.c:1.33 --- src/sys/arch/powerpc/ibm4xx/clock.c:1.32 Fri Mar 5 06:06:34 2021 +++ src/sys/arch/powerpc/ibm4xx/clock.c Wed Oct 5 08:18:00 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.32 2021/03/05 06:06:34 rin Exp $ */ +/* $NetBSD: clock.c,v 1.33 2022/10/05 08:18:00 rin Exp $ */ /* $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $ */ /* @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.32 2021/03/05 06:06:34 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.33 2022/10/05 08:18:00 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ppcarch.h" @@ -218,9 +218,9 @@ get_ppc4xx_timecount(struct timecounter u_long tb; int msr; - __asm volatile ("mfmsr %0; wrteei 0" : "=r"(msr) :); + __asm volatile ("mfmsr %0; wrteei 0" : "=r" (msr)); tb = mftbl(); - __asm volatile ("mtmsr %0" :: "r"(msr)); + __asm volatile ("mtmsr %0" :: "r" (msr)); return tb; } @@ -240,23 +240,26 @@ delay(unsigned int n) tbh = tb >> 32; tbl = tb; __asm volatile ( + "1:" #ifdef PPC_IBM403 - "1: mftbhi %0 \n" + "mftbhi %0;" #else - "1: mftbu %0 \n" + "mftbu %0;" #endif - " cmplw %0,%1 \n" - " blt 1b \n" - " bgt 2f \n" + "cmplw %0,%1;" + "blt 1b;" + "bgt 2f;" #ifdef PPC_IBM403 - " mftblo %0 \n" + "mftblo %0;" #else - " mftb %0 \n" + "mftb %0;" #endif - " cmplw %0,%2 \n" - " blt 1b \n" - "2: \n" - : "="(scratch) : "r"(tbh), "r"(tbl) : "cr0"); + "cmplw %0,%2;" + "blt 1b;" + "2:" + : "=" (scratch) + : "r" (tbh), "r" (tbl) + : "cr0"); } /* Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.23 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.24 --- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.23 Wed Oct 5 02:56:14 2022 +++ src/sys/arch/powerpc/ibm4xx/copyinstr.c Wed Oct 5 08:18:00 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyinstr.c,v 1.23 2022/10/05 02:56:14 rin Exp $ */ +/* $NetBSD: copyinstr.c,v 1.24 2022/10/05 08:18:00 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.23 2022/10/05 02:56:14 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.24 2022/10/05 08:18:00 rin Exp $"); #include #include @@ -71,7 +71,7 @@ copyinstr(const void *uaddr, void *kaddr } resid = len; - __asm volatile( + __asm volatile ( "mtctr %[resid];" /* Set up counter */ "mfmsr %[msr];" /* Save MSR */ "li %[tmp],0x20;" /* Disable IMMU */ Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.23 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.24 --- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.23 Wed Oct 5 02:56:14 2022 +++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Wed Oct 5 08:18:00 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyoutstr.c,v 1.23 2022/10/05 02:56:14 rin Exp $ */ +/* $NetBSD: copyoutstr.c,v 1.24 2022/10/05 08:18:00 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.23 2022/10/05 02:56:14 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.24 2022/10/05 08:18:00 rin Exp $"); #include #include @@ -71,7 +71,7 @@ copyoutstr(const void *kaddr, void *uadd } resid = len; - __asm volatile( + __asm volatile ( "mtctr %[resid];" /* Set up counter */ "mfmsr %[msr];" /* Save MSR */ "li %[tmp],0x20;" /* Disable IMMU */ Index: src/sys/arch/powerpc/ibm4xx/cpu.c diff -u src/sys/arch/powerpc/ibm4xx/cpu.c:1.38 src/sys/arch/powerpc/ibm4xx/cpu.c:1.39 --- src/sys/arch/powerpc/ibm4xx/cpu.c:1.38 Tue Mar 30 13:41:46 2021 +++ src/sys/arch/powerpc/ibm4xx/cpu.c Wed Oct 5 08:18:00 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.38 2021/03/30 13:41:46 simonb Exp $ */ +/* $NetBSD: cpu.c,v 1.39 2022/10/05 08:18:00 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.38 2021/03/30
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Oct 5 08:18:00 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: clock.c copyinstr.c copyoutstr.c cpu.c ibm4xx_machdep.c pmap.c trap.c Log Message: Minor style fixes to asm codes. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/powerpc/ibm4xx/clock.c cvs rdiff -u -r1.23 -r1.24 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c cvs rdiff -u -r1.38 -r1.39 src/sys/arch/powerpc/ibm4xx/cpu.c cvs rdiff -u -r1.37 -r1.38 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c cvs rdiff -u -r1.106 -r1.107 src/sys/arch/powerpc/ibm4xx/pmap.c cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Oct 5 02:56:14 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: As a tiny optimization, drop redundant mtpid. No regression for ATF on 405. 403 seems to work fine. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Oct 5 02:56:14 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: As a tiny optimization, drop redundant mtpid. No regression for ATF on 405. 403 seems to work fine. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.22 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.23 --- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.22 Tue Oct 4 14:08:30 2022 +++ src/sys/arch/powerpc/ibm4xx/copyinstr.c Wed Oct 5 02:56:14 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyinstr.c,v 1.22 2022/10/04 14:08:30 rin Exp $ */ +/* $NetBSD: copyinstr.c,v 1.23 2022/10/05 02:56:14 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.22 2022/10/04 14:08:30 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.23 2022/10/05 02:56:14 rin Exp $"); #include #include @@ -94,8 +94,7 @@ copyinstr(const void *uaddr, void *kaddr "sync;" "bdnzf eq,1b;" /* while(ctr-- && !zero) */ - MTPID(%[pid]) /* Restore PID, MSR */ - "mtmsr %[msr];" + "mtmsr %[msr];" /* Restore MSR */ "isync;" "mfctr %[resid];" /* Restore resid */ Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.22 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.23 --- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.22 Tue Oct 4 14:08:30 2022 +++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Wed Oct 5 02:56:14 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyoutstr.c,v 1.22 2022/10/04 14:08:30 rin Exp $ */ +/* $NetBSD: copyoutstr.c,v 1.23 2022/10/05 02:56:14 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.22 2022/10/04 14:08:30 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.23 2022/10/05 02:56:14 rin Exp $"); #include #include @@ -80,9 +80,7 @@ copyoutstr(const void *kaddr, void *uadd "isync;" MFPID(%[pid]) /* Save old PID */ - "1:" MTPID(%[pid]) - "isync;" - "lbz %[tmp],0(%[kaddr]);" /* Load kernel byte */ + "1:" "lbz %[tmp],0(%[kaddr]);" /* Load kernel byte */ "addi %[kaddr],%[kaddr],1;" "sync;" @@ -92,10 +90,12 @@ copyoutstr(const void *kaddr, void *uadd "addi %[uaddr],%[uaddr],1;" "or. %[tmp],%[tmp],%[tmp];" "sync;" + + MTPID(%[pid]) + "isync;" "bdnzf eq,1b;" /* while(ctr-- && !zero) */ - MTPID(%[pid]) /* Restore PID, MSR */ - "mtmsr %[msr];" + "mtmsr %[msr];" /* Restore MSR */ "isync;" "mfctr %[resid];" /* Restore resid */
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Tue Oct 4 14:08:30 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: Consistently use tmp as scratch register. NFC. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.21 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.22 --- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.21 Tue Oct 4 14:02:46 2022 +++ src/sys/arch/powerpc/ibm4xx/copyinstr.c Tue Oct 4 14:08:30 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyinstr.c,v 1.21 2022/10/04 14:02:46 rin Exp $ */ +/* $NetBSD: copyinstr.c,v 1.22 2022/10/04 14:08:30 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.21 2022/10/04 14:02:46 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.22 2022/10/04 14:08:30 rin Exp $"); #include #include @@ -48,7 +48,7 @@ copyinstr(const void *uaddr, void *kaddr { struct pmap *pm = curproc->p_vmspace->vm_map.pmap; size_t resid; - int rv, msr, pid, data, ctx; + int rv, msr, pid, tmp, ctx; struct faultbuf env; if (__predict_false(len == 0)) { @@ -74,23 +74,23 @@ copyinstr(const void *uaddr, void *kaddr __asm volatile( "mtctr %[resid];" /* Set up counter */ "mfmsr %[msr];" /* Save MSR */ - "li %[pid],0x20;" /* Disable IMMU */ - "andc %[pid],%[msr],%[pid];" - "mtmsr %[pid];" + "li %[tmp],0x20;" /* Disable IMMU */ + "andc %[tmp],%[msr],%[tmp];" + "mtmsr %[tmp];" "isync;" MFPID(%[pid]) /* Save old PID */ "1:" MTPID(%[ctx]) /* Load user ctx */ "isync;" - "lbz %[data],0(%[uaddr]);" /* Load byte */ + "lbz %[tmp],0(%[uaddr]);" /* Load byte */ "addi %[uaddr],%[uaddr],1;" "sync;" MTPID(%[pid]) "isync;" - "stb %[data],0(%[kaddr]);" /* Store kernel byte */ + "stb %[tmp],0(%[kaddr]);" /* Store kernel byte */ "addi %[kaddr],%[kaddr],1;" - "or. %[data],%[data],%[data];" + "or. %[tmp],%[tmp],%[tmp];" "sync;" "bdnzf eq,1b;" /* while(ctr-- && !zero) */ @@ -99,7 +99,7 @@ copyinstr(const void *uaddr, void *kaddr "isync;" "mfctr %[resid];" /* Restore resid */ - : [msr] "=" (msr), [pid] "=" (pid), [data] "=" (data), + : [msr] "=" (msr), [pid] "=" (pid), [tmp] "=" (tmp), [resid] "+r" (resid) : [ctx] "r" (ctx), [uaddr] "b" (uaddr), [kaddr] "b" (kaddr) : "cr0", "ctr"); @@ -107,7 +107,7 @@ copyinstr(const void *uaddr, void *kaddr curpcb->pcb_onfault = NULL; if (done) *done = len - resid; - if (resid == 0 && (char)data != '\0') + if (resid == 0 && (char)tmp != '\0') return ENAMETOOLONG; else return 0; Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.21 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.22 --- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.21 Tue Oct 4 14:02:46 2022 +++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Tue Oct 4 14:08:30 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyoutstr.c,v 1.21 2022/10/04 14:02:46 rin Exp $ */ +/* $NetBSD: copyoutstr.c,v 1.22 2022/10/04 14:08:30 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.21 2022/10/04 14:02:46 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.22 2022/10/04 14:08:30 rin Exp $"); #include #include @@ -48,7 +48,7 @@ copyoutstr(const void *kaddr, void *uadd { struct pmap *pm = curproc->p_vmspace->vm_map.pmap; size_t resid; - int rv, msr, pid, data, ctx; + int rv, msr, pid, tmp, ctx; struct faultbuf env; if (__predict_false(len == 0)) { @@ -74,23 +74,23 @@ copyoutstr(const void *kaddr, void *uadd __asm volatile( "mtctr %[resid];" /* Set up counter */ "mfmsr %[msr];" /* Save MSR */ - "li %[pid],0x20;" /* Disable IMMU */ - "andc %[pid],%[msr],%[pid];" - "mtmsr %[pid];" + "li %[tmp],0x20;" /* Disable IMMU */ + "andc %[tmp],%[msr],%[tmp];" + "mtmsr %[tmp];" "isync;" MFPID(%[pid]) /* Save old PID */ "1:" MTPID(%[pid]) "isync;" - "lbz %[data],0(%[kaddr]);" /* Load kernel byte */ + "lbz %[tmp],0(%[kaddr]);" /* Load kernel byte */ "addi %[kaddr],%[kaddr],1;" "sync;" MTPID(%[ctx]) /* Load user ctx */ "isync;" - "stb %[data],0(%[uaddr]);" /* Store byte */ + "stb %[tmp],0(%[uaddr]);" /* Store byte */ "addi %[uaddr],%[uaddr],1;" - "or. %[data],%[data],%[data];" + "or. %[tmp],%[tmp],%[tmp];" "sync;" "bdnzf eq,1b;" /* while(ctr-- && !zero) */ @@ -99,7 +99,7 @@ copyoutstr(const void *kaddr, void *uadd "isync;" "mfctr %[resid];" /* Restore resid */ - : [msr] "=" (msr), [pid] "=" (pid), [data] "=" (data), + : [msr] "=" (msr), [pid] "=" (pid), [tmp]
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Tue Oct 4 14:08:30 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: Consistently use tmp as scratch register. NFC. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Tue Oct 4 14:02:46 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: "insn[TAB]operands;" for inline asm codes. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.20 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.21 --- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.20 Tue Oct 4 13:58:54 2022 +++ src/sys/arch/powerpc/ibm4xx/copyinstr.c Tue Oct 4 14:02:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyinstr.c,v 1.20 2022/10/04 13:58:54 rin Exp $ */ +/* $NetBSD: copyinstr.c,v 1.21 2022/10/04 14:02:46 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.20 2022/10/04 13:58:54 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.21 2022/10/04 14:02:46 rin Exp $"); #include #include @@ -72,32 +72,32 @@ copyinstr(const void *uaddr, void *kaddr resid = len; __asm volatile( - "mtctr %[resid];" /* Set up counter */ - "mfmsr %[msr];" /* Save MSR */ - "li %[pid],0x20;" /* Disable IMMU */ - "andc %[pid],%[msr],%[pid];" - "mtmsr %[pid];" + "mtctr %[resid];" /* Set up counter */ + "mfmsr %[msr];" /* Save MSR */ + "li %[pid],0x20;" /* Disable IMMU */ + "andc %[pid],%[msr],%[pid];" + "mtmsr %[pid];" "isync;" MFPID(%[pid]) /* Save old PID */ "1:" MTPID(%[ctx]) /* Load user ctx */ "isync;" - "lbz %[data],0(%[uaddr]);" /* Load byte */ - "addi %[uaddr],%[uaddr],1;" + "lbz %[data],0(%[uaddr]);" /* Load byte */ + "addi %[uaddr],%[uaddr],1;" "sync;" MTPID(%[pid]) "isync;" - "stb %[data],0(%[kaddr]);" /* Store kernel byte */ - "addi %[kaddr],%[kaddr],1;" - "or. %[data],%[data],%[data];" + "stb %[data],0(%[kaddr]);" /* Store kernel byte */ + "addi %[kaddr],%[kaddr],1;" + "or. %[data],%[data],%[data];" "sync;" - "bdnzf eq,1b;" /* while(ctr-- && !zero) */ + "bdnzf eq,1b;" /* while(ctr-- && !zero) */ MTPID(%[pid]) /* Restore PID, MSR */ - "mtmsr %[msr];" + "mtmsr %[msr];" "isync;" - "mfctr %[resid];" /* Restore resid */ + "mfctr %[resid];" /* Restore resid */ : [msr] "=" (msr), [pid] "=" (pid), [data] "=" (data), [resid] "+r" (resid) Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.20 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.21 --- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.20 Tue Oct 4 13:58:54 2022 +++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Tue Oct 4 14:02:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyoutstr.c,v 1.20 2022/10/04 13:58:54 rin Exp $ */ +/* $NetBSD: copyoutstr.c,v 1.21 2022/10/04 14:02:46 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.20 2022/10/04 13:58:54 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.21 2022/10/04 14:02:46 rin Exp $"); #include #include @@ -72,32 +72,32 @@ copyoutstr(const void *kaddr, void *uadd resid = len; __asm volatile( - "mtctr %[resid];" /* Set up counter */ - "mfmsr %[msr];" /* Save MSR */ - "li %[pid],0x20;" /* Disable IMMU */ - "andc %[pid],%[msr],%[pid];" - "mtmsr %[pid];" + "mtctr %[resid];" /* Set up counter */ + "mfmsr %[msr];" /* Save MSR */ + "li %[pid],0x20;" /* Disable IMMU */ + "andc %[pid],%[msr],%[pid];" + "mtmsr %[pid];" "isync;" MFPID(%[pid]) /* Save old PID */ "1:" MTPID(%[pid]) "isync;" - "lbz %[data],0(%[kaddr]);" /* Load kernel byte */ - "addi %[kaddr],%[kaddr],1;" + "lbz %[data],0(%[kaddr]);" /* Load kernel byte */ + "addi %[kaddr],%[kaddr],1;" "sync;" MTPID(%[ctx]) /* Load user ctx */ "isync;" - "stb %[data],0(%[uaddr]);" /* Store byte */ - "addi %[uaddr],%[uaddr],1;" - "or. %[data],%[data],%[data];" + "stb %[data],0(%[uaddr]);" /* Store byte */ + "addi %[uaddr],%[uaddr],1;" + "or. %[data],%[data],%[data];" "sync;" - "bdnzf eq,1b;" /* while(ctr-- && !zero) */ + "bdnzf eq,1b;" /* while(ctr-- && !zero) */ MTPID(%[pid]) /* Restore PID, MSR */ - "mtmsr %[msr];" + "mtmsr %[msr];" "isync;" - "mfctr %[resid];" /* Restore resid */ + "mfctr %[resid];" /* Restore resid */ : [msr] "=" (msr), [pid] "=" (pid), [data] "=" (data), [resid] "+r" (resid)
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Tue Oct 4 14:02:46 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: "insn[TAB]operands;" for inline asm codes. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Tue Oct 4 13:58:54 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: Style sync with copy{in,out}. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.19 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.20 --- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.19 Tue Oct 4 13:45:50 2022 +++ src/sys/arch/powerpc/ibm4xx/copyinstr.c Tue Oct 4 13:58:54 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyinstr.c,v 1.19 2022/10/04 13:45:50 rin Exp $ */ +/* $NetBSD: copyinstr.c,v 1.20 2022/10/04 13:58:54 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.19 2022/10/04 13:45:50 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.20 2022/10/04 13:58:54 rin Exp $"); #include #include @@ -73,14 +73,11 @@ copyinstr(const void *uaddr, void *kaddr resid = len; __asm volatile( "mtctr %[resid];" /* Set up counter */ - "mfmsr %[msr];" /* Save MSR */ - "li %[pid],0x20;" /* Disable IMMU */ "andc %[pid],%[msr],%[pid];" "mtmsr %[pid];" "isync;" - MFPID(%[pid]) /* Save old PID */ "1:" MTPID(%[ctx]) /* Load user ctx */ @@ -95,13 +92,11 @@ copyinstr(const void *uaddr, void *kaddr "addi %[kaddr],%[kaddr],1;" "or. %[data],%[data],%[data];" "sync;" - "bdnzf eq,1b;" /* while(ctr-- && !zero) */ MTPID(%[pid]) /* Restore PID, MSR */ "mtmsr %[msr];" "isync;" - "mfctr %[resid];" /* Restore resid */ : [msr] "=" (msr), [pid] "=" (pid), [data] "=" (data), Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.19 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.20 --- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.19 Tue Oct 4 13:45:50 2022 +++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Tue Oct 4 13:58:54 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyoutstr.c,v 1.19 2022/10/04 13:45:50 rin Exp $ */ +/* $NetBSD: copyoutstr.c,v 1.20 2022/10/04 13:58:54 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.19 2022/10/04 13:45:50 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.20 2022/10/04 13:58:54 rin Exp $"); #include #include @@ -73,29 +73,23 @@ copyoutstr(const void *kaddr, void *uadd resid = len; __asm volatile( "mtctr %[resid];" /* Set up counter */ - "mfmsr %[msr];" /* Save MSR */ - "li %[pid],0x20;" /* Disable IMMU */ "andc %[pid],%[msr],%[pid];" "mtmsr %[pid];" "isync;" - MFPID(%[pid]) /* Save old PID */ "1:" MTPID(%[pid]) "isync;" - "lbz %[data],0(%[kaddr]);" /* Load kernel byte */ "addi %[kaddr],%[kaddr],1;" "sync;" MTPID(%[ctx]) /* Load user ctx */ "isync;" - "stb %[data],0(%[uaddr]);" /* Store byte */ "addi %[uaddr],%[uaddr],1;" - "or. %[data],%[data],%[data];" "sync;" "bdnzf eq,1b;" /* while(ctr-- && !zero) */ @@ -103,7 +97,6 @@ copyoutstr(const void *kaddr, void *uadd MTPID(%[pid]) /* Restore PID, MSR */ "mtmsr %[msr];" "isync;" - "mfctr %[resid];" /* Restore resid */ : [msr] "=" (msr), [pid] "=" (pid), [data] "=" (data),
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Tue Oct 4 13:58:54 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: Style sync with copy{in,out}. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Tue Oct 4 13:45:50 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c trap.c Log Message: copy{in,out}{,str}: Drop needless dcbst. Data cache is purely physical for 40[53] with 16KB pages, and therefore no need to flush cache before context switch. This significantly improves copy{in,out} against small data; for example, bytebench on DHT becomes: -Pipe Throughput12440.0 8826.1 7.1 +Pipe Throughput12440.0 18364.8 14.8 No performance/ATF regression observed on 405. 403 boots successfully into multiuser mode, and builds some packages. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c cvs rdiff -u -r1.99 -r1.100 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Tue Oct 4 13:45:50 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c trap.c Log Message: copy{in,out}{,str}: Drop needless dcbst. Data cache is purely physical for 40[53] with 16KB pages, and therefore no need to flush cache before context switch. This significantly improves copy{in,out} against small data; for example, bytebench on DHT becomes: -Pipe Throughput12440.0 8826.1 7.1 +Pipe Throughput12440.0 18364.8 14.8 No performance/ATF regression observed on 405. 403 boots successfully into multiuser mode, and builds some packages. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c cvs rdiff -u -r1.99 -r1.100 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.18 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.19 --- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.18 Mon Oct 3 23:41:28 2022 +++ src/sys/arch/powerpc/ibm4xx/copyinstr.c Tue Oct 4 13:45:50 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyinstr.c,v 1.18 2022/10/03 23:41:28 rin Exp $ */ +/* $NetBSD: copyinstr.c,v 1.19 2022/10/04 13:45:50 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.18 2022/10/03 23:41:28 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.19 2022/10/04 13:45:50 rin Exp $"); #include #include @@ -92,7 +92,6 @@ copyinstr(const void *uaddr, void *kaddr MTPID(%[pid]) "isync;" "stb %[data],0(%[kaddr]);" /* Store kernel byte */ - "dcbst 0,%[kaddr];" "addi %[kaddr],%[kaddr],1;" "or. %[data],%[data],%[data];" "sync;" Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.18 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.19 --- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.18 Mon Oct 3 23:41:28 2022 +++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Tue Oct 4 13:45:50 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyoutstr.c,v 1.18 2022/10/03 23:41:28 rin Exp $ */ +/* $NetBSD: copyoutstr.c,v 1.19 2022/10/04 13:45:50 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.18 2022/10/03 23:41:28 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.19 2022/10/04 13:45:50 rin Exp $"); #include #include @@ -94,7 +94,6 @@ copyoutstr(const void *kaddr, void *uadd "isync;" "stb %[data],0(%[uaddr]);" /* Store byte */ - "dcbst 0,%[uaddr];" "addi %[uaddr],%[uaddr],1;" "or. %[data],%[data],%[data];" Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.99 src/sys/arch/powerpc/ibm4xx/trap.c:1.100 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.99 Mon Sep 12 08:06:36 2022 +++ src/sys/arch/powerpc/ibm4xx/trap.c Tue Oct 4 13:45:50 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.99 2022/09/12 08:06:36 rin Exp $ */ +/* $NetBSD: trap.c,v 1.100 2022/10/04 13:45:50 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.99 2022/09/12 08:06:36 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.100 2022/10/04 13:45:50 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -481,7 +481,6 @@ copyin(const void *uaddr, void *kaddr, s #else "stw %[tmp],0(%[kaddr]);" #endif - "dcbst 0,%[kaddr];" /* flush cache */ "addi %[kaddr],%[kaddr],0x4;" /* next kaddr word */ "sync;" "bdnz 1b;" /* repeat */ @@ -498,7 +497,6 @@ copyin(const void *uaddr, void *kaddr, s MTPID(%[pid]) "isync;" "stswx %[tmp],0,%[kaddr];" /* Store kernel bytes */ - "dcbst 0,%[kaddr];" /* flush cache */ "sync;" "10:" "mtmsr %[msr];" /* Restore MSR */ @@ -601,7 +599,6 @@ copyout(const void *kaddr, void *uaddr, #else "stw %[tmp],0(%[uaddr]);" #endif - "dcbst 0,%[uaddr];" /* flush cache */ "addi %[uaddr],%[uaddr],0x4;" /* next uaddr word */ "sync;" @@ -619,7 +616,6 @@ copyout(const void *kaddr, void *uaddr, MTPID(%[ctx]) "isync;" "stswx %[tmp],0,%[uaddr];" /* Store user bytes */ - "dcbst 0,%[uaddr];" /* flush cache */ "sync;" MTPID(%[pid]) /* Restore PID and MSR */
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Oct 3 23:41:28 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: Add cr0 and ctr to list of clobbered registers. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Oct 3 23:41:28 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: Add cr0 and ctr to list of clobbered registers. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.17 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.18 --- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.17 Mon Oct 3 23:35:41 2022 +++ src/sys/arch/powerpc/ibm4xx/copyinstr.c Mon Oct 3 23:41:28 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyinstr.c,v 1.17 2022/10/03 23:35:41 rin Exp $ */ +/* $NetBSD: copyinstr.c,v 1.18 2022/10/03 23:41:28 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.17 2022/10/03 23:35:41 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.18 2022/10/03 23:41:28 rin Exp $"); #include #include @@ -107,7 +107,8 @@ copyinstr(const void *uaddr, void *kaddr : [msr] "=" (msr), [pid] "=" (pid), [data] "=" (data), [resid] "+r" (resid) - : [ctx] "r" (ctx), [uaddr] "b" (uaddr), [kaddr] "b" (kaddr)); + : [ctx] "r" (ctx), [uaddr] "b" (uaddr), [kaddr] "b" (kaddr) + : "cr0", "ctr"); curpcb->pcb_onfault = NULL; if (done) Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.17 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.18 --- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.17 Mon Oct 3 23:35:41 2022 +++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Mon Oct 3 23:41:28 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyoutstr.c,v 1.17 2022/10/03 23:35:41 rin Exp $ */ +/* $NetBSD: copyoutstr.c,v 1.18 2022/10/03 23:41:28 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.17 2022/10/03 23:35:41 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.18 2022/10/03 23:41:28 rin Exp $"); #include #include @@ -109,7 +109,8 @@ copyoutstr(const void *kaddr, void *uadd : [msr] "=" (msr), [pid] "=" (pid), [data] "=" (data), [resid] "+r" (resid) - : [ctx] "r" (ctx), [uaddr] "b" (uaddr), [kaddr] "b" (kaddr)); + : [ctx] "r" (ctx), [uaddr] "b" (uaddr), [kaddr] "b" (kaddr) + : "cr0", "ctr"); curpcb->pcb_onfault = NULL; if (done)
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Oct 3 23:35:41 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: Consistently use uaddr instead of udaddr. Note that we use kaddr, not kdaddr, for kernel data address. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.16 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.17 --- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.16 Mon Oct 3 23:32:27 2022 +++ src/sys/arch/powerpc/ibm4xx/copyinstr.c Mon Oct 3 23:35:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyinstr.c,v 1.16 2022/10/03 23:32:27 rin Exp $ */ +/* $NetBSD: copyinstr.c,v 1.17 2022/10/03 23:35:41 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.16 2022/10/03 23:32:27 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.17 2022/10/03 23:35:41 rin Exp $"); #include #include @@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: copyinstr.c, #include int -copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done) +copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done) { struct pmap *pm = curproc->p_vmspace->vm_map.pmap; size_t resid; @@ -85,8 +85,8 @@ copyinstr(const void *udaddr, void *kadd "1:" MTPID(%[ctx]) /* Load user ctx */ "isync;" - "lbz %[data],0(%[udaddr]);" /* Load byte */ - "addi %[udaddr],%[udaddr],1;" + "lbz %[data],0(%[uaddr]);" /* Load byte */ + "addi %[uaddr],%[uaddr],1;" "sync;" MTPID(%[pid]) @@ -107,7 +107,7 @@ copyinstr(const void *udaddr, void *kadd : [msr] "=" (msr), [pid] "=" (pid), [data] "=" (data), [resid] "+r" (resid) - : [ctx] "r" (ctx), [udaddr] "b" (udaddr), [kaddr] "b" (kaddr)); + : [ctx] "r" (ctx), [uaddr] "b" (uaddr), [kaddr] "b" (kaddr)); curpcb->pcb_onfault = NULL; if (done) Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.16 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.17 --- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.16 Mon Oct 3 23:32:27 2022 +++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Mon Oct 3 23:35:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyoutstr.c,v 1.16 2022/10/03 23:32:27 rin Exp $ */ +/* $NetBSD: copyoutstr.c,v 1.17 2022/10/03 23:35:41 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.16 2022/10/03 23:32:27 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.17 2022/10/03 23:35:41 rin Exp $"); #include #include @@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: copyoutstr.c #include int -copyoutstr(const void *kaddr, void *udaddr, size_t len, size_t *done) +copyoutstr(const void *kaddr, void *uaddr, size_t len, size_t *done) { struct pmap *pm = curproc->p_vmspace->vm_map.pmap; size_t resid; @@ -93,9 +93,9 @@ copyoutstr(const void *kaddr, void *udad MTPID(%[ctx]) /* Load user ctx */ "isync;" - "stb %[data],0(%[udaddr]);" /* Store byte */ - "dcbst 0,%[udaddr];" - "addi %[udaddr],%[udaddr],1;" + "stb %[data],0(%[uaddr]);" /* Store byte */ + "dcbst 0,%[uaddr];" + "addi %[uaddr],%[uaddr],1;" "or. %[data],%[data],%[data];" "sync;" @@ -109,7 +109,7 @@ copyoutstr(const void *kaddr, void *udad : [msr] "=" (msr), [pid] "=" (pid), [data] "=" (data), [resid] "+r" (resid) - : [ctx] "r" (ctx), [udaddr] "b" (udaddr), [kaddr] "b" (kaddr)); + : [ctx] "r" (ctx), [uaddr] "b" (uaddr), [kaddr] "b" (kaddr)); curpcb->pcb_onfault = NULL; if (done)
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Oct 3 23:35:41 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: Consistently use uaddr instead of udaddr. Note that we use kaddr, not kdaddr, for kernel data address. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Oct 3 23:32:28 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: Tidy up inline asm's: - Use %[foo], %[bar], ... instead of %0, %1, ... - One instruction per line. - Paragraph grouped instructions. - Fix wrong comments. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/copyinstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.15 src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.16 --- src/sys/arch/powerpc/ibm4xx/copyinstr.c:1.15 Mon Sep 12 08:02:44 2022 +++ src/sys/arch/powerpc/ibm4xx/copyinstr.c Mon Oct 3 23:32:27 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyinstr.c,v 1.15 2022/09/12 08:02:44 rin Exp $ */ +/* $NetBSD: copyinstr.c,v 1.16 2022/10/03 23:32:27 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.15 2022/09/12 08:02:44 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.16 2022/10/03 23:32:27 rin Exp $"); #include #include @@ -72,32 +72,42 @@ copyinstr(const void *udaddr, void *kadd resid = len; __asm volatile( - "mtctr %3;" /* Set up counter */ - "mfmsr %0;" /* Save MSR */ - "li %1,0x20;" - "andc %1,%0,%1; mtmsr %1;" /* Disable IMMU */ + "mtctr %[resid];" /* Set up counter */ + + "mfmsr %[msr];" /* Save MSR */ + + "li %[pid],0x20;" /* Disable IMMU */ + "andc %[pid],%[msr],%[pid];" + "mtmsr %[pid];" "isync;" - MFPID(%1) /* Save old PID */ - "1: " - MTPID(%4) /* Load user ctx */ + MFPID(%[pid]) /* Save old PID */ + + "1:" MTPID(%[ctx]) /* Load user ctx */ "isync;" - "lbz %2,0(%5); addi %5,%5,1;" /* Load byte */ + "lbz %[data],0(%[udaddr]);" /* Load byte */ + "addi %[udaddr],%[udaddr],1;" "sync;" - MTPID(%1) + + MTPID(%[pid]) "isync;" - "stb %2,0(%6); dcbst 0,%6; addi %6,%6,1;" - /* Store kernel byte */ - "or. %2,%2,%2;" + "stb %[data],0(%[kaddr]);" /* Store kernel byte */ + "dcbst 0,%[kaddr];" + "addi %[kaddr],%[kaddr],1;" + "or. %[data],%[data],%[data];" "sync;" - "bdnzf 2,1b;" /* while(ctr-- && !zero) */ - MTPID(%1) /* Restore PID, MSR */ - "mtmsr %0;" + "bdnzf eq,1b;" /* while(ctr-- && !zero) */ + + MTPID(%[pid]) /* Restore PID, MSR */ + "mtmsr %[msr];" "isync;" - "mfctr %3;" /* Restore resid */ - : "=" (msr), "=" (pid), "=" (data), "+r" (resid) - : "r" (ctx), "b" (udaddr), "b" (kaddr)); + + "mfctr %[resid];" /* Restore resid */ + + : [msr] "=" (msr), [pid] "=" (pid), [data] "=" (data), + [resid] "+r" (resid) + : [ctx] "r" (ctx), [udaddr] "b" (udaddr), [kaddr] "b" (kaddr)); curpcb->pcb_onfault = NULL; if (done) Index: src/sys/arch/powerpc/ibm4xx/copyoutstr.c diff -u src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.15 src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.16 --- src/sys/arch/powerpc/ibm4xx/copyoutstr.c:1.15 Mon Sep 12 08:02:44 2022 +++ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Mon Oct 3 23:32:27 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: copyoutstr.c,v 1.15 2022/09/12 08:02:44 rin Exp $ */ +/* $NetBSD: copyoutstr.c,v 1.16 2022/10/03 23:32:27 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.15 2022/09/12 08:02:44 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.16 2022/10/03 23:32:27 rin Exp $"); #include #include @@ -72,32 +72,44 @@ copyoutstr(const void *kaddr, void *udad resid = len; __asm volatile( - "mtctr %3;" /* Set up counter */ - "mfmsr %0;" /* Save MSR */ - "li %1,0x20;" - "andc %1,%0,%1; mtmsr %1;" /* Disable IMMU */ + "mtctr %[resid];" /* Set up counter */ + + "mfmsr %[msr];" /* Save MSR */ + + "li %[pid],0x20;" /* Disable IMMU */ + "andc %[pid],%[msr],%[pid];" + "mtmsr %[pid];" "isync;" - MFPID(%1) /* Save old PID */ - "1:" - MTPID(%1) + MFPID(%[pid]) /* Save old PID */ + + "1:" MTPID(%[pid]) "isync;" - "lbz %2,0(%6); addi %6,%6,1;" /* Store kernel byte */ + + "lbz %[data],0(%[kaddr]);" /* Load kernel byte */ + "addi %[kaddr],%[kaddr],1;" "sync;" - MTPID(%4) /* Load user ctx */ + + MTPID(%[ctx]) /* Load user ctx */ "isync;" - "stb %2,0(%5); dcbst 0,%5; addi %5,%5,1;" - /* Load byte */ - "or. %2,%2,%2;" + + "stb %[data],0(%[udaddr]);" /* Store byte */ + "dcbst 0,%[udaddr];" + "addi %[udaddr],%[udaddr],1;" + + "or. %[data],%[data],%[data];" "sync;" - "bdnzf 2,1b;" /* while(ctr-- && !zero) */ + "bdnzf eq,1b;" /* while(ctr-- && !zero) */ - MTPID(%1) /* Restore PID, MSR */ - "mtmsr %0;" + MTPID(%[pid]) /* Restore PID, MSR */ + "mtmsr %[msr];" "isync;" - "mfctr %3;" /* Restore resid */ - : "=" (msr),
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Oct 3 23:32:28 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: copyinstr.c copyoutstr.c Log Message: copy{in,out}str: Tidy up inline asm's: - Use %[foo], %[bar], ... instead of %0, %1, ... - One instruction per line. - Paragraph grouped instructions. - Fix wrong comments. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/ibm4xx/copyinstr.c \ src/sys/arch/powerpc/ibm4xx/copyoutstr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx/dev
Module Name:src Committed By: thorpej Date: Sun Sep 18 13:19:40 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx/dev: if_emac.c Log Message: Eliminate use of IFF_OACTIVE. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/dev/if_emac.c diff -u src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.56 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.57 --- src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.56 Tue Mar 30 02:25:24 2021 +++ src/sys/arch/powerpc/ibm4xx/dev/if_emac.c Sun Sep 18 13:19:40 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: if_emac.c,v 1.56 2021/03/30 02:25:24 rin Exp $ */ +/* $NetBSD: if_emac.c,v 1.57 2022/09/18 13:19:40 thorpej Exp $ */ /* * Copyright 2001, 2002 Wasabi Systems, Inc. @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.56 2021/03/30 02:25:24 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.57 2022/09/18 13:19:40 thorpej Exp $"); #ifdef _KERNEL_OPT #include "opt_emac.h" @@ -671,7 +671,7 @@ emac_start(struct ifnet *ifp) lasttx = 0; /* XXX gcc */ - if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) + if ((ifp->if_flags & IFF_RUNNING) == 0) return; /* @@ -740,7 +740,6 @@ emac_start(struct ifnet *ifp) * layer that there are not more slots left. * */ - ifp->if_flags |= IFF_OACTIVE; bus_dmamap_unload(sc->sc_dmat, dmamap); EMAC_EVCNT_INCR(>sc_ev_txdstall); break; @@ -831,10 +830,6 @@ emac_start(struct ifnet *ifp) bpf_mtap(ifp, m0, BPF_D_OUT); } - if (sc->sc_txfree == 0) - /* No more slots left; notify upper layer. */ - ifp->if_flags |= IFF_OACTIVE; - if (sc->sc_txfree != ofree) /* Set a watchdog timer in case the chip flakes out. */ ifp->if_timer = 5; @@ -1050,11 +1045,10 @@ emac_init(struct ifnet *ifp) * ... all done! */ ifp->if_flags |= IFF_RUNNING; - ifp->if_flags &= ~IFF_OACTIVE; out: if (error) { - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; ifp->if_timer = 0; aprint_error_ifnet(ifp, "interface not running\n"); } @@ -1100,7 +1094,7 @@ emac_stop(struct ifnet *ifp, int disable /* * Mark the interface down and cancel the watchdog timer. */ - ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); + ifp->if_flags &= ~IFF_RUNNING; ifp->if_timer = 0; } @@ -1268,8 +1262,6 @@ emac_txreap(struct emac_softc *sc) EMAC_EVCNT_INCR(>sc_ev_txreap); handled = 0; - ifp->if_flags &= ~IFF_OACTIVE; - count = 0; /* * Go through our Tx list and free mbufs for those
CVS commit: src/sys/arch/powerpc/ibm4xx/dev
Module Name:src Committed By: thorpej Date: Sun Sep 18 13:19:40 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx/dev: if_emac.c Log Message: Eliminate use of IFF_OACTIVE. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Sep 12 08:06:36 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: Work around clang 13.0.0 bug; copy{in,out}() are miscompiled with -O[12], by which /sbin/init cannot be executed. To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Sep 12 08:06:36 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: Work around clang 13.0.0 bug; copy{in,out}() are miscompiled with -O[12], by which /sbin/init cannot be executed. To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.98 src/sys/arch/powerpc/ibm4xx/trap.c:1.99 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.98 Mon Sep 12 08:02:44 2022 +++ src/sys/arch/powerpc/ibm4xx/trap.c Mon Sep 12 08:06:36 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.98 2022/09/12 08:02:44 rin Exp $ */ +/* $NetBSD: trap.c,v 1.99 2022/09/12 08:06:36 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.98 2022/09/12 08:02:44 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.99 2022/09/12 08:06:36 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -427,6 +427,9 @@ extern void vunmaprange(vaddr_t, vsize_t static int bigcopyin(const void *, void *, size_t ); static int bigcopyout(const void *, void *, size_t ); +#ifdef __clang__ +#pragma clang optimize off +#endif int copyin(const void *uaddr, void *kaddr, size_t len) { @@ -509,6 +512,9 @@ copyin(const void *uaddr, void *kaddr, s curpcb->pcb_onfault = NULL; return 0; } +#ifdef __clang__ +#pragma clang optimize on +#endif static int bigcopyin(const void *uaddr, void *kaddr, size_t len) @@ -542,6 +548,9 @@ bigcopyin(const void *uaddr, void *kaddr return error; } +#ifdef __clang__ +#pragma clang optimize off +#endif int copyout(const void *kaddr, void *uaddr, size_t len) { @@ -625,6 +634,9 @@ copyout(const void *kaddr, void *uaddr, curpcb->pcb_onfault = NULL; return 0; } +#ifdef __clang__ +#pragma clang optimize on +#endif static int bigcopyout(const void *kaddr, void *uaddr, size_t len)
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Sep 12 06:23:29 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copy{in,out}(): Minor clean up: - No need to supply count (== 0). - %r0 can be used as %[ctx] and %[len]. To generate a diff of this commit: cvs rdiff -u -r1.96 -r1.97 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.96 src/sys/arch/powerpc/ibm4xx/trap.c:1.97 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.96 Mon Sep 12 06:19:14 2022 +++ src/sys/arch/powerpc/ibm4xx/trap.c Mon Sep 12 06:23:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.96 2022/09/12 06:19:14 rin Exp $ */ +/* $NetBSD: trap.c,v 1.97 2022/09/12 06:23:29 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.96 2022/09/12 06:19:14 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.97 2022/09/12 06:23:29 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -431,7 +431,7 @@ int copyin(const void *uaddr, void *kaddr, size_t len) { struct pmap *pm = curproc->p_vmspace->vm_map.pmap; - int rv, msr, pid, tmp, ctx, count = 0; + int rv, msr, pid, tmp, ctx; struct faultbuf env; /* For bigger buffers use the faster copy */ @@ -457,9 +457,9 @@ copyin(const void *uaddr, void *kaddr, s "isync;" "mfpid %[pid];" /* Save old PID */ - "srwi. %[count],%[len],0x2;" /* How many words? */ + "srwi. %[tmp],%[len],0x2;" /* How many words? */ "beq- 2f;" /* No words. Go do bytes */ - "mtctr %[count];" + "mtctr %[tmp];" "1:" "mtpid %[ctx];" "isync;" @@ -483,9 +483,9 @@ copyin(const void *uaddr, void *kaddr, s "sync;" "bdnz 1b;" /* repeat */ - "2:" "andi. %[count],%[len],0x3;" /* How many remaining bytes? */ + "2:" "andi. %[tmp],%[len],0x3;" /* How many remaining bytes? */ "beq 10f;" - "mtxer %[count];" + "mtxer %[tmp];" "mtpid %[ctx];" "isync;" @@ -502,8 +502,8 @@ copyin(const void *uaddr, void *kaddr, s "isync;" : [msr] "=" (msr), [pid] "=" (pid), [tmp] "=" (tmp) - : [uaddr] "b" (uaddr), [ctx] "b" (ctx), [kaddr] "b" (kaddr), - [len] "b" (len), [count] "b" (count) + : [uaddr] "b" (uaddr), [kaddr] "b" (kaddr), + [ctx] "r" (ctx), [len] "r" (len) : "cr0", "ctr", "xer"); curpcb->pcb_onfault = NULL; @@ -546,7 +546,7 @@ int copyout(const void *kaddr, void *uaddr, size_t len) { struct pmap *pm = curproc->p_vmspace->vm_map.pmap; - int rv, msr, pid, tmp, ctx, count = 0; + int rv, msr, pid, tmp, ctx; struct faultbuf env; /* For big copies use more efficient routine */ @@ -572,9 +572,9 @@ copyout(const void *kaddr, void *uaddr, "isync;" "mfpid %[pid];" /* Save old PID */ - "srwi. %[count],%[len],0x2;" /* How many words? */ + "srwi. %[tmp],%[len],0x2;" /* How many words? */ "beq- 2f;" /* No words. Go do bytes */ - "mtctr %[count];" + "mtctr %[tmp];" "1:" #ifdef PPC_IBM403 @@ -600,9 +600,9 @@ copyout(const void *kaddr, void *uaddr, "isync;" "bdnz 1b;" /* repeat */ - "2:" "andi. %[count],%[len],0x3;" /* How many remaining bytes? */ + "2:" "andi. %[tmp],%[len],0x3;" /* How many remaining bytes? */ "beq 10f;" - "mtxer %[count];" + "mtxer %[tmp];" "lswx %[tmp],0,%[kaddr];" /* Load kernel bytes */ "sync;" @@ -618,8 +618,8 @@ copyout(const void *kaddr, void *uaddr, "isync;" : [msr] "=" (msr), [pid] "=" (pid), [tmp] "=" (tmp) - : [uaddr] "b" (uaddr), [ctx] "b" (ctx), [kaddr] "b" (kaddr), - [len] "b" (len), [count] "b" (count) + : [uaddr] "b" (uaddr), [kaddr] "b" (kaddr), + [ctx] "r" (ctx), [len] "r" (len) : "cr0", "ctr", "xer"); curpcb->pcb_onfault = NULL;
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Sep 12 06:23:29 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copy{in,out}(): Minor clean up: - No need to supply count (== 0). - %r0 can be used as %[ctx] and %[len]. To generate a diff of this commit: cvs rdiff -u -r1.96 -r1.97 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Sep 12 06:19:14 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copyin(): Remove one more needless mtpid. No regression for full ATF. To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.95 src/sys/arch/powerpc/ibm4xx/trap.c:1.96 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.95 Sun Sep 11 09:27:18 2022 +++ src/sys/arch/powerpc/ibm4xx/trap.c Mon Sep 12 06:19:14 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.95 2022/09/11 09:27:18 rin Exp $ */ +/* $NetBSD: trap.c,v 1.96 2022/09/12 06:19:14 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.95 2022/09/11 09:27:18 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.96 2022/09/12 06:19:14 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -498,8 +498,7 @@ copyin(const void *uaddr, void *kaddr, s "dcbst 0,%[kaddr];" /* flush cache */ "sync;" - "10:" "mtpid %[pid];" /* Restore PID and MSR */ - "mtmsr %[msr];" + "10:" "mtmsr %[msr];" /* Restore MSR */ "isync;" : [msr] "=" (msr), [pid] "=" (pid), [tmp] "=" (tmp)
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Sep 12 06:19:14 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copyin(): Remove one more needless mtpid. No regression for full ATF. To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 09:27:18 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copyin(): Fix comment. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.94 src/sys/arch/powerpc/ibm4xx/trap.c:1.95 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.94 Sun Sep 11 09:08:04 2022 +++ src/sys/arch/powerpc/ibm4xx/trap.c Sun Sep 11 09:27:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.94 2022/09/11 09:08:04 rin Exp $ */ +/* $NetBSD: trap.c,v 1.95 2022/09/11 09:27:18 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.94 2022/09/11 09:08:04 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.95 2022/09/11 09:27:18 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -494,7 +494,7 @@ copyin(const void *uaddr, void *kaddr, s "mtpid %[pid];" "isync;" - "stswx %[tmp],0,%[kaddr];" /* Store kernel byte */ + "stswx %[tmp],0,%[kaddr];" /* Store kernel bytes */ "dcbst 0,%[kaddr];" /* flush cache */ "sync;"
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 09:27:18 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copyin(): Fix comment. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 09:08:04 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copy{in,out}(): Tiny optimizations for __asm codes. No regressions for full ATF run. - Use {l,st}swx instead of loop for remaining bytes. - Drop needless "mtpid %[x]; isync;". To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.93 src/sys/arch/powerpc/ibm4xx/trap.c:1.94 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.93 Sun Sep 11 09:03:25 2022 +++ src/sys/arch/powerpc/ibm4xx/trap.c Sun Sep 11 09:08:04 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.93 2022/09/11 09:03:25 rin Exp $ */ +/* $NetBSD: trap.c,v 1.94 2022/09/11 09:08:04 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.93 2022/09/11 09:03:25 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.94 2022/09/11 09:08:04 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -485,23 +485,18 @@ copyin(const void *uaddr, void *kaddr, s "2:" "andi. %[count],%[len],0x3;" /* How many remaining bytes? */ "beq 10f;" - "addi %[count],%[count],0x1;" - "mtctr %[count];" - "3:" "bdz 10f;" /* while count */ + "mtxer %[count];" "mtpid %[ctx];" "isync;" - "lbz %[tmp],0(%[uaddr]);" /* Load user byte */ - "addi %[uaddr],%[uaddr],0x1;" /* next uaddr byte */ + "lswx %[tmp],0,%[uaddr];" /* Load user bytes */ "sync;" "mtpid %[pid];" "isync;" - "stb %[tmp],0(%[kaddr]);" /* Store kernel byte */ + "stswx %[tmp],0,%[kaddr];" /* Store kernel byte */ "dcbst 0,%[kaddr];" /* flush cache */ - "addi %[kaddr],%[kaddr],0x1;" "sync;" - "b 3b;" "10:" "mtpid %[pid];" /* Restore PID and MSR */ "mtmsr %[msr];" @@ -510,7 +505,7 @@ copyin(const void *uaddr, void *kaddr, s : [msr] "=" (msr), [pid] "=" (pid), [tmp] "=" (tmp) : [uaddr] "b" (uaddr), [ctx] "b" (ctx), [kaddr] "b" (kaddr), [len] "b" (len), [count] "b" (count) - : "cr0", "ctr"); + : "cr0", "ctr", "xer"); curpcb->pcb_onfault = NULL; return 0; @@ -582,8 +577,7 @@ copyout(const void *kaddr, void *uaddr, "beq- 2f;" /* No words. Go do bytes */ "mtctr %[count];" - "1:" "mtpid %[pid];" - "isync;" + "1:" #ifdef PPC_IBM403 "lswi %[tmp],%[kaddr],4;" /* Load kernel word */ #else @@ -602,36 +596,32 @@ copyout(const void *kaddr, void *uaddr, "dcbst 0,%[uaddr];" /* flush cache */ "addi %[uaddr],%[uaddr],0x4;" /* next uaddr word */ "sync;" + + "mtpid %[pid];" + "isync;" "bdnz 1b;" /* repeat */ "2:" "andi. %[count],%[len],0x3;" /* How many remaining bytes? */ "beq 10f;" - "addi %[count],%[count],0x1;" - "mtctr %[count];" - "3:" "bdz 10f;" /* while count */ + "mtxer %[count];" - "mtpid %[pid];" - "isync;" - "lbz %[tmp],0(%[kaddr]);" /* Load kernel byte */ - "addi %[kaddr],%[kaddr],0x1;" /* next kaddr byte */ + "lswx %[tmp],0,%[kaddr];" /* Load kernel bytes */ "sync;" "mtpid %[ctx];" "isync;" - "stb %[tmp],0(%[uaddr]);" /* Store user byte */ + "stswx %[tmp],0,%[uaddr];" /* Store user bytes */ "dcbst 0,%[uaddr];" /* flush cache */ - "addi %[uaddr],%[uaddr],0x1;" "sync;" - "b 3b;" - "10:" "mtpid %[pid];" /* Restore PID and MSR */ - "mtmsr %[msr];" + "mtpid %[pid];" /* Restore PID and MSR */ + "10:" "mtmsr %[msr];" "isync;" : [msr] "=" (msr), [pid] "=" (pid), [tmp] "=" (tmp) : [uaddr] "b" (uaddr), [ctx] "b" (ctx), [kaddr] "b" (kaddr), [len] "b" (len), [count] "b" (count) - : "cr0", "ctr"); + : "cr0", "ctr", "xer"); curpcb->pcb_onfault = NULL; return 0;
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 09:08:04 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copy{in,out}(): Tiny optimizations for __asm codes. No regressions for full ATF run. - Use {l,st}swx instead of loop for remaining bytes. - Drop needless "mtpid %[x]; isync;". To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 09:03:25 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copy{in,out}(): Add missing clobber registers to __asm codes. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.92 src/sys/arch/powerpc/ibm4xx/trap.c:1.93 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.92 Sun Sep 11 09:00:02 2022 +++ src/sys/arch/powerpc/ibm4xx/trap.c Sun Sep 11 09:03:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.92 2022/09/11 09:00:02 rin Exp $ */ +/* $NetBSD: trap.c,v 1.93 2022/09/11 09:03:25 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.92 2022/09/11 09:00:02 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.93 2022/09/11 09:03:25 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -509,7 +509,8 @@ copyin(const void *uaddr, void *kaddr, s : [msr] "=" (msr), [pid] "=" (pid), [tmp] "=" (tmp) : [uaddr] "b" (uaddr), [ctx] "b" (ctx), [kaddr] "b" (kaddr), - [len] "b" (len), [count] "b" (count)); + [len] "b" (len), [count] "b" (count) + : "cr0", "ctr"); curpcb->pcb_onfault = NULL; return 0; @@ -629,7 +630,8 @@ copyout(const void *kaddr, void *uaddr, : [msr] "=" (msr), [pid] "=" (pid), [tmp] "=" (tmp) : [uaddr] "b" (uaddr), [ctx] "b" (ctx), [kaddr] "b" (kaddr), - [len] "b" (len), [count] "b" (count)); + [len] "b" (len), [count] "b" (count) + : "cr0", "ctr"); curpcb->pcb_onfault = NULL; return 0;
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 09:03:25 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copy{in,out}(): Add missing clobber registers to __asm codes. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 09:00:02 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copy{in,out}(): Add missing ``if (count == 0) goto done;''. To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.91 src/sys/arch/powerpc/ibm4xx/trap.c:1.92 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.91 Sun Sep 11 08:57:39 2022 +++ src/sys/arch/powerpc/ibm4xx/trap.c Sun Sep 11 09:00:02 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.91 2022/09/11 08:57:39 rin Exp $ */ +/* $NetBSD: trap.c,v 1.92 2022/09/11 09:00:02 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.91 2022/09/11 08:57:39 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.92 2022/09/11 09:00:02 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -484,6 +484,7 @@ copyin(const void *uaddr, void *kaddr, s "bdnz 1b;" /* repeat */ "2:" "andi. %[count],%[len],0x3;" /* How many remaining bytes? */ + "beq 10f;" "addi %[count],%[count],0x1;" "mtctr %[count];" "3:" "bdz 10f;" /* while count */ @@ -603,6 +604,7 @@ copyout(const void *kaddr, void *uaddr, "bdnz 1b;" /* repeat */ "2:" "andi. %[count],%[len],0x3;" /* How many remaining bytes? */ + "beq 10f;" "addi %[count],%[count],0x1;" "mtctr %[count];" "3:" "bdz 10f;" /* while count */
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 09:00:02 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copy{in,out}(): Add missing ``if (count == 0) goto done;''. To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 08:57:39 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copy{in,out}(): Consistently use %[tmp] as scratch register. NFC. To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 08:57:39 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copy{in,out}(): Consistently use %[tmp] as scratch register. NFC. To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.90 src/sys/arch/powerpc/ibm4xx/trap.c:1.91 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.90 Sun Sep 11 08:56:23 2022 +++ src/sys/arch/powerpc/ibm4xx/trap.c Sun Sep 11 08:57:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.90 2022/09/11 08:56:23 rin Exp $ */ +/* $NetBSD: trap.c,v 1.91 2022/09/11 08:57:39 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.90 2022/09/11 08:56:23 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.91 2022/09/11 08:57:39 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -451,9 +451,9 @@ copyin(const void *uaddr, void *kaddr, s __asm volatile( "mfmsr %[msr];" /* Save MSR */ - "li %[pid],0x20;" /* Disable IMMU */ - "andc %[pid],%[msr],%[pid];" - "mtmsr %[pid];" + "li %[tmp],0x20;" /* Disable IMMU */ + "andc %[tmp],%[msr],%[tmp];" + "mtmsr %[tmp];" "isync;" "mfpid %[pid];" /* Save old PID */ @@ -570,9 +570,9 @@ copyout(const void *kaddr, void *uaddr, __asm volatile( "mfmsr %[msr];" /* Save MSR */ - "li %[pid],0x20;" /* Disable IMMU */ - "andc %[pid],%[msr],%[pid];" - "mtmsr %[pid];" + "li %[tmp],0x20;" /* Disable IMMU */ + "andc %[tmp],%[msr],%[tmp];" + "mtmsr %[tmp];" "isync;" "mfpid %[pid];" /* Save old PID */
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 08:56:23 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copyin(): Fix copy-paste in comment. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.89 src/sys/arch/powerpc/ibm4xx/trap.c:1.90 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.89 Sun Sep 11 08:49:54 2022 +++ src/sys/arch/powerpc/ibm4xx/trap.c Sun Sep 11 08:56:23 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.89 2022/09/11 08:49:54 rin Exp $ */ +/* $NetBSD: trap.c,v 1.90 2022/09/11 08:56:23 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.89 2022/09/11 08:49:54 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.90 2022/09/11 08:56:23 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -479,7 +479,7 @@ copyin(const void *uaddr, void *kaddr, s "stw %[tmp],0(%[kaddr]);" #endif "dcbst 0,%[kaddr];" /* flush cache */ - "addi %[kaddr],%[kaddr],0x4;" /* next uaddr word */ + "addi %[kaddr],%[kaddr],0x4;" /* next kaddr word */ "sync;" "bdnz 1b;" /* repeat */
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 08:56:23 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copyin(): Fix copy-paste in comment. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 08:49:54 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copy{in,out}(): Cosmetic changes to __asm codes. No binary changes. - Editor-friendly indentation. - One insn per line. - Group insns with logical blocks. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.88 src/sys/arch/powerpc/ibm4xx/trap.c:1.89 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.88 Sun Sep 11 08:30:43 2022 +++ src/sys/arch/powerpc/ibm4xx/trap.c Sun Sep 11 08:49:54 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.88 2022/09/11 08:30:43 rin Exp $ */ +/* $NetBSD: trap.c,v 1.89 2022/09/11 08:49:54 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.88 2022/09/11 08:30:43 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.89 2022/09/11 08:49:54 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -450,50 +450,62 @@ copyin(const void *uaddr, void *kaddr, s } __asm volatile( - " mfmsr %[msr];" /* Save MSR */ - " li %[pid],0x20;" - " andc %[pid],%[msr],%[pid]; mtmsr %[pid];" /* Disable IMMU */ - " isync;" - " mfpid %[pid];" /* Save old PID */ - - " srwi. %[count],%[len],0x2;" /* How many words? */ - " beq- 2f;" /* No words. Go do bytes */ - " mtctr %[count];" - "1: mtpid %[ctx]; isync;" + "mfmsr %[msr];" /* Save MSR */ + "li %[pid],0x20;" /* Disable IMMU */ + "andc %[pid],%[msr],%[pid];" + "mtmsr %[pid];" + "isync;" + "mfpid %[pid];" /* Save old PID */ + + "srwi. %[count],%[len],0x2;" /* How many words? */ + "beq- 2f;" /* No words. Go do bytes */ + "mtctr %[count];" + + "1:" "mtpid %[ctx];" + "isync;" #ifdef PPC_IBM403 - " lswi %[tmp],%[uaddr],4;" /* Load user word */ + "lswi %[tmp],%[uaddr],4;" /* Load user word */ #else - " lwz %[tmp],0(%[uaddr]);" + "lwz %[tmp],0(%[uaddr]);" #endif - " addi %[uaddr],%[uaddr],0x4;" /* next uaddr word */ - " sync;" - " mtpid %[pid]; isync;" + "addi %[uaddr],%[uaddr],0x4;" /* next uaddr word */ + "sync;" + + "mtpid %[pid];" + "isync;" #ifdef PPC_IBM403 - " stswi %[tmp],%[kaddr],4;" /* Store kernel word */ + "stswi %[tmp],%[kaddr],4;" /* Store kernel word */ #else - " stw %[tmp],0(%[kaddr]);" + "stw %[tmp],0(%[kaddr]);" #endif - " dcbst 0,%[kaddr];" /* flush cache */ - " addi %[kaddr],%[kaddr],0x4;" /* next uaddr word */ - " sync;" - " bdnz 1b;" /* repeat */ - - "2: andi. %[count],%[len],0x3;" /* How many remaining bytes? */ - " addi %[count],%[count],0x1;" - " mtctr %[count];" - "3: bdz 10f;" /* while count */ - " mtpid %[ctx]; isync;" - " lbz %[tmp],0(%[uaddr]);" /* Load user byte */ - " addi %[uaddr],%[uaddr],0x1;" /* next uaddr byte */ - " sync;" - " mtpid %[pid]; isync;" - " stb %[tmp],0(%[kaddr]);" /* Store kernel byte */ - " dcbst 0,%[kaddr];" /* flush cache */ - " addi %[kaddr],%[kaddr],0x1;" - " sync;" - " b 3b;" - "10:mtpid %[pid]; mtmsr %[msr]; isync;" - /* Restore PID and MSR */ + "dcbst 0,%[kaddr];" /* flush cache */ + "addi %[kaddr],%[kaddr],0x4;" /* next uaddr word */ + "sync;" + "bdnz 1b;" /* repeat */ + + "2:" "andi. %[count],%[len],0x3;" /* How many remaining bytes? */ + "addi %[count],%[count],0x1;" + "mtctr %[count];" + "3:" "bdz 10f;" /* while count */ + + "mtpid %[ctx];" + "isync;" + "lbz %[tmp],0(%[uaddr]);" /* Load user byte */ + "addi %[uaddr],%[uaddr],0x1;" /* next uaddr byte */ + "sync;" + + "mtpid %[pid];" + "isync;" + "stb %[tmp],0(%[kaddr]);" /* Store kernel byte */ + "dcbst 0,%[kaddr];" /* flush cache */ + "addi %[kaddr],%[kaddr],0x1;" + "sync;" + "b 3b;" + + "10:" "mtpid %[pid];" /* Restore PID and MSR */ + "mtmsr %[msr];" + "isync;" + : [msr] "=" (msr), [pid] "=" (pid), [tmp] "=" (tmp) : [uaddr] "b" (uaddr), [ctx] "b" (ctx), [kaddr] "b" (kaddr), [len] "b" (len), [count] "b" (count)); @@ -557,50 +569,62 @@ copyout(const void *kaddr, void *uaddr, } __asm volatile( - " mfmsr %[msr];" /* Save MSR */ - " li %[pid],0x20;" - " andc %[pid],%[msr],%[pid]; mtmsr %[pid];" /* Disable IMMU */ - " isync;" - " mfpid %[pid];" /* Save old PID */ - - " srwi. %[count],%[len],0x2;" /* How many words? */ - " beq- 2f;" /* No words. Go do bytes */ - " mtctr %[count];" - "1: mtpid %[pid]; isync;" + "mfmsr %[msr];" /* Save MSR */ + "li %[pid],0x20;" /* Disable IMMU */ + "andc %[pid],%[msr],%[pid];" + "mtmsr %[pid];" + "isync;" + "mfpid %[pid];" /* Save old PID */ + + "srwi. %[count],%[len],0x2;" /* How many words? */ + "beq- 2f;" /* No words. Go do bytes */ + "mtctr %[count];" + + "1:" "mtpid %[pid];" +
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 08:49:54 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: copy{in,out}(): Cosmetic changes to __asm codes. No binary changes. - Editor-friendly indentation. - One insn per line. - Group insns with logical blocks. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 08:30:43 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: s/udaddr/uaddr/g for consistency; we use kaddr for kernel data address. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 11 08:30:43 UTC 2022 Modified Files: src/sys/arch/powerpc/ibm4xx: trap.c Log Message: s/udaddr/uaddr/g for consistency; we use kaddr for kernel data address. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/arch/powerpc/ibm4xx/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/trap.c diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.87 src/sys/arch/powerpc/ibm4xx/trap.c:1.88 --- src/sys/arch/powerpc/ibm4xx/trap.c:1.87 Mon May 30 14:09:01 2022 +++ src/sys/arch/powerpc/ibm4xx/trap.c Sun Sep 11 08:30:43 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.87 2022/05/30 14:09:01 rin Exp $ */ +/* $NetBSD: trap.c,v 1.88 2022/09/11 08:30:43 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -69,7 +69,7 @@ #define __UFETCHSTORE_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.87 2022/05/30 14:09:01 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.88 2022/09/11 08:30:43 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -428,7 +428,7 @@ static int bigcopyin(const void *, void static int bigcopyout(const void *, void *, size_t ); int -copyin(const void *udaddr, void *kaddr, size_t len) +copyin(const void *uaddr, void *kaddr, size_t len) { struct pmap *pm = curproc->p_vmspace->vm_map.pmap; int rv, msr, pid, tmp, ctx, count = 0; @@ -436,7 +436,7 @@ copyin(const void *udaddr, void *kaddr, /* For bigger buffers use the faster copy */ if (len > 1024) - return (bigcopyin(udaddr, kaddr, len)); + return (bigcopyin(uaddr, kaddr, len)); if ((rv = setfault())) { curpcb->pcb_onfault = NULL; @@ -461,11 +461,11 @@ copyin(const void *udaddr, void *kaddr, " mtctr %[count];" "1: mtpid %[ctx]; isync;" #ifdef PPC_IBM403 - " lswi %[tmp],%[udaddr],4;" /* Load user word */ + " lswi %[tmp],%[uaddr],4;" /* Load user word */ #else - " lwz %[tmp],0(%[udaddr]);" + " lwz %[tmp],0(%[uaddr]);" #endif - " addi %[udaddr],%[udaddr],0x4;" /* next udaddr word */ + " addi %[uaddr],%[uaddr],0x4;" /* next uaddr word */ " sync;" " mtpid %[pid]; isync;" #ifdef PPC_IBM403 @@ -474,7 +474,7 @@ copyin(const void *udaddr, void *kaddr, " stw %[tmp],0(%[kaddr]);" #endif " dcbst 0,%[kaddr];" /* flush cache */ - " addi %[kaddr],%[kaddr],0x4;" /* next udaddr word */ + " addi %[kaddr],%[kaddr],0x4;" /* next uaddr word */ " sync;" " bdnz 1b;" /* repeat */ @@ -483,8 +483,8 @@ copyin(const void *udaddr, void *kaddr, " mtctr %[count];" "3: bdz 10f;" /* while count */ " mtpid %[ctx]; isync;" - " lbz %[tmp],0(%[udaddr]);" /* Load user byte */ - " addi %[udaddr],%[udaddr],0x1;" /* next udaddr byte */ + " lbz %[tmp],0(%[uaddr]);" /* Load user byte */ + " addi %[uaddr],%[uaddr],0x1;" /* next uaddr byte */ " sync;" " mtpid %[pid]; isync;" " stb %[tmp],0(%[kaddr]);" /* Store kernel byte */ @@ -495,7 +495,7 @@ copyin(const void *udaddr, void *kaddr, "10:mtpid %[pid]; mtmsr %[msr]; isync;" /* Restore PID and MSR */ : [msr] "=" (msr), [pid] "=" (pid), [tmp] "=" (tmp) - : [udaddr] "b" (udaddr), [ctx] "b" (ctx), [kaddr] "b" (kaddr), + : [uaddr] "b" (uaddr), [ctx] "b" (ctx), [kaddr] "b" (kaddr), [len] "b" (len), [count] "b" (count)); curpcb->pcb_onfault = NULL; @@ -503,7 +503,7 @@ copyin(const void *udaddr, void *kaddr, } static int -bigcopyin(const void *udaddr, void *kaddr, size_t len) +bigcopyin(const void *uaddr, void *kaddr, size_t len) { const char *up; char *kp = kaddr; @@ -517,11 +517,11 @@ bigcopyin(const void *udaddr, void *kadd /* * Stolen from physio(): */ - error = uvm_vslock(p->p_vmspace, __UNCONST(udaddr), len, VM_PROT_READ); + error = uvm_vslock(p->p_vmspace, __UNCONST(uaddr), len, VM_PROT_READ); if (error) { return error; } - up = (char *)vmaprange(p, (vaddr_t)udaddr, len, VM_PROT_READ); + up = (char *)vmaprange(p, (vaddr_t)uaddr, len, VM_PROT_READ); if ((error = setfault()) == 0) { memcpy(kp, up, len); @@ -529,13 +529,13 @@ bigcopyin(const void *udaddr, void *kadd curpcb->pcb_onfault = NULL; vunmaprange((vaddr_t)up, len); - uvm_vsunlock(p->p_vmspace, __UNCONST(udaddr), len); + uvm_vsunlock(p->p_vmspace, __UNCONST(uaddr), len); return error; } int -copyout(const void *kaddr, void *udaddr, size_t len) +copyout(const void *kaddr, void *uaddr, size_t len) { struct pmap *pm = curproc->p_vmspace->vm_map.pmap; int rv, msr, pid, tmp, ctx, count = 0; @@ -543,7 +543,7 @@ copyout(const void *kaddr, void *udaddr, /* For big copies use more efficient routine */ if (len > 1024) - return (bigcopyout(kaddr, udaddr, len)); + return (bigcopyout(kaddr, uaddr, len)); if ((rv = setfault())) { curpcb->pcb_onfault = NULL; @@ -576,12 +576,12 @@ copyout(const void *kaddr, void *udaddr, " sync;"
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Sep 8 00:17:21 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: pte_enter() and pmap_enter_pv(): return zero for success, and non-zero value for failure, as normally expected. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.104 src/sys/arch/powerpc/ibm4xx/pmap.c:1.105 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.104 Sun Sep 5 12:47:10 2021 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Wed Sep 8 00:17:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.104 2021/09/05 12:47:10 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.105 2021/09/08 00:17:21 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.104 2021/09/05 12:47:10 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.105 2021/09/08 00:17:21 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -235,13 +235,13 @@ pte_enter(struct pmap *pm, vaddr_t va, u if (!pm->pm_ptbl[seg]) { /* Don't allocate a page to clear a non-existent mapping. */ if (!pte) - return 1; + return 0; vaddr_t km = uvm_km_alloc(kernel_map, PAGE_SIZE, 0, UVM_KMF_WIRED | UVM_KMF_ZERO | UVM_KMF_NOWAIT); if (__predict_false(km == 0)) - return 0; + return ENOMEM; pm->pm_ptbl[seg] = (u_int *)km; } @@ -256,7 +256,7 @@ pte_enter(struct pmap *pm, vaddr_t va, u else pm->pm_stats.resident_count++; } - return 1; + return 0; } /* @@ -700,9 +700,6 @@ pmap_copy_page(paddr_t src, paddr_t dst) dcache_wbinv_page(dst); } -/* - * This returns != 0 on success. - */ static inline int pmap_enter_pv(struct pmap *pm, vaddr_t va, paddr_t pa, int flags) { @@ -731,7 +728,7 @@ pmap_enter_pv(struct pmap *pm, vaddr_t v if ((flags & PMAP_CANFAIL) == 0) panic("pmap_enter_pv: failed"); splx(s); - return 0; + return ENOMEM; } npv->pv_va = va; npv->pv_pm = pm; @@ -746,7 +743,7 @@ pmap_enter_pv(struct pmap *pm, vaddr_t v splx(s); - return 1; + return 0; } static void @@ -849,7 +846,7 @@ pmap_enter(struct pmap *pm, vaddr_t va, if (pmap_initialized && managed) { char *attr; - if (!pmap_enter_pv(pm, va, pa, flags)) { + if (pmap_enter_pv(pm, va, pa, flags)) { /* Could not enter pv on a managed page */ return ENOMEM; } @@ -866,7 +863,7 @@ pmap_enter(struct pmap *pm, vaddr_t va, s = splvm(); /* Insert page into page table. */ - if (__predict_false(!pte_enter(pm, va, tte))) { + if (__predict_false(pte_enter(pm, va, tte))) { if (__predict_false((flags & PMAP_CANFAIL) == 0)) panic("%s: pte_enter", __func__); splx(s); @@ -961,7 +958,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v s = splvm(); /* Insert page into page table. */ - if (__predict_false(!pte_enter(pm, va, tte))) + if (__predict_false(pte_enter(pm, va, tte))) panic("%s: pte_enter", __func__); splx(s);
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Sep 8 00:17:21 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: pte_enter() and pmap_enter_pv(): return zero for success, and non-zero value for failure, as normally expected. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 5 12:47:10 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: Now, ctx_flush() never fails. So, make this function void. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.103 src/sys/arch/powerpc/ibm4xx/pmap.c:1.104 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.103 Sun Sep 5 12:28:44 2021 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Sun Sep 5 12:47:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.103 2021/09/05 12:28:44 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.104 2021/09/05 12:47:10 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.103 2021/09/05 12:28:44 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.104 2021/09/05 12:47:10 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -183,7 +183,7 @@ static struct pool pv_pool; static int pmap_initialized; -static int ctx_flush(int); +static void ctx_flush(int); struct pv_entry *pa_to_pv(paddr_t); static inline char *pa_to_attr(paddr_t); @@ -1560,7 +1560,7 @@ pmap_tlbmiss(vaddr_t va, int ctx) /* * Flush all the entries matching a context from the TLB. */ -static int +static void ctx_flush(int cnum) { int i; @@ -1579,7 +1579,6 @@ ctx_flush(int cnum) tlb_invalidate_entry(i); } } - return 0; } /* @@ -1605,15 +1604,9 @@ ctx_alloc(struct pmap *pm) } while (ctxbusy[cnum] != NULL && cnum != next); /* Now clean it out */ -oops: if (cnum < MINCTX) cnum = MINCTX; /* Never steal ctx 0 or 1 */ - if (ctx_flush(cnum)) { - /* oops -- something's wired. */ - if (++cnum >= NUMCTX) - cnum = MINCTX; - goto oops; - } + ctx_flush(cnum); if (ctxbusy[cnum]) { #ifdef DEBUG
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 5 12:47:10 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: Now, ctx_flush() never fails. So, make this function void. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 5 12:28:44 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: pmap_enter_pv(): At the moment, this function is always called with pmap_initialized. So, convert test for this condition to KASSERT. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 5 12:28:44 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: pmap_enter_pv(): At the moment, this function is always called with pmap_initialized. So, convert test for this condition to KASSERT. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.102 src/sys/arch/powerpc/ibm4xx/pmap.c:1.103 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.102 Sun Sep 5 12:23:40 2021 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Sun Sep 5 12:28:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.102 2021/09/05 12:23:40 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.103 2021/09/05 12:28:44 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.102 2021/09/05 12:23:40 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.103 2021/09/05 12:28:44 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -709,8 +709,7 @@ pmap_enter_pv(struct pmap *pm, vaddr_t v struct pv_entry *pv, *npv; int s; - if (!pmap_initialized) - return 0; + KASSERT(pmap_initialized); s = splvm();
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 5 12:23:40 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: pmap_enter_pv(): No need to initialize npv to NULL. No functional changes intended. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.101 src/sys/arch/powerpc/ibm4xx/pmap.c:1.102 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.101 Sun Sep 5 12:05:05 2021 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Sun Sep 5 12:23:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.101 2021/09/05 12:05:05 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.102 2021/09/05 12:23:40 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.101 2021/09/05 12:05:05 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.102 2021/09/05 12:23:40 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -706,7 +706,7 @@ pmap_copy_page(paddr_t src, paddr_t dst) static inline int pmap_enter_pv(struct pmap *pm, vaddr_t va, paddr_t pa, int flags) { - struct pv_entry *pv, *npv = NULL; + struct pv_entry *pv, *npv; int s; if (!pmap_initialized)
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 5 12:23:40 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: pmap_enter_pv(): No need to initialize npv to NULL. No functional changes intended. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 5 12:05:05 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: pmap_testout(): Use pmap_{protect,remove}() for va to (va + PAGE_SIZE), instead of (va + 1). No functional changes for the current implementation. Also, this affects only when the function is manually called from DDB on DEBUG kernel. To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.100 src/sys/arch/powerpc/ibm4xx/pmap.c:1.101 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.100 Sun Sep 5 09:57:43 2021 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Sun Sep 5 12:05:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.100 2021/09/05 09:57:43 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.101 2021/09/05 12:05:05 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.100 2021/09/05 09:57:43 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.101 2021/09/05 12:05:05 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1732,7 +1732,7 @@ pmap_testout(void) printf("Modified page: ref %d, mod %d\n", ref, mod); /* Check pmap_protect() */ - pmap_protect(pmap_kernel(), va, va+1, VM_PROT_READ); + pmap_protect(pmap_kernel(), va, va + PAGE_SIZE, VM_PROT_READ); pmap_update(pmap_kernel()); ref = pmap_is_referenced(pg); mod = pmap_is_modified(pg); @@ -1769,7 +1769,7 @@ pmap_testout(void) printf("Modified page: ref %d, mod %d\n", ref, mod); /* Check pmap_protect() */ - pmap_protect(pmap_kernel(), va, va+1, VM_PROT_NONE); + pmap_protect(pmap_kernel(), va, va + PAGE_SIZE, VM_PROT_NONE); pmap_update(pmap_kernel()); ref = pmap_is_referenced(pg); mod = pmap_is_modified(pg); @@ -1879,7 +1879,7 @@ pmap_testout(void) printf("Modified page: ref %d, mod %d\n", ref, mod); /* Unmap page */ - pmap_remove(pmap_kernel(), va, va+1); + pmap_remove(pmap_kernel(), va, va + PAGE_SIZE); pmap_update(pmap_kernel()); ref = pmap_is_referenced(pg); mod = pmap_is_modified(pg);
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 5 12:05:05 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: pmap_testout(): Use pmap_{protect,remove}() for va to (va + PAGE_SIZE), instead of (va + 1). No functional changes for the current implementation. Also, this affects only when the function is manually called from DDB on DEBUG kernel. To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 5 09:57:43 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: if (cond) panic() or Debugger() in #ifdef DIAGNOSTIC ---> KASSERT(!cond) There is no regression observed during a full ATF run. To generate a diff of this commit: cvs rdiff -u -r1.99 -r1.100 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sun Sep 5 09:57:43 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: if (cond) panic() or Debugger() in #ifdef DIAGNOSTIC ---> KASSERT(!cond) There is no regression observed during a full ATF run. To generate a diff of this commit: cvs rdiff -u -r1.99 -r1.100 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.99 src/sys/arch/powerpc/ibm4xx/pmap.c:1.100 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.99 Sat Sep 4 14:31:04 2021 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Sun Sep 5 09:57:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.99 2021/09/04 14:31:04 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.100 2021/09/05 09:57:43 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.99 2021/09/04 14:31:04 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.100 2021/09/05 09:57:43 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -590,17 +590,10 @@ void vm_page_free1(struct vm_page *pg) { -#ifdef DIAGNOSTIC - if (pg->flags != (PG_CLEAN|PG_FAKE)) { - printf("Freeing invalid page %p\n", pg); - printf("pa = %llx\n", - (unsigned long long)VM_PAGE_TO_PHYS(pg)); -#ifdef DDB - Debugger(); -#endif - return; - } -#endif + KASSERTMSG(pg->flags == (PG_CLEAN | PG_FAKE), + "invalid page pg = %p, pa = %" PRIxPADDR, + pg, VM_PAGE_TO_PHYS(pg)); + pg->flags |= PG_BUSY; pg->wire_count = 0; uvm_pagefree(pg); @@ -824,11 +817,8 @@ pmap_enter(struct pmap *pm, vaddr_t va, /* -- need to support multiple page sizes. */ tte |= TTE_SZ_16K; -#ifdef DIAGNOSTIC - if ((flags & (PMAP_NOCACHE | PME_WRITETHROUG)) == - (PMAP_NOCACHE | PME_WRITETHROUG)) - panic("pmap_enter: uncached & writethrough"); -#endif + KASSERT((flags & (PMAP_NOCACHE | PME_WRITETHROUG)) != + (PMAP_NOCACHE | PME_WRITETHROUG)); if (flags & PMAP_NOCACHE) { /* Must be I/O mapping */ @@ -867,10 +857,7 @@ pmap_enter(struct pmap *pm, vaddr_t va, /* Now set attributes. */ attr = pa_to_attr(pa); -#ifdef DIAGNOSTIC - if (!attr) - panic("managed but no attr"); -#endif + KASSERT(attr); if (flags & VM_PROT_ALL) *attr |= PMAP_ATTR_REF; if (flags & VM_PROT_WRITE) @@ -954,11 +941,8 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v /* -- need to support multiple page sizes. */ tte |= TTE_SZ_16K; -#ifdef DIAGNOSTIC - if ((flags & (PMAP_NOCACHE | PME_WRITETHROUG)) == - (PMAP_NOCACHE | PME_WRITETHROUG)) - panic("pmap_kenter_pa: uncached & writethrough"); -#endif + KASSERT((flags & (PMAP_NOCACHE | PME_WRITETHROUG)) != + (PMAP_NOCACHE | PME_WRITETHROUG)); if (flags & PMAP_NOCACHE) /* Must be I/O mapping */ @@ -1380,11 +1364,8 @@ ppc4xx_tlb_enter(int ctx, vaddr_t va, u_ idx = ppc4xx_tlb_find_victim(); -#ifdef DIAGNOSTIC - if ((idx < tlb_nreserved) || (idx >= NTLB) || (idx & 63) == 0) { - panic("ppc4xx_tlb_enter: replacing entry %ld", idx); - } -#endif + KASSERTMSG(idx >= tlb_nreserved && idx < NTLB, + "invalid entry %ld", idx); tlb_info[idx].ti_va = (va & TLB_EPN_MASK); tlb_info[idx].ti_ctx = ctx; @@ -1588,22 +1569,10 @@ ctx_flush(int cnum) /* We gotta steal this context */ for (i = tlb_nreserved; i < NTLB; i++) { if (tlb_info[i].ti_ctx == cnum) { - /* Can't steal ctx if it has a locked entry. */ - if (TLB_LOCKED(i)) { -#ifdef DIAGNOSTIC -printf("ctx_flush: can't invalidate " -"locked mapping %d for context %d\n", -i, cnum); -#ifdef DDB -Debugger(); -#endif -#endif -return 1; - } -#ifdef DIAGNOSTIC - if (i < tlb_nreserved) -panic("TLB entry %d not locked", i); -#endif + /* Can't steal ctx if it has locked/reserved entry. */ + KASSERTMSG(!TLB_LOCKED(i) && i >= tlb_nreserved, + "locked/reserved entry %d for ctx %d", + i, cnum); /* * Invalidate particular TLB entry regardless of * locked status @@ -1625,12 +1594,7 @@ ctx_alloc(struct pmap *pm) static int next = MINCTX; int cnum, s; - if (pm == pmap_kernel()) { -#ifdef DIAGNOSTIC - printf("ctx_alloc: kernel pmap!\n"); -#endif - return 0; - } + KASSERT(pm != pmap_kernel()); s = splvm(); @@ -1682,18 +1646,9 @@ ctx_free(struct pmap *pm) if (oldctx == 0) panic("ctx_free: freeing kernel context"); -#ifdef DIAGNOSTIC - if (ctxbusy[oldctx] == 0) - printf("ctx_free: freeing free context %d\n", oldctx); - if (ctxbusy[oldctx] != pm) { - printf("ctx_free: freeing someone esle's context\n " - "ctxbusy[%d] = %p, pm->pm_ctx = %p\n", - oldctx, (void *)(u_long)ctxbusy[oldctx], pm); -#ifdef DDB - Debugger(); -#endif - } -#endif + KASSERTMSG(ctxbusy[oldctx] == pm, + "ctxbusy[%d] = %p, pm->pm_ctx = %p", + oldctx, ctxbusy[oldctx], pm); /* We should verify it has not
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sat Sep 4 14:31:04 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: Style. No binary changes. Also, remove old #if-0'ed code block copied from oea (and therefore will never be enabled). To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.98 src/sys/arch/powerpc/ibm4xx/pmap.c:1.99 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.98 Thu Apr 15 00:00:46 2021 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Sat Sep 4 14:31:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.98 2021/04/15 00:00:46 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.99 2021/09/04 14:31:04 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.98 2021/04/15 00:00:46 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.99 2021/09/04 14:31:04 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -99,7 +99,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.9 * kernmap is an array of PTEs large enough to map in * 4GB. At 16KB/page it is 256K entries or 2MB. */ -#define KERNMAP_SIZE ((0xU/PAGE_SIZE)+1) +#define KERNMAP_SIZE ((0xU / PAGE_SIZE) + 1) void *kernmap; #define MINCTX 2 @@ -127,11 +127,11 @@ static int pmap_bootstrap_done = 0; /* Event counters */ struct evcnt tlbmiss_ev = EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, - NULL, "cpu", "tlbmiss"); +NULL, "cpu", "tlbmiss"); struct evcnt tlbflush_ev = EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, - NULL, "cpu", "tlbflush"); +NULL, "cpu", "tlbflush"); struct evcnt tlbenter_ev = EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, - NULL, "cpu", "tlbenter"); +NULL, "cpu", "tlbenter"); EVCNT_ATTACH_STATIC(tlbmiss_ev); EVCNT_ATTACH_STATIC(tlbflush_ev); EVCNT_ATTACH_STATIC(tlbenter_ev); @@ -229,8 +229,7 @@ pa_to_attr(paddr_t pa) static inline int pte_enter(struct pmap *pm, vaddr_t va, u_int pte) { - int seg = STIDX(va); - int ptn = PTIDX(va); + int seg = STIDX(va), ptn = PTIDX(va); u_int oldpte; if (!pm->pm_ptbl[seg]) { @@ -266,8 +265,7 @@ pte_enter(struct pmap *pm, vaddr_t va, u volatile u_int * pte_find(struct pmap *pm, vaddr_t va) { - int seg = STIDX(va); - int ptn = PTIDX(va); + int seg = STIDX(va), ptn = PTIDX(va); if (pm->pm_ptbl[seg]) return >pm_ptbl[seg][ptn]; @@ -296,9 +294,8 @@ pmap_bootstrap(u_int kernelstart, u_int /* * Initialize kernel page table. */ - for (i = 0; i < STSZ; i++) { + for (i = 0; i < STSZ; i++) pmap_kernel()->pm_ptbl[i] = NULL; - } ctxbusy[0] = ctxbusy[1] = pmap_kernel(); /* @@ -313,7 +310,7 @@ pmap_bootstrap(u_int kernelstart, u_int mem_regions(, ); for (mp = mem; mp->size; mp++) { physmem += btoc(mp->size); - printf("+%lx,",mp->size); + printf("+%lx,", mp->size); } printf("\n"); ppc4xx_tlb_init(); @@ -333,7 +330,7 @@ pmap_bootstrap(u_int kernelstart, u_int for (mp = avail; mp->size; mp++) { s = mp->start; e = mp->start + mp->size; - printf("%08x-%08x -> ",s,e); + printf("%08x-%08x -> ", s, e); /* * Check whether this region holds all of the kernel. */ @@ -366,14 +363,14 @@ pmap_bootstrap(u_int kernelstart, u_int if (e < s) e = s; sz = e - s; - printf("%08x-%08x = %x\n",s,e,sz); + printf("%08x-%08x = %x\n", s, e, sz); /* * Check whether some memory is left here. */ if (sz == 0) { - empty: + empty: memmove(mp, mp + 1, -(cnt - (mp - avail)) * sizeof *mp); + (cnt - (mp - avail)) * sizeof(*mp)); cnt--; mp--; continue; @@ -415,13 +412,13 @@ pmap_bootstrap(u_int kernelstart, u_int msgbuf_paddr = mp->start + mp->size - sz; mp->size -= sz; if (mp->size <= 0) - memmove(mp, mp + 1, (cnt - (mp - avail)) * sizeof *mp); + memmove(mp, mp + 1, (cnt - (mp - avail)) * sizeof(*mp)); #endif for (mp = avail; mp->size; mp++) uvm_page_physload(atop(mp->start), atop(mp->start + mp->size), - atop(mp->start), atop(mp->start + mp->size), - VM_FREELIST_DEFAULT); + atop(mp->start), atop(mp->start + mp->size), + VM_FREELIST_DEFAULT); /* * Initialize kernel pmap and hardware. @@ -468,14 +465,15 @@ pmap_init(void) struct pv_entry *pv; vsize_t sz; vaddr_t addr; - int i, s; - int bank; + int bank, i, s; char *attr; sz = (vsize_t)((sizeof(struct pv_entry) + 1) * npgs); sz = round_page(sz); addr = uvm_km_alloc(kernel_map, sz, 0, UVM_KMF_WIRED | UVM_KMF_ZERO); + s = splvm(); + pv = pv_table = (struct pv_entry *)addr; for (i = npgs; --i >= 0;) pv++->pv_pm = NULL; @@ -484,8 +482,7 @@ pmap_init(void) pv = pv_table; attr = pmap_attrib; - for (bank = uvm_physseg_get_first(); - uvm_physseg_valid_p(bank); + for (bank = uvm_physseg_get_first(); uvm_physseg_valid_p(bank); bank =
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sat Sep 4 14:31:04 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: Style. No binary changes. Also, remove old #if-0'ed code block copied from oea (and therefore will never be enabled). To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Thu Apr 15 00:00:46 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: Use uvm_km_alloc(9) with UVM_KMF_NOWAIT flag in pte_enter(), in order not to sleep in pmap_enter(9) and pmap_kenter_pa(9), which can result in dead lock. In most cases, pmap_enter(9) is used with PMAP_CANFAIL flag. In this case, if pte_enter() fails due to uvm_km_alloc(9), we can safely return ENOMEM. UVM layer will take care of it. uvm_km_alloc(9) fails for pmap_enter(9) without PMAP_CANFAIL or for pmap_kenter_pa(9), we have no choice but to panic there. However, my testbeds for 403 and 405 survive more than a week at least without hitting this panic. To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.97 src/sys/arch/powerpc/ibm4xx/pmap.c:1.98 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.97 Wed Apr 14 23:45:11 2021 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Thu Apr 15 00:00:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.97 2021/04/14 23:45:11 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.98 2021/04/15 00:00:46 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.97 2021/04/14 23:45:11 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.98 2021/04/15 00:00:46 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -236,11 +236,15 @@ pte_enter(struct pmap *pm, vaddr_t va, u if (!pm->pm_ptbl[seg]) { /* Don't allocate a page to clear a non-existent mapping. */ if (!pte) + return 1; + + vaddr_t km = uvm_km_alloc(kernel_map, PAGE_SIZE, 0, + UVM_KMF_WIRED | UVM_KMF_ZERO | UVM_KMF_NOWAIT); + + if (__predict_false(km == 0)) return 0; - /* Allocate a page this will sleep! */ - pm->pm_ptbl[seg] = - (uint *)uvm_km_alloc(kernel_map, PAGE_SIZE, 0, - UVM_KMF_WIRED | UVM_KMF_ZERO); + + pm->pm_ptbl[seg] = (u_int *)km; } oldpte = pm->pm_ptbl[seg][ptn]; pm->pm_ptbl[seg][ptn] = pte; @@ -862,7 +866,7 @@ pmap_enter(struct pmap *pm, vaddr_t va, if (!pmap_enter_pv(pm, va, pa, flags)) { /* Could not enter pv on a managed page */ - return 1; + return ENOMEM; } /* Now set attributes. */ @@ -880,7 +884,12 @@ pmap_enter(struct pmap *pm, vaddr_t va, s = splvm(); /* Insert page into page table. */ - pte_enter(pm, va, tte); + if (__predict_false(!pte_enter(pm, va, tte))) { + if (__predict_false((flags & PMAP_CANFAIL) == 0)) + panic("%s: pte_enter", __func__); + splx(s); + return ENOMEM; + } /* If this is a real fault, enter it in the tlb */ if (tte && ((flags & PMAP_WIRED) == 0)) { @@ -969,7 +978,8 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v s = splvm(); /* Insert page into page table. */ - pte_enter(pm, va, tte); + if (__predict_false(!pte_enter(pm, va, tte))) + panic("%s: pte_enter", __func__); splx(s); } @@ -978,7 +988,7 @@ pmap_kremove(vaddr_t va, vsize_t len) { while (len > 0) { - pte_enter(pmap_kernel(), va, 0); + (void)pte_enter(pmap_kernel(), va, 0); /* never fail */ va += PAGE_SIZE; len -= PAGE_SIZE; }
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Thu Apr 15 00:00:46 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: Use uvm_km_alloc(9) with UVM_KMF_NOWAIT flag in pte_enter(), in order not to sleep in pmap_enter(9) and pmap_kenter_pa(9), which can result in dead lock. In most cases, pmap_enter(9) is used with PMAP_CANFAIL flag. In this case, if pte_enter() fails due to uvm_km_alloc(9), we can safely return ENOMEM. UVM layer will take care of it. uvm_km_alloc(9) fails for pmap_enter(9) without PMAP_CANFAIL or for pmap_kenter_pa(9), we have no choice but to panic there. However, my testbeds for 403 and 405 survive more than a week at least without hitting this panic. To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Apr 14 23:45:11 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: Style fixes: - Add "static inline" to pte_enter(), to match with its declaration. - Remove parentheses from return. - Use NULL instead of 0 for pointer initialization. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.96 -r1.97 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.96 src/sys/arch/powerpc/ibm4xx/pmap.c:1.97 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.96 Tue Mar 30 03:15:53 2021 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Wed Apr 14 23:45:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.96 2021/03/30 03:15:53 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.97 2021/04/14 23:45:11 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.96 2021/03/30 03:15:53 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.97 2021/04/14 23:45:11 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -226,7 +226,7 @@ pa_to_attr(paddr_t pa) /* * Insert PTE into page table. */ -int +static inline int pte_enter(struct pmap *pm, vaddr_t va, u_int pte) { int seg = STIDX(va); @@ -236,7 +236,7 @@ pte_enter(struct pmap *pm, vaddr_t va, u if (!pm->pm_ptbl[seg]) { /* Don't allocate a page to clear a non-existent mapping. */ if (!pte) - return (0); + return 0; /* Allocate a page this will sleep! */ pm->pm_ptbl[seg] = (uint *)uvm_km_alloc(kernel_map, PAGE_SIZE, 0, @@ -253,7 +253,7 @@ pte_enter(struct pmap *pm, vaddr_t va, u else pm->pm_stats.resident_count++; } - return (1); + return 1; } /* @@ -266,9 +266,9 @@ pte_find(struct pmap *pm, vaddr_t va) int ptn = PTIDX(va); if (pm->pm_ptbl[seg]) - return (>pm_ptbl[seg][ptn]); + return >pm_ptbl[seg][ptn]; - return (NULL); + return NULL; } /* @@ -293,7 +293,7 @@ pmap_bootstrap(u_int kernelstart, u_int * Initialize kernel page table. */ for (i = 0; i < STSZ; i++) { - pmap_kernel()->pm_ptbl[i] = 0; + pmap_kernel()->pm_ptbl[i] = NULL; } ctxbusy[0] = ctxbusy[1] = pmap_kernel(); @@ -565,7 +565,7 @@ pmap_growkernel(vaddr_t maxkvaddr) pm->pm_ptbl[seg] = (u_int *)pg; } splx(s); - return (kbreak); + return kbreak; } /* @@ -758,7 +758,7 @@ pmap_enter_pv(struct pmap *pm, vaddr_t v pm->pm_stats.wired_count++; } splx(s); - return (1); + return 1; } static void @@ -1026,7 +1026,7 @@ pmap_extract(struct pmap *pm, vaddr_t va *pap = TTE_PA(pa) | (va & PGOFSET); } splx(s); - return (pa != 0); + return pa != 0; } /* @@ -1338,7 +1338,7 @@ ppc4xx_tlb_find_victim(void) tlb_info[tlbnext].ti_flags = flags; } else { /* Found it! */ -return (tlbnext); +return tlbnext; } } else { tlb_info[tlbnext].ti_flags = (flags & ~TLBF_REF); @@ -1428,9 +1428,9 @@ ppc4xx_tlb_size_mask(size_t size, int *m if (size <= tlbsize[i]) { *mask = (i << TLB_SIZE_SHFT); *rsiz = tlbsize[i]; - return (0); + return 0; } - return (EINVAL); + return EINVAL; } /* @@ -1470,10 +1470,10 @@ ppc4xx_tlb_mapiodev(paddr_t base, psize_ continue; va = (hi & TLB_EPN_MASK) + (base & (sz - 1)); /* sz = 2^n */ - return (void *)(va); + return (void *)va; } - return (NULL); + return NULL; } /* @@ -1579,7 +1579,7 @@ ctx_flush(int cnum) Debugger(); #endif #endif -return (1); +return 1; } #ifdef DIAGNOSTIC if (i < tlb_nreserved) @@ -1592,7 +1592,7 @@ ctx_flush(int cnum) tlb_invalidate_entry(i); } } - return (0); + return 0; } /* @@ -1610,7 +1610,7 @@ ctx_alloc(struct pmap *pm) #ifdef DIAGNOSTIC printf("ctx_alloc: kernel pmap!\n"); #endif - return (0); + return 0; } s = splvm();
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Apr 14 23:45:11 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: Style fixes: - Add "static inline" to pte_enter(), to match with its declaration. - Remove parentheses from return. - Use NULL instead of 0 for pointer initialization. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.96 -r1.97 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Tue Mar 30 14:33:10 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c Log Message: Use ``for (;;)'' for infinite loop, as required by style. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c diff -u src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.36 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.37 --- src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.36 Tue Mar 30 01:33:50 2021 +++ src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c Tue Mar 30 14:33:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ibm4xx_machdep.c,v 1.36 2021/03/30 01:33:50 rin Exp $ */ +/* $NetBSD: ibm4xx_machdep.c,v 1.37 2021/03/30 14:33:10 rin Exp $ */ /* Original: ibm40x_machdep.c,v 1.3 2005/01/17 17:19:36 shige Exp $ */ /* @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ibm4xx_machdep.c,v 1.36 2021/03/30 01:33:50 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibm4xx_machdep.c,v 1.37 2021/03/30 14:33:10 rin Exp $"); #include "ksyms.h" @@ -221,7 +221,7 @@ cpu_reboot(int howto, char *what) printf("ppc4xx_reset() failed!\n"); - while (1 /* CONSTCOND */) { + for (;;) { #if defined(DDB) Debugger(); #elif defined(KGDB)
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Tue Mar 30 14:33:10 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c Log Message: Use ``for (;;)'' for infinite loop, as required by style. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: simonb Date: Tue Mar 30 13:41:46 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: cpu.c Log Message: Fix nearly 20 year old type - cache sizes are 2048 bytes, not 2848 bytes. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/arch/powerpc/ibm4xx/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: simonb Date: Tue Mar 30 13:41:46 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: cpu.c Log Message: Fix nearly 20 year old type - cache sizes are 2048 bytes, not 2848 bytes. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/arch/powerpc/ibm4xx/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/cpu.c diff -u src/sys/arch/powerpc/ibm4xx/cpu.c:1.37 src/sys/arch/powerpc/ibm4xx/cpu.c:1.38 --- src/sys/arch/powerpc/ibm4xx/cpu.c:1.37 Tue Mar 30 02:27:00 2021 +++ src/sys/arch/powerpc/ibm4xx/cpu.c Tue Mar 30 13:41:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.37 2021/03/30 02:27:00 rin Exp $ */ +/* $NetBSD: cpu.c,v 1.38 2021/03/30 13:41:46 simonb Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.37 2021/03/30 02:27:00 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.38 2021/03/30 13:41:46 simonb Exp $"); #include #include @@ -66,7 +66,7 @@ static const struct cputab models[] = { .ci = { .dcache_size = 1024, .dcache_line_size = 16, - .icache_size = 2848, + .icache_size = 2048, .icache_line_size = 16, } }, { @@ -94,7 +94,7 @@ static const struct cputab models[] = { .mask = 0x, .name = "401D2", .ci = { - .dcache_size = 2848, + .dcache_size = 2048, .dcache_line_size = 16, .icache_size = 4096, .icache_line_size = 16, @@ -116,7 +116,7 @@ static const struct cputab models[] = { .ci = { .dcache_size = 2048, .dcache_line_size = 16, - .icache_size = 2848, + .icache_size = 2048, .icache_line_size = 16, } }, { @@ -124,7 +124,7 @@ static const struct cputab models[] = { .mask = 0x, .name = "401G2", .ci = { - .dcache_size = 2848, + .dcache_size = 2048, .dcache_line_size = 16, .icache_size = 8192, .icache_line_size = 16,
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Tue Mar 30 02:27:00 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: cpu.c Log Message: According to "PPC405GP Embedded Processor User’s Manual", 405GP has 16KB instruction cache, not 8KB. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/arch/powerpc/ibm4xx/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/cpu.c diff -u src/sys/arch/powerpc/ibm4xx/cpu.c:1.36 src/sys/arch/powerpc/ibm4xx/cpu.c:1.37 --- src/sys/arch/powerpc/ibm4xx/cpu.c:1.36 Fri Mar 5 07:11:24 2021 +++ src/sys/arch/powerpc/ibm4xx/cpu.c Tue Mar 30 02:27:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.36 2021/03/05 07:11:24 rin Exp $ */ +/* $NetBSD: cpu.c,v 1.37 2021/03/30 02:27:00 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.36 2021/03/05 07:11:24 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.37 2021/03/30 02:27:00 rin Exp $"); #include #include @@ -176,7 +176,7 @@ static const struct cputab models[] = { .ci = { .dcache_size = 8192, .dcache_line_size = 32, - .icache_size = 8192, + .icache_size = 16384, .icache_line_size = 32, } }, {
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Tue Mar 30 02:27:00 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: cpu.c Log Message: According to "PPC405GP Embedded Processor User’s Manual", 405GP has 16KB instruction cache, not 8KB. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/arch/powerpc/ibm4xx/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx/dev
Module Name:src Committed By: rin Date: Tue Mar 30 02:25:24 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx/dev: emacreg.h if_emac.c Log Message: Support OPB running @ 33MHz for 405GP based boards. No need to modify EMAC_MR1 register this case (STACR_OPBC fields are reserved for 405GP). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/ibm4xx/dev/emacreg.h cvs rdiff -u -r1.55 -r1.56 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/dev/emacreg.h diff -u src/sys/arch/powerpc/ibm4xx/dev/emacreg.h:1.4 src/sys/arch/powerpc/ibm4xx/dev/emacreg.h:1.5 --- src/sys/arch/powerpc/ibm4xx/dev/emacreg.h:1.4 Mon Jul 6 09:34:17 2020 +++ src/sys/arch/powerpc/ibm4xx/dev/emacreg.h Tue Mar 30 02:25:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: emacreg.h,v 1.4 2020/07/06 09:34:17 rin Exp $ */ +/* $NetBSD: emacreg.h,v 1.5 2021/03/30 02:25:24 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -215,6 +215,7 @@ #define STACR_PHYE 0x4000 /* PHY error */ #define STACR_WRITE 0x2000 /* STA command - write */ #define STACR_READ 0x1000 /* STA command - read */ +#define STACR_OPBC_33MHZ 0x0 /* - 33MHz */ #define STACR_OPBC_50MHZ 0x0 /* - 50MHz */ #define STACR_OPBC_66MHZ 0x1 /* - 66MHz */ #define STACR_OPBC_83MHZ 0x2 /* - 83MHz */ Index: src/sys/arch/powerpc/ibm4xx/dev/if_emac.c diff -u src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.55 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.56 --- src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.55 Sat Feb 27 20:43:58 2021 +++ src/sys/arch/powerpc/ibm4xx/dev/if_emac.c Tue Mar 30 02:25:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_emac.c,v 1.55 2021/02/27 20:43:58 rin Exp $ */ +/* $NetBSD: if_emac.c,v 1.56 2021/03/30 02:25:24 rin Exp $ */ /* * Copyright 2001, 2002 Wasabi Systems, Inc. @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.55 2021/02/27 20:43:58 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.56 2021/03/30 02:25:24 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_emac.h" @@ -456,6 +456,7 @@ emac_attach(device_t parent, device_t se opb_freq = opb_get_frequency(); switch (opb_freq) { + case : opbc = STACR_OPBC_33MHZ; break; case 5000: opbc = STACR_OPBC_50MHZ; break; case : opbc = STACR_OPBC_66MHZ; break; case 8333: opbc = STACR_OPBC_83MHZ; break;
CVS commit: src/sys/arch/powerpc/ibm4xx/dev
Module Name:src Committed By: rin Date: Tue Mar 30 02:25:24 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx/dev: emacreg.h if_emac.c Log Message: Support OPB running @ 33MHz for 405GP based boards. No need to modify EMAC_MR1 register this case (STACR_OPBC fields are reserved for 405GP). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/ibm4xx/dev/emacreg.h cvs rdiff -u -r1.55 -r1.56 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx/openbios
Module Name:src Committed By: rin Date: Tue Mar 30 01:57:20 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx/openbios: locore.S Log Message: Use mnemonic "bdneq". Add missing register prefix. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/powerpc/ibm4xx/openbios/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/openbios/locore.S diff -u src/sys/arch/powerpc/ibm4xx/openbios/locore.S:1.16 src/sys/arch/powerpc/ibm4xx/openbios/locore.S:1.17 --- src/sys/arch/powerpc/ibm4xx/openbios/locore.S:1.16 Sun Mar 7 02:54:06 2021 +++ src/sys/arch/powerpc/ibm4xx/openbios/locore.S Tue Mar 30 01:57:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.16 2021/03/07 02:54:06 simonb Exp $ */ +/* $NetBSD: locore.S,v 1.17 2021/03/30 01:57:20 rin Exp $ */ /* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */ /* @@ -95,11 +95,6 @@ #define BOARD_CFG_FP 0xFFFE0B50 /* - * Some instructions gas doesn't understand (yet?) - */ -#define bdneq bdnzf 2, - -/* * This symbol is here for the benefit of kvm_mkdb, and is supposed to * mark the start of kernel text. */ @@ -192,7 +187,7 @@ __start_cpu0: mtpid %r0 sync - INIT_CPUINFO(8,1,9,0) + INIT_CPUINFO(%r8,%r1,%r9,%r0) mr %r4,%r8 lis %r3,__start@ha
CVS commit: src/sys/arch/powerpc/ibm4xx/openbios
Module Name:src Committed By: rin Date: Tue Mar 30 01:57:20 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx/openbios: locore.S Log Message: Use mnemonic "bdneq". Add missing register prefix. No binary changes. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/powerpc/ibm4xx/openbios/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx/openbios
Module Name:src Committed By: rin Date: Tue Mar 30 01:50:13 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx/openbios: openbios.c Log Message: - Document IBM/AMCC Walnut is supported by this file. - Misc style fixes. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/powerpc/ibm4xx/openbios/openbios.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx/openbios
Module Name:src Committed By: rin Date: Tue Mar 30 01:50:13 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx/openbios: openbios.c Log Message: - Document IBM/AMCC Walnut is supported by this file. - Misc style fixes. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/powerpc/ibm4xx/openbios/openbios.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/openbios/openbios.c diff -u src/sys/arch/powerpc/ibm4xx/openbios/openbios.c:1.6 src/sys/arch/powerpc/ibm4xx/openbios/openbios.c:1.7 --- src/sys/arch/powerpc/ibm4xx/openbios/openbios.c:1.6 Tue Mar 30 01:47:45 2021 +++ src/sys/arch/powerpc/ibm4xx/openbios/openbios.c Tue Mar 30 01:50:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: openbios.c,v 1.6 2021/03/30 01:47:45 rin Exp $ */ +/* $NetBSD: openbios.c,v 1.7 2021/03/30 01:50:13 rin Exp $ */ /* * Copyright (c) 2004 Shigeyuki Fukushima. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: openbios.c,v 1.6 2021/03/30 01:47:45 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: openbios.c,v 1.7 2021/03/30 01:50:13 rin Exp $"); #include #include @@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: openbios.c,v * Board configuration structure from the OpenBIOS. * * Supported (XXX): + *IBM/AMCC Walnut PowerPC 405GP Evaluation Board *405GPr 1.2 ROM Monitor (5/25/02) */ struct board_bios_data { @@ -73,6 +74,7 @@ openbios_board_init(void *info_block) unsigned int openbios_board_memsize_get(void) { + return board_bios.mem_size; } @@ -142,7 +144,6 @@ openbios_board_info_set(void) prop_object_release(pn); } - void openbios_board_print(void) {
CVS commit: src/sys/arch/powerpc/ibm4xx/openbios
Module Name:src Committed By: simonb Date: Sun Mar 7 02:54:07 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx/openbios: locore.S Log Message: Remove unused/unreferenced legacy intrcnt/intrnames. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/ibm4xx/openbios/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/openbios/locore.S diff -u src/sys/arch/powerpc/ibm4xx/openbios/locore.S:1.15 src/sys/arch/powerpc/ibm4xx/openbios/locore.S:1.16 --- src/sys/arch/powerpc/ibm4xx/openbios/locore.S:1.15 Mon Jul 6 10:48:54 2020 +++ src/sys/arch/powerpc/ibm4xx/openbios/locore.S Sun Mar 7 02:54:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.15 2020/07/06 10:48:54 rin Exp $ */ +/* $NetBSD: locore.S,v 1.16 2021/03/07 02:54:06 simonb Exp $ */ /* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */ /* @@ -100,27 +100,6 @@ #define bdneq bdnzf 2, /* - * Globals - */ -GLOBAL(intrnames) - .asciz "clock", "irq1", "irq2", "irq3" - .asciz "irq4", "irq5", "irq6", "irq7" - .asciz "irq8", "irq9", "irq10", "irq11" - .asciz "irq12", "irq13", "irq14", "irq15" - .asciz "irq16", "irq17", "irq18", "irq19" - .asciz "irq20", "irq21", "irq22", "irq23" - .asciz "irq24", "irq25", "irq26", "irq27" - .asciz "irq28", "softnet", "softclock", "softserial" - .asciz "statclock" -GLOBAL(eintrnames) - .align 4 -GLOBAL(intrcnt) - .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .long 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .long 0 -GLOBAL(eintrcnt) - -/* * This symbol is here for the benefit of kvm_mkdb, and is supposed to * mark the start of kernel text. */
CVS commit: src/sys/arch/powerpc/ibm4xx/openbios
Module Name:src Committed By: simonb Date: Sun Mar 7 02:54:07 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx/openbios: locore.S Log Message: Remove unused/unreferenced legacy intrcnt/intrnames. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/ibm4xx/openbios/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Fri Mar 5 07:11:24 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: cpu.c Log Message: Show PVR as 8-digit hex. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/powerpc/ibm4xx/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/cpu.c diff -u src/sys/arch/powerpc/ibm4xx/cpu.c:1.35 src/sys/arch/powerpc/ibm4xx/cpu.c:1.36 --- src/sys/arch/powerpc/ibm4xx/cpu.c:1.35 Fri Mar 5 07:10:27 2021 +++ src/sys/arch/powerpc/ibm4xx/cpu.c Fri Mar 5 07:11:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.35 2021/03/05 07:10:27 rin Exp $ */ +/* $NetBSD: cpu.c,v 1.36 2021/03/05 07:11:24 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.35 2021/03/05 07:10:27 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.36 2021/03/05 07:11:24 rin Exp $"); #include #include @@ -292,7 +292,7 @@ cpuattach(device_t parent, device_t self if (__predict_false(cp->name == NULL)) cpu_setmodel("Version 0x%x", pvr); - aprint_normal(": %uMHz %s (PVR 0x%x)\n", + aprint_normal(": %uMHz %s (PVR 0x%08x)\n", (processor_freq + 50) / 100, (cp->name != NULL ? cpu_getmodel() : "unknown model"), pvr);
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Fri Mar 5 07:11:24 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: cpu.c Log Message: Show PVR as 8-digit hex. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/powerpc/ibm4xx/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Fri Mar 5 05:35:50 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pic_uic.c Log Message: Fix hard freeze in pic_handle_intr() for PPC_IBM403. Not clearly documented in reference manual, but DCR_EXISR register is not updated immediately after some bits are cleared by mtdcr, no matter whether sync (= eieio) and/or isync are issued. Therefore, we have to manage our own status mask in the interrupt handler. This is what we did in obsoleted powerpc/ibm4xx/intr.c. With this change, my Explora 451 works just fine with serial console! Fix for framebuffer console will be committed soon. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/ibm4xx/pic_uic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Fri Mar 5 05:35:50 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pic_uic.c Log Message: Fix hard freeze in pic_handle_intr() for PPC_IBM403. Not clearly documented in reference manual, but DCR_EXISR register is not updated immediately after some bits are cleared by mtdcr, no matter whether sync (= eieio) and/or isync are issued. Therefore, we have to manage our own status mask in the interrupt handler. This is what we did in obsoleted powerpc/ibm4xx/intr.c. With this change, my Explora 451 works just fine with serial console! Fix for framebuffer console will be committed soon. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/ibm4xx/pic_uic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pic_uic.c diff -u src/sys/arch/powerpc/ibm4xx/pic_uic.c:1.8 src/sys/arch/powerpc/ibm4xx/pic_uic.c:1.9 --- src/sys/arch/powerpc/ibm4xx/pic_uic.c:1.8 Sat Feb 27 20:43:58 2021 +++ src/sys/arch/powerpc/ibm4xx/pic_uic.c Fri Mar 5 05:35:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pic_uic.c,v 1.8 2021/02/27 20:43:58 rin Exp $ */ +/* $NetBSD: pic_uic.c,v 1.9 2021/03/05 05:35:50 rin Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pic_uic.c,v 1.8 2021/02/27 20:43:58 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pic_uic.c,v 1.9 2021/03/05 05:35:50 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ppcarch.h" @@ -73,6 +73,19 @@ static void uic_establish_irq(struct pic struct uic { uint32_t uic_intr_enable; /* cached intr enable mask */ +#ifdef PPC_IBM403 + /* + * Not clearly documented in reference manual, but DCR_EXISR + * register is not updated immediately after some bits are + * cleared by mtdcr, no matter whether sync (= eieio) and/or + * isync are issued. + * + * Therefore, we have to manage our own status mask in the + * interrupt handler; see uic_{ack,get}_irq() for more details. + * This is what we did in obsoleted powerpc/ibm4xx/intr.c. + */ + uint32_t uic_intr_status; +#endif uint32_t (*uic_mf_intr_status)(void); uint32_t (*uic_mf_intr_enable)(void); void (*uic_mt_intr_enable)(uint32_t); @@ -356,15 +369,26 @@ uic_ack_irq(struct pic_ops *pic, int irq struct uic * const uic = pic->pic_cookie; const uint32_t irqmask = IRQ_TO_MASK(irq); +#ifdef PPC_IBM403 + uic->uic_intr_status &= ~irqmask; +#endif + (*uic->uic_mt_intr_ack)(irqmask); } static int -uic_get_irq(struct pic_ops *pic, int dummy) +uic_get_irq(struct pic_ops *pic, int req) { struct uic * const uic = pic->pic_cookie; +#ifdef PPC_IBM403 + if (req == PIC_GET_IRQ) + uic->uic_intr_status = (*uic->uic_mf_intr_status)(); + const uint32_t irqmask = uic->uic_intr_status; +#else const uint32_t irqmask = (*uic->uic_mf_intr_status)(); +#endif + if (irqmask == 0) return 255; return IRQ_OF_MASK(irqmask);
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sat Feb 27 20:43:58 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pic_uic.c src/sys/arch/powerpc/ibm4xx/dev: com_opb.c dwctwo_plb.c ecc_plb.c if_emac.c mal.c Log Message: Switch to intr_establish_xname(). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/ibm4xx/pic_uic.c cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/ibm4xx/dev/com_opb.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c cvs rdiff -u -r1.54 -r1.55 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/ibm4xx/dev/mal.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pic_uic.c diff -u src/sys/arch/powerpc/ibm4xx/pic_uic.c:1.7 src/sys/arch/powerpc/ibm4xx/pic_uic.c:1.8 --- src/sys/arch/powerpc/ibm4xx/pic_uic.c:1.7 Mon Jul 6 10:35:28 2020 +++ src/sys/arch/powerpc/ibm4xx/pic_uic.c Sat Feb 27 20:43:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pic_uic.c,v 1.7 2020/07/06 10:35:28 rin Exp $ */ +/* $NetBSD: pic_uic.c,v 1.8 2021/02/27 20:43:58 rin Exp $ */ /* * Copyright 2002 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pic_uic.c,v 1.7 2020/07/06 10:35:28 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pic_uic.c,v 1.8 2021/02/27 20:43:58 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ppcarch.h" @@ -217,7 +217,8 @@ extern struct pic_ops pic_uic1; static void uic1_finish_setup(struct pic_ops *pic) { - intr_establish(30, IST_LEVEL, IPL_HIGH, pic_handle_intr, _uic1); + intr_establish_xname(30, IST_LEVEL, IPL_HIGH, pic_handle_intr, + _uic1, "uic1"); } struct uic uic1 = { @@ -272,7 +273,8 @@ extern struct pic_ops pic_uic2; static void uic2_finish_setup(struct pic_ops *pic) { - intr_establish(28, IST_LEVEL, IPL_HIGH, pic_handle_intr, _uic2); + intr_establish_xname(28, IST_LEVEL, IPL_HIGH, pic_handle_intr, + _uic2, "uic2"); } static struct uic uic2 = { Index: src/sys/arch/powerpc/ibm4xx/dev/com_opb.c diff -u src/sys/arch/powerpc/ibm4xx/dev/com_opb.c:1.24 src/sys/arch/powerpc/ibm4xx/dev/com_opb.c:1.25 --- src/sys/arch/powerpc/ibm4xx/dev/com_opb.c:1.24 Mon Jul 6 09:34:17 2020 +++ src/sys/arch/powerpc/ibm4xx/dev/com_opb.c Sat Feb 27 20:43:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: com_opb.c,v 1.24 2020/07/06 09:34:17 rin Exp $ */ +/* $NetBSD: com_opb.c,v 1.25 2021/02/27 20:43:58 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: com_opb.c,v 1.24 2020/07/06 09:34:17 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: com_opb.c,v 1.25 2021/02/27 20:43:58 rin Exp $"); #include "com.h" @@ -133,7 +133,8 @@ com_opb_attach(device_t parent, device_t com_attach_subr(sc); - intr_establish(oaa->opb_irq, IST_LEVEL, IPL_SERIAL, comintr, sc); + intr_establish_xname(oaa->opb_irq, IST_LEVEL, IPL_SERIAL, comintr, sc, + device_xname(self)); } /* Index: src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c diff -u src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c:1.5 src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c:1.6 --- src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c:1.5 Sat Apr 23 10:15:30 2016 +++ src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c Sat Feb 27 20:43:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwctwo_plb.c,v 1.5 2016/04/23 10:15:30 skrll Exp $ */ +/* $NetBSD: dwctwo_plb.c,v 1.6 2021/02/27 20:43:58 rin Exp $ */ /* * Copyright (c) 2013 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwctwo_plb.c,v 1.5 2016/04/23 10:15:30 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwctwo_plb.c,v 1.6 2021/02/27 20:43:58 rin Exp $"); #include #include @@ -112,7 +112,8 @@ dwctwo_plb_attach(device_t parent, devic bus_space_map(sc->sc_iot, paa->plb_addr, DWCTWO_SIZE, 0, >sc_ioh); sc->sc_bus.ub_dmatag = paa->plb_dmat; - intr_establish(paa->plb_irq, IST_LEVEL, IPL_VM, dwc2_intr, sc); + intr_establish_xname(paa->plb_irq, IST_LEVEL, IPL_VM, dwc2_intr, sc, + device_xname(self)); /* Enable the USB interface. */ mtsdr(DCR_SDR0_PFC1, mfsdr(DCR_SDR0_PFC1) | SDR0_PFC1_USBEN); Index: src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c diff -u src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c:1.15 src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c:1.16 --- src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c:1.15 Tue Feb 25 14:09:13 2014 +++ src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c Sat Feb 27 20:43:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ecc_plb.c,v 1.15 2014/02/25 14:09:13 martin Exp $ */ +/* $NetBSD: ecc_plb.c,v 1.16 2021/02/27 20:43:58 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ecc_plb.c,v 1.15 2014/02/25 14:09:13 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ecc_plb.c,v 1.16 2021/02/27 20:43:58 rin Exp $");
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Sat Feb 27 20:43:58 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: pic_uic.c src/sys/arch/powerpc/ibm4xx/dev: com_opb.c dwctwo_plb.c ecc_plb.c if_emac.c mal.c Log Message: Switch to intr_establish_xname(). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/ibm4xx/pic_uic.c cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/ibm4xx/dev/com_opb.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/ibm4xx/dev/ecc_plb.c cvs rdiff -u -r1.54 -r1.55 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/ibm4xx/dev/mal.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx/dev
Module Name:src Committed By: rin Date: Sun Jan 24 05:22:22 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx/dev: if_emac.c Log Message: Add rnd(9) support. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/dev/if_emac.c diff -u src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.53 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.54 --- src/sys/arch/powerpc/ibm4xx/dev/if_emac.c:1.53 Mon Jul 6 09:34:17 2020 +++ src/sys/arch/powerpc/ibm4xx/dev/if_emac.c Sun Jan 24 05:22:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_emac.c,v 1.53 2020/07/06 09:34:17 rin Exp $ */ +/* $NetBSD: if_emac.c,v 1.54 2021/01/24 05:22:21 rin Exp $ */ /* * Copyright 2001, 2002 Wasabi Systems, Inc. @@ -52,7 +52,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.53 2020/07/06 09:34:17 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.54 2021/01/24 05:22:21 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_emac.h" @@ -67,6 +67,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_emac.c,v #include #include +#include + #include /* for PAGE_SIZE */ #include @@ -210,6 +212,8 @@ struct emac_softc { int sc_rxptr; /* next ready RX descriptor/descsoft */ + krndsource_t rnd_source; /* random source */ + void (*sc_rmii_enable)(device_t, int); /* reduced MII enable */ void (*sc_rmii_disable)(device_t, int); /* reduced MII disable*/ void (*sc_rmii_speed)(device_t, int, int); /* reduced MII speed */ @@ -555,6 +559,9 @@ emac_attach(device_t parent, device_t se if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, enaddr); + rnd_attach_source(>rnd_source, xname, RND_TYPE_NET, + RND_FLAG_DEFAULT); + #ifdef EMAC_EVENT_COUNTERS /* * Attach the event counters. @@ -1254,13 +1261,14 @@ emac_txreap(struct emac_softc *sc) struct ifnet *ifp = >sc_ethercom.ec_if; struct emac_txsoft *txs; int handled, i; - uint32_t txstat; + uint32_t txstat, count; EMAC_EVCNT_INCR(>sc_ev_txreap); handled = 0; ifp->if_flags &= ~IFF_OACTIVE; + count = 0; /* * Go through our Tx list and free mbufs for those * frames that have been transmitted. @@ -1317,6 +1325,8 @@ emac_txreap(struct emac_softc *sc) bus_dmamap_unload(sc->sc_dmat, txs->txs_dmamap); m_freem(txs->txs_mbuf); txs->txs_mbuf = NULL; + + count++; } /* Update the dirty transmit buffer pointer. */ @@ -1329,6 +1339,9 @@ emac_txreap(struct emac_softc *sc) if (sc->sc_txsfree == EMAC_TXQUEUELEN) ifp->if_timer = 0; + if (count != 0) + rnd_add_uint32(>rnd_source, count); + return handled; } @@ -1582,11 +1595,12 @@ emac_rxeob_intr(void *arg) struct ifnet *ifp = >sc_ethercom.ec_if; struct emac_rxsoft *rxs; struct mbuf *m; - uint32_t rxstat; + uint32_t rxstat, count; int i, len; EMAC_EVCNT_INCR(>sc_ev_rxintr); + count = 0; for (i = sc->sc_rxptr; ; i = EMAC_NEXTRX(i)) { rxs = >sc_rxsoft[i]; @@ -1681,11 +1695,16 @@ emac_rxeob_intr(void *arg) /* Pass it on. */ if_percpuq_enqueue(ifp->if_percpuq, m); + + count++; } /* Update the receive pointer. */ sc->sc_rxptr = i; + if (count != 0) + rnd_add_uint32(>rnd_source, count); + return 1; }
CVS commit: src/sys/arch/powerpc/ibm4xx/dev
Module Name:src Committed By: rin Date: Sun Jan 24 05:22:22 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx/dev: if_emac.c Log Message: Add rnd(9) support. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/arch/powerpc/ibm4xx/dev/if_emac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/arch/powerpc/ibm4xx
On 2021/01/18 14:49, Rin Okuyama wrote: (2) However, in clock.c rev 1.31 and prior, curcpu->ci_idepth was not raised before calling {hard,stat}clock(). Therefore, cpu_intr_p() wrongly returns false. As a result, callee functions misunderstood that they are not running in the interrupt context. 1.31 --> 1.30 Sorry for bothering you many times... rin
Re: CVS commit: src/sys/arch/powerpc/ibm4xx
On 2021/01/18 13:35, Rin Okuyama wrote: Module Name:src Committed By: rin Date: Mon Jan 18 04:35:05 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: clock.c Log Message: Invoke hardclock() and statclock() in the interrupt context. Otherwise, entropy_enter() is used instead of entropy_enter_intr() in statclock(), which results in KASSERT() failure. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/ibm4xx/clock.c This message is somewhat misleading. I meant: (1) Callers are interrupt handlers, therefore, {hard,stat}clock() are apparently invoked in the interrupt context. (2) However, in clock.c rev 1.31 and prior, curcpu->ci_idepth was not raised before calling {hard,stat}clock(). Therefore, cpu_intr_p() wrongly returns false. As a result, callee functions misunderstood that they are not running in the interrupt context. I have to improve my English writing skills ;-). Thanks, rin
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Jan 18 04:35:05 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: clock.c Log Message: Invoke hardclock() and statclock() in the interrupt context. Otherwise, entropy_enter() is used instead of entropy_enter_intr() in statclock(), which results in KASSERT() failure. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/ibm4xx/clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Jan 18 04:35:05 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: clock.c Log Message: Invoke hardclock() and statclock() in the interrupt context. Otherwise, entropy_enter() is used instead of entropy_enter_intr() in statclock(), which results in KASSERT() failure. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/ibm4xx/clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/clock.c diff -u src/sys/arch/powerpc/ibm4xx/clock.c:1.30 src/sys/arch/powerpc/ibm4xx/clock.c:1.31 --- src/sys/arch/powerpc/ibm4xx/clock.c:1.30 Mon Jan 18 04:30:12 2021 +++ src/sys/arch/powerpc/ibm4xx/clock.c Mon Jan 18 04:35:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.30 2021/01/18 04:30:12 rin Exp $ */ +/* $NetBSD: clock.c,v 1.31 2021/01/18 04:35:04 rin Exp $ */ /* $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $ */ /* @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.30 2021/01/18 04:30:12 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.31 2021/01/18 04:35:04 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ppcarch.h" @@ -104,8 +104,11 @@ stat_intr(struct clockframe *frame) */ __asm volatile ("wrteei 1"); - if (IPL_CLOCK > s) + if (IPL_CLOCK > s) { + ci->ci_idepth++; statclock(frame); + ci->ci_idepth--; + } splx(s); } @@ -156,8 +159,10 @@ decr_intr(struct clockframe *frame) /* * Do standard timer interrupt stuff. */ + ci->ci_idepth++; while (nticks-- > 0) hardclock(frame); + ci->ci_idepth--; } splx(pcpl); }
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Jan 18 04:30:13 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: clock.c Log Message: Simplify and correct stale comment; nticks-th hardclock() had no longer been special since rev 1.24: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/clock.c#rev1.24 No functional changes intended. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/powerpc/ibm4xx/clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Jan 18 04:30:13 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: clock.c Log Message: Simplify and correct stale comment; nticks-th hardclock() had no longer been special since rev 1.24: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/clock.c#rev1.24 No functional changes intended. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/powerpc/ibm4xx/clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/clock.c diff -u src/sys/arch/powerpc/ibm4xx/clock.c:1.29 src/sys/arch/powerpc/ibm4xx/clock.c:1.30 --- src/sys/arch/powerpc/ibm4xx/clock.c:1.29 Mon Jul 6 10:31:23 2020 +++ src/sys/arch/powerpc/ibm4xx/clock.c Mon Jan 18 04:30:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.29 2020/07/06 10:31:23 rin Exp $ */ +/* $NetBSD: clock.c,v 1.30 2021/01/18 04:30:12 rin Exp $ */ /* $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $ */ /* @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.29 2020/07/06 10:31:23 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.30 2021/01/18 04:30:12 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ppcarch.h" @@ -155,11 +155,9 @@ decr_intr(struct clockframe *frame) /* * Do standard timer interrupt stuff. - * Do softclock stuff only on the last iteration. */ - while (--nticks > 0) + while (nticks-- > 0) hardclock(frame); - hardclock(frame); } splx(pcpl); }
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Jan 18 02:43:27 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c Log Message: white space --> tab To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c diff -u src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.33 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.34 --- src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.33 Wed Jan 6 08:07:36 2021 +++ src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c Mon Jan 18 02:43:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ibm4xx_machdep.c,v 1.33 2021/01/06 08:07:36 rin Exp $ */ +/* $NetBSD: ibm4xx_machdep.c,v 1.34 2021/01/18 02:43:27 rin Exp $ */ /* Original: ibm40x_machdep.c,v 1.3 2005/01/17 17:19:36 shige Exp $ */ /* @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ibm4xx_machdep.c,v 1.33 2021/01/06 08:07:36 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibm4xx_machdep.c,v 1.34 2021/01/18 02:43:27 rin Exp $"); #include "ksyms.h" @@ -208,7 +208,7 @@ ibm4xx_init(vaddr_t startkernel, vaddr_t * external interrupt handler install */ if (handler) - ibm4xx_install_extint(handler); + ibm4xx_install_extint(handler); /* * Now enable translation (and machine checks/recoverable interrupts).
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Mon Jan 18 02:43:27 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c Log Message: white space --> tab To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Jan 6 08:07:36 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c Log Message: Sort headers. No functional changes intended. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c diff -u src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.32 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.33 --- src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.32 Mon Jul 6 13:10:19 2020 +++ src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c Wed Jan 6 08:07:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ibm4xx_machdep.c,v 1.32 2020/07/06 13:10:19 rin Exp $ */ +/* $NetBSD: ibm4xx_machdep.c,v 1.33 2021/01/06 08:07:36 rin Exp $ */ /* Original: ibm40x_machdep.c,v 1.3 2005/01/17 17:19:36 shige Exp $ */ /* @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ibm4xx_machdep.c,v 1.32 2020/07/06 13:10:19 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibm4xx_machdep.c,v 1.33 2021/01/06 08:07:36 rin Exp $"); #include "ksyms.h" @@ -79,10 +79,10 @@ __KERNEL_RCSID(0, "$NetBSD: ibm4xx_machd #endif #include -#include -#include #include #include +#include +#include #include @@ -96,13 +96,13 @@ __KERNEL_RCSID(0, "$NetBSD: ibm4xx_machd #endif #include -#include #include +#include #include -#include #include +#include /* * Global variables used here and there
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Wed Jan 6 08:07:36 UTC 2021 Modified Files: src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c Log Message: Sort headers. No functional changes intended. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Thu Sep 10 04:36:24 UTC 2020 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: Tiny cosmetic fix for previous. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/powerpc/ibm4xx/pmap.c diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.94 src/sys/arch/powerpc/ibm4xx/pmap.c:1.95 --- src/sys/arch/powerpc/ibm4xx/pmap.c:1.94 Thu Sep 10 04:31:55 2020 +++ src/sys/arch/powerpc/ibm4xx/pmap.c Thu Sep 10 04:36:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.94 2020/09/10 04:31:55 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.95 2020/09/10 04:36:24 rin Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.94 2020/09/10 04:31:55 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.95 2020/09/10 04:36:24 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1160,9 +1160,9 @@ pmap_deactivate(struct lwp *l) void pmap_procwr(struct proc *p, vaddr_t va, size_t len) { + struct pmap *pm = p->p_vmspace->vm_map.pmap; if (__predict_true(p == curproc)) { - struct pmap *pm = p->p_vmspace->vm_map.pmap; int msr, ctx, opid; /* @@ -1203,7 +1203,6 @@ pmap_procwr(struct proc *p, vaddr_t va, : "=" (msr), "=" (opid) : "r" (ctx), "r" (va), "r" (len), "r" (CACHELINESIZE)); } else { - struct pmap *pm = p->p_vmspace->vm_map.pmap; paddr_t pa; vaddr_t tva, eva; int tlen;
CVS commit: src/sys/arch/powerpc/ibm4xx
Module Name:src Committed By: rin Date: Thu Sep 10 04:36:24 UTC 2020 Modified Files: src/sys/arch/powerpc/ibm4xx: pmap.c Log Message: Tiny cosmetic fix for previous. No functional changes. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/arch/powerpc/ibm4xx/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.