CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: andvar Date: Fri Aug 13 20:19:45 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: fix multiple typos in comments. To generate a diff of this commit: cvs rdiff -u -r1.300 -r1.301 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.300 src/sys/arch/alpha/alpha/pmap.c:1.301 --- src/sys/arch/alpha/alpha/pmap.c:1.300 Sat Jul 31 14:51:25 2021 +++ src/sys/arch/alpha/alpha/pmap.c Fri Aug 13 20:19:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.300 2021/07/31 14:51:25 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.301 2021/08/13 20:19:45 andvar Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -106,8 +106,8 @@ * * All user page table access is done via K0SEG. Kernel * page table access is done via the recursive Virtual Page - * Table becase kernel PT pages are pre-allocated and never - * freed, so no VPT fault handling is requiried. + * Table because kernel PT pages are pre-allocated and never + * freed, so no VPT fault handling is required. */ /* @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.300 2021/07/31 14:51:25 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.301 2021/08/13 20:19:45 andvar Exp $"); #include #include @@ -578,9 +578,9 @@ pmap_pvlist_free(struct pmap_pvlist * co * that includes room for 8 VAs, the pmap the VAs belong to, a bitmap of * CPUs to be notified, and a list for PT pages that are freed during * removal off mappings. The number of valid addresses in the list as - * well as flags are sqeezed into the lower bits of the first two VAs. + * well as flags are squeezed into the lower bits of the first two VAs. * Storage for this structure is allocated on the stack. We need to be - * careful to keep the size of this struture under control. + * careful to keep the size of this structure under control. * * When notifying remote CPUs, we acquire the tlb_lock (which also * blocks IPIs), record the pointer to our context structure, set a @@ -589,9 +589,9 @@ pmap_pvlist_free(struct pmap_pvlist * co * any invalidations necessary on the local CPU. Once that is done, * we then wait the the global context pointer to be cleared, which * will be done by the final remote CPU to complete their work. This - * method reduces cache line contention during pocessing. + * method reduces cache line contention during processing. * - * When removing mappings in user pmaps, this implemention frees page + * When removing mappings in user pmaps, this implementation frees page * table pages back to the VM system once they contain no valid mappings. * As we do this, we must ensure to invalidate TLB entries that the * CPU might hold for the respective recursive VPT mappings. This must @@ -1038,7 +1038,7 @@ pmap_tlb_shootnow(const struct pmap_tlb_ /* * Figure out who to notify. If it's for the kernel or - * multiple aaddress spaces, we notify everybody. If + * multiple address spaces, we notify everybody. If * it's a single user pmap, then we try to acquire the * activation lock so we can get an accurate accounting * of who needs to be notified. If we can't acquire @@ -2094,7 +2094,7 @@ pmap_enter_tlb_shootdown(pmap_t const pm * pmap_enter_l2pt_delref: * * Release a reference on an L2 PT page for pmap_enter(). - * This is factored out separately becacause we expect it + * This is factored out separately because we expect it * to be a rare case. */ static void __noinline @@ -2105,7 +2105,7 @@ pmap_enter_l2pt_delref(pmap_t const pmap /* * PALcode may have tried to service a TLB miss with - * this L2 PTE, so we need to make sure we don't actully + * this L2 PTE, so we need to make sure we don't actually * free the PT page untl we've shot down any TLB entries * for this VPT index. */ @@ -2122,7 +2122,7 @@ pmap_enter_l2pt_delref(pmap_t const pmap * pmap_enter_l3pt_delref: * * Release a reference on an L3 PT page for pmap_enter(). - * This is factored out separately becacause we expect it + * This is factored out separately because we expect it * to be a rare case. */ static void __noinline @@ -2133,8 +2133,8 @@ pmap_enter_l3pt_delref(pmap_t const pmap /* * PALcode may have tried to service a TLB miss with - * this PTE, so we need to make sure we don't actully - * free the PT page untl we've shot down any TLB entries + * this PTE, so we need to make sure we don't actually + * free the PT page until we've shot down any TLB entries * for this VPT index. */ @@ -2256,7 +2256,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd * new one immediately. */ if ((opte & PG_V) == 0) { - /* No TLB invalidatons needed for new mappings. */ + /* No TLB
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat Jul 31 14:51:25 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Fix a silly mistake (missing return) in the DEBUG case of the kernel pmap case of pmap_extract(). To generate a diff of this commit: cvs rdiff -u -r1.299 -r1.300 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.299 src/sys/arch/alpha/alpha/pmap.c:1.300 --- src/sys/arch/alpha/alpha/pmap.c:1.299 Mon Jul 19 16:31:19 2021 +++ src/sys/arch/alpha/alpha/pmap.c Sat Jul 31 14:51:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.299 2021/07/19 16:31:19 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.300 2021/07/31 14:51:25 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.299 2021/07/19 16:31:19 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.300 2021/07/31 14:51:25 thorpej Exp $"); #include #include @@ -2587,6 +2587,7 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa printf("failed (kernel vtophys)\n"); } } + return address_is_valid; #else return vtophys_internal(va, pap); #endif
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Jul 23 04:19:50 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: trap.c Log Message: Emulate the IEEE flavors of the FIX extension instructions: - FTOIS, FTOIT - ITOFS, ITOFT - SRQTS, SQRTT Left out for now are the VAX FP flavors: - ITOFF - SQRTF, SQRTG To generate a diff of this commit: cvs rdiff -u -r1.137 -r1.138 src/sys/arch/alpha/alpha/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/alpha/alpha/trap.c diff -u src/sys/arch/alpha/alpha/trap.c:1.137 src/sys/arch/alpha/alpha/trap.c:1.138 --- src/sys/arch/alpha/alpha/trap.c:1.137 Tue Jul 20 01:56:06 2021 +++ src/sys/arch/alpha/alpha/trap.c Fri Jul 23 04:19:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.137 2021/07/20 01:56:06 thorpej Exp $ */ +/* $NetBSD: trap.c,v 1.138 2021/07/23 04:19:50 thorpej Exp $ */ /*- * Copyright (c) 2000, 2001, 2021 The NetBSD Foundation, Inc. @@ -95,7 +95,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.137 2021/07/20 01:56:06 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.138 2021/07/23 04:19:50 thorpej Exp $"); #include #include @@ -383,6 +383,8 @@ trap(const u_long a0, const u_long a1, c ksi.ksi_code = SEGV_MAPERR; else if (i == SIGILL) ksi.ksi_code = ILL_ILLOPC; + else if (i == SIGFPE) +ksi.ksi_code = alpha_ucode_to_ksiginfo(ucode); ksi.ksi_signo = i; ksi.ksi_addr = (void *)l->l_md.md_tf->tf_regs[FRAME_PC]; @@ -961,6 +963,128 @@ unaligned_fixup(u_long va, u_long opcode return (signo); } +#define EMUL_COUNT(ev) atomic_inc_64(&(ev).ev_count) + +static struct evcnt emul_fix_ftoit = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul fix", "ftoit"); +static struct evcnt emul_fix_ftois = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul fix", "ftois"); +static struct evcnt emul_fix_itofs = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul fix", "itofs"); +#if 0 +static struct evcnt emul_fix_itoff = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul fix", "itoff"); +#endif +static struct evcnt emul_fix_itoft = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul fix", "itoft"); +static struct evcnt emul_fix_sqrtt = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul fix", "sqrtt"); +static struct evcnt emul_fix_sqrts = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul fix", "sqrts"); + +EVCNT_ATTACH_STATIC(emul_fix_ftoit); +EVCNT_ATTACH_STATIC(emul_fix_ftois); +EVCNT_ATTACH_STATIC(emul_fix_itofs); +#if 0 +EVCNT_ATTACH_STATIC(emul_fix_itoff); +#endif +EVCNT_ATTACH_STATIC(emul_fix_itoft); +EVCNT_ATTACH_STATIC(emul_fix_sqrtt); +EVCNT_ATTACH_STATIC(emul_fix_sqrts); + +static void +emul_fix(struct lwp *l, const alpha_instruction *inst) +{ + union { + f_float f; + s_float s; + t_float t; + } fmem; + register_t *regptr; + + KASSERT(l == curlwp); + + /* + * FIX instructions don't cause any exceptions, including + * MM exceptions. However, they are equivalent in result + * to e.g. STL,LDF. We will just assume that we can access + * our kernel stack, and thus no exception checks are + * required. + */ + + kpreempt_disable(); + if ((l->l_md.md_flags & MDLWP_FPACTIVE) == 0) { + fpu_load(); + } + alpha_pal_wrfen(1); + + if (inst->float_format.opcode == op_intmisc) { + regptr = irp(l, inst->float_format.fc); + switch (inst->float_format.function) { + case op_ftoit: + EMUL_COUNT(emul_fix_ftoit); + alpha_stt(inst->float_format.fa, ); + if (regptr != NULL) { +*regptr = fmem.t.i; + } + break; + + case op_ftois: + EMUL_COUNT(emul_fix_ftois); + alpha_sts(inst->float_format.fa, ); + if (regptr != NULL) { +*regptr = (int32_t)fmem.s.i; + } + break; + + default: + panic("%s: bad intmisc function=0x%x\n", __func__, + inst->float_format.function); + } + } else if (inst->float_format.opcode == op_fix_float) { + regptr = irp(l, inst->float_format.fa); + register_t regval = (regptr != NULL) ? *regptr : 0; + + switch (inst->float_format.function) { + case op_itofs: + EMUL_COUNT(emul_fix_itofs); + fmem.s.i = (uint32_t)regval; + alpha_lds(inst->float_format.fc, ); + break; + + /* + * The Book says about ITOFF: + * + * ITOFF is equivalent to the following sequence, + * except that the word swapping that LDF normally + * performs is not performed by ITOFF. + * + * STL + * LDF + * + * ...implying that we can't actually use LDF here ??? So + * we'll skip it for now. + */ + + case op_itoft: + EMUL_COUNT(emul_fix_itoft); + fmem.t.i = regval; + alpha_ldt(inst->float_format.fc, ); + break; + + default: + panic("%s: bad fix_float function=0x%x\n", __func__, + inst->float_format.function); + } + } else { + panic("%s: bad opcode=0x%02x", __func__, + inst->float_format.opcode); + } + + alpha_pal_wrfen(0); + kpreempt_enable(); +} + static struct evcnt
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Jul 23 03:57:06 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: fp_complete.c Log Message: IEEE SQRTS / SQRTT is fix_float opclass 11, not fix_float opclass 10 (which is VAX SQRTF / SQRTG). To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/alpha/alpha/fp_complete.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/alpha/alpha/fp_complete.c diff -u src/sys/arch/alpha/alpha/fp_complete.c:1.26 src/sys/arch/alpha/alpha/fp_complete.c:1.27 --- src/sys/arch/alpha/alpha/fp_complete.c:1.26 Fri Jul 23 03:50:32 2021 +++ src/sys/arch/alpha/alpha/fp_complete.c Fri Jul 23 03:57:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fp_complete.c,v 1.26 2021/07/23 03:50:32 thorpej Exp $ */ +/* $NetBSD: fp_complete.c,v 1.27 2021/07/23 03:57:06 thorpej Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -37,7 +37,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.26 2021/07/23 03:50:32 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.27 2021/07/23 03:57:06 thorpej Exp $"); #include #include @@ -588,7 +588,7 @@ alpha_fp_interpret(unsigned long pc, str switch(inst.float_detail.src) { case op_src_sf: sts(inst.float_detail.fb, , l); - if (inst.float_detail.opclass == 10) + if (inst.float_detail.opclass == 11) sfc.i = float32_sqrt(sfb.i); else if (inst.float_detail.opclass & ~3) { this_cannot_happen(1, inst.bits); @@ -607,7 +607,7 @@ alpha_fp_interpret(unsigned long pc, str inst.bits, l); else { stt(inst.float_detail.fb, , l); -if (inst.float_detail.opclass == 10) +if (inst.float_detail.opclass == 11) tfc.i = float64_sqrt(tfb.i); else { stt(inst.float_detail.fa, , l);
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Thu Jul 22 15:48:40 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: locore.s Log Message: It's unlikely that a process will be using restartable atomic sequences on Alpha, and furthermore it's unlikely that any given context switch will be returning to one even if the process has them. So, re-arrange the RAS processing in cpu_switchto() so that the most likely code paths are predicted by the branch predictor. On an EV4-class processor, this will save ~4-6 cycles on just about every context switch. To generate a diff of this commit: cvs rdiff -u -r1.140 -r1.141 src/sys/arch/alpha/alpha/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/alpha/alpha/locore.s diff -u src/sys/arch/alpha/alpha/locore.s:1.140 src/sys/arch/alpha/alpha/locore.s:1.141 --- src/sys/arch/alpha/alpha/locore.s:1.140 Sun Jul 11 01:55:51 2021 +++ src/sys/arch/alpha/alpha/locore.s Thu Jul 22 15:48:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.140 2021/07/11 01:55:51 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.141 2021/07/22 15:48:40 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.140 2021/07/11 01:55:51 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.141 2021/07/22 15:48:40 thorpej Exp $"); #include "assym.h" @@ -844,14 +844,7 @@ LEAF(cpu_switchto, 0) */ ldq a0, L_PROC(s2) /* first ras_lookup() arg */ ldq t0, P_RASLIST(a0) /* any RAS entries? */ - beq t0, 2f/* no, skip */ - ldq s1, L_MD_TF(s2) /* s1 = l->l_md.md_tf */ - ldq a1, (FRAME_PC*8)(s1) /* second ras_lookup() arg */ - CALL(ras_lookup) /* ras_lookup(p, PC) */ - addq v0, 1, t0 /* -1 means "not in ras" */ - beq t0, 2f - stq v0, (FRAME_PC*8)(s1) - + bne t0, 4f/* yes, go deal with it */ 2: mov s4, v0/* return the old lwp */ /* @@ -883,6 +876,16 @@ LEAF(cpu_switchto, 0) stq sp, PCB_HWPCB_KSP(a3) /* save old SP */ ldq sp, PCB_HWPCB_KSP(a2) /* restore new SP */ br 1b/* finish up */ + +4: + ldq s1, L_MD_TF(s2) /* s1 = l->l_md.md_tf */ + ldq a1, (FRAME_PC*8)(s1) /* second ras_lookup() arg */ + CALL(ras_lookup) /* ras_lookup(p, PC) */ + addq v0, 1, t0 /* -1 means "not in ras" */ + beq t0, 2b/* not in ras? return */ + stq v0, (FRAME_PC*8)(s1) /* in ras? fix up PC */ + br 2b/* finish up */ + END(cpu_switchto) /*
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Jul 20 02:42:10 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: db_instruction.h Log Message: Define the FIX float function codes (ITOFF, ITOFS, ITOFT). To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/alpha/db_instruction.h 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/alpha/alpha/db_instruction.h diff -u src/sys/arch/alpha/alpha/db_instruction.h:1.12 src/sys/arch/alpha/alpha/db_instruction.h:1.13 --- src/sys/arch/alpha/alpha/db_instruction.h:1.12 Mon Jun 21 02:10:46 2021 +++ src/sys/arch/alpha/alpha/db_instruction.h Tue Jul 20 02:42:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_instruction.h,v 1.12 2021/06/21 02:10:46 thorpej Exp $ */ +/* $NetBSD: db_instruction.h,v 1.13 2021/07/20 02:42:10 thorpej Exp $ */ /* * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. @@ -445,6 +445,11 @@ typedef union { #define op_cvtql_v 0x130 #define op_cvtql_sv 0x530 + /* FIX FLOAT, "function" opcodes (bits 5..11) */ + +#define op_itofs 0x004 +#define op_itoff 0x014 +#define op_itoft 0x024 /* ieee FLOAT, "function" opcodes (bits 5..11) */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Jul 20 01:56:06 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: trap.c Log Message: Emulate the CIX extension instructions (CTPOP, CTTZ, CTLZ). To generate a diff of this commit: cvs rdiff -u -r1.136 -r1.137 src/sys/arch/alpha/alpha/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/alpha/alpha/trap.c diff -u src/sys/arch/alpha/alpha/trap.c:1.136 src/sys/arch/alpha/alpha/trap.c:1.137 --- src/sys/arch/alpha/alpha/trap.c:1.136 Mon Jul 19 22:21:36 2021 +++ src/sys/arch/alpha/alpha/trap.c Tue Jul 20 01:56:06 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: trap.c,v 1.136 2021/07/19 22:21:36 thorpej Exp $ */ +/* $NetBSD: trap.c,v 1.137 2021/07/20 01:56:06 thorpej Exp $ */ /*- - * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. + * Copyright (c) 2000, 2001, 2021 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -95,7 +95,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.136 2021/07/19 22:21:36 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.137 2021/07/20 01:56:06 thorpej Exp $"); #include #include @@ -106,6 +106,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1 #include #include #include +#include #include @@ -980,6 +981,17 @@ EVCNT_ATTACH_STATIC(emul_bwx_stw); EVCNT_ATTACH_STATIC(emul_bwx_sextb); EVCNT_ATTACH_STATIC(emul_bwx_sextw); +static struct evcnt emul_cix_ctpop = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul cix", "ctpop"); +static struct evcnt emul_cix_ctlz = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul cix", "ctlz"); +static struct evcnt emul_cix_cttz = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul cix", "cttz"); + +EVCNT_ATTACH_STATIC(emul_cix_ctpop); +EVCNT_ATTACH_STATIC(emul_cix_ctlz); +EVCNT_ATTACH_STATIC(emul_cix_cttz); + #define EMUL_COUNT(ev) atomic_inc_64(&(ev).ev_count) /* @@ -1129,6 +1141,60 @@ handle_opdec(struct lwp *l, u_long *ucod *regptr = w; break; } + if (inst.operate_reg_format.function == op_ctpop && + inst.operate_reg_format.zero == 0 && + inst.operate_reg_format.sbz == 0 && + inst.operate_reg_format.ra == 31) { + unsigned long val; + unsigned int res; + + EMUL_COUNT(emul_cix_ctpop); + regptr = irp(l, inst.operate_reg_format.rb); + val = (regptr != NULL) ? *regptr : 0; + res = popcount64(val); + regptr = irp(l, inst.operate_reg_format.rc); + if (regptr != NULL) { +*regptr = res; + } + break; + } + if (inst.operate_reg_format.function == op_ctlz && + inst.operate_reg_format.zero == 0 && + inst.operate_reg_format.sbz == 0 && + inst.operate_reg_format.ra == 31) { + unsigned long val; + unsigned int res; + + EMUL_COUNT(emul_cix_ctlz); + regptr = irp(l, inst.operate_reg_format.rb); + val = (regptr != NULL) ? *regptr : 0; + res = fls64(val); + res = (res == 0) ? 64 : 64 - res; + regptr = irp(l, inst.operate_reg_format.rc); + if (regptr != NULL) { +*regptr = res; + } + break; + } + if (inst.operate_reg_format.function == op_cttz && + inst.operate_reg_format.zero == 0 && + inst.operate_reg_format.sbz == 0 && + inst.operate_reg_format.ra == 31) { + unsigned long val; + unsigned int res; + + EMUL_COUNT(emul_cix_cttz); + regptr = irp(l, inst.operate_reg_format.rb); + val = (regptr != NULL) ? *regptr : 0; + res = ffs64(val); + res = (res == 0) ? 64 : res - 1; + regptr = irp(l, inst.operate_reg_format.rc); + if (regptr != NULL) { +*regptr = res; + } + break; + } + goto sigill; default:
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Mon Jul 19 22:21:36 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: trap.c Log Message: - In unaligned_fixup(), use defined constants for opcodes, not magic numbers. - In handle_opdec(), use ufetch_int() to fetch the instruction and _u{fetch,store}_{8,16}() when emulating BWX instructions rather than copyin() / copyout() (they're faster). - Add event counters for BWX instruction emulation. To generate a diff of this commit: cvs rdiff -u -r1.135 -r1.136 src/sys/arch/alpha/alpha/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/alpha/alpha/trap.c diff -u src/sys/arch/alpha/alpha/trap.c:1.135 src/sys/arch/alpha/alpha/trap.c:1.136 --- src/sys/arch/alpha/alpha/trap.c:1.135 Thu Nov 21 19:23:58 2019 +++ src/sys/arch/alpha/alpha/trap.c Mon Jul 19 22:21:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.135 2019/11/21 19:23:58 ad Exp $ */ +/* $NetBSD: trap.c,v 1.136 2021/07/19 22:21:36 thorpej Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -87,13 +87,15 @@ * rights to redistribute these changes. */ +#define __UFETCHSTORE_PRIVATE /* see handle_opdec() */ + #include "opt_fix_unaligned_vax_fp.h" #include "opt_ddb.h" #include "opt_multiprocessor.h" #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.135 2019/11/21 19:23:58 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.136 2021/07/19 22:21:36 thorpej Exp $"); #include #include @@ -875,65 +877,65 @@ unaligned_fixup(u_long va, u_long opcode signo = SIGSEGV; if (dofix && selected_tab->fixable) { switch (opcode) { - case 0x0c: /* ldwu */ + case op_ldwu: /* XXX ONLY WORKS ON LITTLE-ENDIAN ALPHA */ unaligned_load_integer(worddata); break; - case 0x0d: /* stw */ + case op_stw: /* XXX ONLY WORKS ON LITTLE-ENDIAN ALPHA */ unaligned_store_integer(worddata); break; #ifdef FIX_UNALIGNED_VAX_FP - case 0x20: /* ldf */ + case op_ldf: unaligned_load_floating(intdata, Ffloat_to_reg); break; - case 0x21: /* ldg */ + case op_ldg: unaligned_load_floating(longdata, Gfloat_reg_cvt); break; #endif - case 0x22: /* lds */ + case op_lds: unaligned_load_floating(intdata, Sfloat_to_reg); break; - case 0x23: /* ldt */ + case op_ldt: unaligned_load_floating(longdata, Tfloat_reg_cvt); break; #ifdef FIX_UNALIGNED_VAX_FP - case 0x24: /* stf */ + case op_stf: unaligned_store_floating(intdata, reg_to_Ffloat); break; - case 0x25: /* stg */ + case op_stg: unaligned_store_floating(longdata, Gfloat_reg_cvt); break; #endif - case 0x26: /* sts */ + case op_sts: unaligned_store_floating(intdata, reg_to_Sfloat); break; - case 0x27: /* stt */ + case op_stt: unaligned_store_floating(longdata, Tfloat_reg_cvt); break; - case 0x28: /* ldl */ + case op_ldl: unaligned_load_integer(intdata); break; - case 0x29: /* ldq */ + case op_ldq: unaligned_load_integer(longdata); break; - case 0x2c: /* stl */ + case op_stl: unaligned_store_integer(intdata); break; - case 0x2d: /* stq */ + case op_stq: unaligned_store_integer(longdata); break; @@ -958,6 +960,28 @@ unaligned_fixup(u_long va, u_long opcode return (signo); } +static struct evcnt emul_bwx_ldbu = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul bwx", "ldbu"); +static struct evcnt emul_bwx_ldwu = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul bwx", "ldwu"); +static struct evcnt emul_bwx_stb = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul bwx", "stb"); +static struct evcnt emul_bwx_stw = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul bwx", "stw"); +static struct evcnt emul_bwx_sextb = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul bwx", "sextb"); +static struct evcnt emul_bwx_sextw = +EVCNT_INITIALIZER(EVCNT_TYPE_TRAP, NULL, "emul bwx", "sextw"); + +EVCNT_ATTACH_STATIC(emul_bwx_ldbu); +EVCNT_ATTACH_STATIC(emul_bwx_ldwu); +EVCNT_ATTACH_STATIC(emul_bwx_stb); +EVCNT_ATTACH_STATIC(emul_bwx_stw); +EVCNT_ATTACH_STATIC(emul_bwx_sextb); +EVCNT_ATTACH_STATIC(emul_bwx_sextw); + +#define EMUL_COUNT(ev) atomic_inc_64(&(ev).ev_count) + /* * Reserved/unimplemented instruction (opDec fault) handler * @@ -986,7 +1010,7 @@ handle_opdec(struct lwp *l, u_long *ucod l->l_md.md_tf->tf_regs[FRAME_SP] = alpha_pal_rdusp(); inst_pc = memaddr = l->l_md.md_tf->tf_regs[FRAME_PC] - 4; - if (copyin((void *)inst_pc, , sizeof (inst)) != 0) { + if (ufetch_int((void *)inst_pc, ) != 0) { /* * really, this should never happen, but in case it * does we handle it. @@ -1012,6 +1036,11 @@ handle_opdec(struct lwp *l, u_long *ucod if (inst.mem_format.opcode == op_ldwu || inst.mem_format.opcode == op_stw) { if (memaddr & 0x01) { +if (inst.mem_format.opcode ==
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Mon Jul 19 16:31:19 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Re-arrange the kernel pmap fast-path in pmap_extract() so that when DEBUG is not enabled, the compiler can emit a tail-call to vtophys_internal(). To generate a diff of this commit: cvs rdiff -u -r1.298 -r1.299 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.298 src/sys/arch/alpha/alpha/pmap.c:1.299 --- src/sys/arch/alpha/alpha/pmap.c:1.298 Fri Jul 16 19:02:22 2021 +++ src/sys/arch/alpha/alpha/pmap.c Mon Jul 19 16:31:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.298 2021/07/16 19:02:22 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.299 2021/07/19 16:31:19 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.298 2021/07/16 19:02:22 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.299 2021/07/19 16:31:19 thorpej Exp $"); #include #include @@ -2578,18 +2578,18 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa * handles K0SEG. */ if (__predict_true(pmap == pmap_kernel())) { - if (__predict_true(vtophys_internal(va, pap))) { #ifdef DEBUG - if (pmapdebug & PDB_FOLLOW) + bool address_is_valid = vtophys_internal(va, pap); + if (pmapdebug & PDB_FOLLOW) { + if (address_is_valid) { printf("0x%lx (kernel vtophys)\n", *pap); -#endif - return true; + } else { +printf("failed (kernel vtophys)\n"); + } } -#ifdef DEBUG - if (pmapdebug & PDB_FOLLOW) - printf("failed (kernel vtophys)\n"); +#else + return vtophys_internal(va, pap); #endif - return false; } pt_entry_t * const lev1map = pmap_lev1map(pmap);
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Jul 16 19:13:21 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: vm_machdep.c Log Message: Instrument success/faulure of phyisically contiguous uarea allocation. To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/sys/arch/alpha/alpha/vm_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/alpha/alpha/vm_machdep.c diff -u src/sys/arch/alpha/alpha/vm_machdep.c:1.120 src/sys/arch/alpha/alpha/vm_machdep.c:1.121 --- src/sys/arch/alpha/alpha/vm_machdep.c:1.120 Tue Jul 6 12:20:52 2021 +++ src/sys/arch/alpha/alpha/vm_machdep.c Fri Jul 16 19:13:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.120 2021/07/06 12:20:52 thorpej Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.121 2021/07/16 19:13:21 thorpej Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.120 2021/07/06 12:20:52 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.121 2021/07/16 19:13:21 thorpej Exp $"); #include #include @@ -248,6 +248,14 @@ vunmapbuf(struct buf *bp, vsize_t len) } #ifdef __HAVE_CPU_UAREA_ROUTINES +static struct evcnt uarea_direct_success = +EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "uarea direct", "success"); +static struct evcnt uarea_direct_failure = +EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "uarea direct", "failure"); + +EVCNT_ATTACH_STATIC(uarea_direct_success); +EVCNT_ATTACH_STATIC(uarea_direct_failure); + void * cpu_uarea_alloc(bool system) { @@ -259,8 +267,11 @@ cpu_uarea_alloc(bool system) * direct-mapped. */ error = uvm_pglistalloc(USPACE, 0, ptoa(physmem), 0, 0, , 1, 1); - if (error) + if (error) { + atomic_inc_ulong(_direct_failure.ev_count); return NULL; + } + atomic_inc_ulong(_direct_success.ev_count); /* * Get the physical address from the first page.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Jul 13 13:58:30 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: lock_stubs.s Log Message: Fix non-MULTIPROCESSOR build (e.g. INSTALL kernel). To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/alpha/alpha/lock_stubs.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/alpha/alpha/lock_stubs.s diff -u src/sys/arch/alpha/alpha/lock_stubs.s:1.7 src/sys/arch/alpha/alpha/lock_stubs.s:1.8 --- src/sys/arch/alpha/alpha/lock_stubs.s:1.7 Tue Jul 13 01:59:10 2021 +++ src/sys/arch/alpha/alpha/lock_stubs.s Tue Jul 13 13:58:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lock_stubs.s,v 1.7 2021/07/13 01:59:10 thorpej Exp $ */ +/* $NetBSD: lock_stubs.s,v 1.8 2021/07/13 13:58:30 thorpej Exp $ */ /*- * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: lock_stubs.s,v 1.7 2021/07/13 01:59:10 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lock_stubs.s,v 1.8 2021/07/13 13:58:30 thorpej Exp $"); #include "assym.h" @@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: lock_stubs.s */ #define MB(label) label: unop #else -#define MB /* nothing */ +#define MB(label) /* nothing */ #endif /*
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Jul 13 01:59:10 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: lock_stubs.s patch.c Log Message: As with membar_producer() and membar_sync(), initialize the fast-path lock stubs with "unop" isns where memory barriers need to be, and if we detect a multiprocessor system, patch those locations with "mb" insns. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/alpha/lock_stubs.s \ src/sys/arch/alpha/alpha/patch.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/alpha/alpha/lock_stubs.s diff -u src/sys/arch/alpha/alpha/lock_stubs.s:1.6 src/sys/arch/alpha/alpha/lock_stubs.s:1.7 --- src/sys/arch/alpha/alpha/lock_stubs.s:1.6 Mon Jul 12 15:21:51 2021 +++ src/sys/arch/alpha/alpha/lock_stubs.s Tue Jul 13 01:59:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lock_stubs.s,v 1.6 2021/07/12 15:21:51 thorpej Exp $ */ +/* $NetBSD: lock_stubs.s,v 1.7 2021/07/13 01:59:10 thorpej Exp $ */ /*- * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc. @@ -34,12 +34,16 @@ #include -__KERNEL_RCSID(0, "$NetBSD: lock_stubs.s,v 1.6 2021/07/12 15:21:51 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lock_stubs.s,v 1.7 2021/07/13 01:59:10 thorpej Exp $"); #include "assym.h" #if defined(MULTIPROCESSOR) -#define MB mb +/* + * These 'unop' insns will be patched with 'mb' insns at run-time if + * the system has more than one processor. + */ +#define MB(label) label: unop #else #define MB /* nothing */ #endif @@ -55,11 +59,11 @@ LEAF(_lock_cas, 3) beq t1, 2f stq_c v0, 0(a0) beq v0, 3f - MB + MB(.L__lock_cas_mb_1) RET 2: mov zero, v0 - MB + MB(.L__lock_cas_mb_2) RET 3: br 1b @@ -79,7 +83,7 @@ LEAF(mutex_enter, 1) bne t2, 2f stq_c t1, 0(a0) beq t1, 3f - MB + MB(.L_mutex_enter_mb_1) RET 2: lda t12, mutex_vector_enter @@ -93,7 +97,7 @@ LEAF(mutex_enter, 1) */ LEAF(mutex_exit, 1) LDGP(pv) - MB + MB(.L_mutex_exit_mb_1) GET_CURLWP /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */ mov zero, t3 1: @@ -179,7 +183,7 @@ LEAF(mutex_spin_enter, 1); bne t0, 2f /* contended */ stl_c t1, MUTEX_SIMPLELOCK(a1) beq t1, 2f /* STL_C failed; consider contended */ - MB + MB(.L_mutex_spin_enter_mb_1) RET 2: mov a1, a0 /* restore first argument */ @@ -192,7 +196,7 @@ LEAF(mutex_spin_enter, 1); */ LEAF(mutex_spin_exit, 1) LDGP(pv); - MB + MB(.L_mutex_spin_exit_mb_1) /* * STEP 1: __cpu_simple_unlock(>mtx_lock) @@ -247,7 +251,7 @@ LEAF(rw_enter, 2) bne t1, 4f /* contended */ stq_c t2, 0(a0) beq t2, 2f /* STQ_C failed; retry */ - MB + MB(.L_rw_enter_mb_1) RET 2: br 1b @@ -259,7 +263,7 @@ LEAF(rw_enter, 2) bne t0, 4f /* contended */ stq_c t2, 0(a0) beq t2, 4f /* STQ_C failed; consider it contended */ - MB + MB(.L_rw_enter_mb_2) RET 4: lda pv, rw_vector_enter @@ -284,7 +288,7 @@ LEAF(rw_tryenter, 2) bne t1, 4f /* contended */ stq_c v0, 0(a0) beq v0, 2f /* STQ_C failed; retry */ - MB + MB(.L_rw_tryenter_mb_1) RET /* v0 contains non-zero LOCK_FLAG from STQ_C */ 2: br 1b @@ -302,7 +306,7 @@ LEAF(rw_tryenter, 2) * in the failure case because we expect it to be rare and it saves * a branch-not-taken instruction in the success case. */ - MB + MB(.L_rw_tryenter_mb_2) RET 4: mov zero, v0 /* return 0 (failure) */ @@ -316,7 +320,7 @@ LEAF(rw_tryenter, 2) */ LEAF(rw_exit, 1) LDGP(pv) - MB + MB(.L_rw_exit_mb_1) /* * Check for write-lock release, and get the owner/count field @@ -381,3 +385,27 @@ LEAF(rw_exit, 1) END(rw_exit) #endif /* !LOCKDEBUG */ + +#if defined(MULTIPROCESSOR) +/* + * Table of locations to patch with MB instructions on multiprocessor + * systems. + */ + .section ".rodata" + .globl lock_stub_patch_table +lock_stub_patch_table: + .quad .L__lock_cas_mb_1 + .quad .L__lock_cas_mb_2 +#if !defined(LOCKDEBUG) + .quad .L_mutex_enter_mb_1 + .quad .L_mutex_exit_mb_1 + .quad .L_mutex_spin_enter_mb_1 + .quad .L_mutex_spin_exit_mb_1 + .quad .L_rw_enter_mb_1 + .quad .L_rw_enter_mb_2 + .quad .L_rw_tryenter_mb_1 + .quad .L_rw_tryenter_mb_2 + .quad .L_rw_exit_mb_1 +#endif /* ! LOCKDEBUG */ + .quad 0 /* NULL terminator */ +#endif /* MULTIPROCESSOR */ Index: src/sys/arch/alpha/alpha/patch.c diff -u src/sys/arch/alpha/alpha/patch.c:1.6 src/sys/arch/alpha/alpha/patch.c:1.7 --- src/sys/arch/alpha/alpha/patch.c:1.6 Wed Jul 7 03:30:35 2021 +++ src/sys/arch/alpha/alpha/patch.c Tue Jul 13 01:59:10 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: patch.c,v 1.6 2021/07/07 03:30:35 thorpej Exp $ */ +/* $NetBSD: patch.c,v 1.7 2021/07/13 01:59:10 thorpej Exp $ */ /*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. + * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: patch.c,v
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun Jul 11 01:55:51 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: locore.s Log Message: Pull in pmap_subr.s (missed in prior commit). To generate a diff of this commit: cvs rdiff -u -r1.139 -r1.140 src/sys/arch/alpha/alpha/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/alpha/alpha/locore.s diff -u src/sys/arch/alpha/alpha/locore.s:1.139 src/sys/arch/alpha/alpha/locore.s:1.140 --- src/sys/arch/alpha/alpha/locore.s:1.139 Wed Jul 7 03:30:35 2021 +++ src/sys/arch/alpha/alpha/locore.s Sun Jul 11 01:55:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.139 2021/07/07 03:30:35 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.140 2021/07/11 01:55:51 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.139 2021/07/07 03:30:35 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.140 2021/07/11 01:55:51 thorpej Exp $"); #include "assym.h" @@ -217,6 +217,15 @@ NESTED_NOPROFILE(locorestart,1,0,ra,0,0) /**/ +/* + * Pull in optimized pmap subroutines. + */ +#include + +/**/ + +/**/ + .text .stabs __FILE__,132,0,0,backtolocore1 /* done with includes */ .loc 1 __LINE__
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun Jul 11 01:54:42 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: genassym.cf Log Message: Define ALPHA_PGBYTES (missed in prior commit). To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/alpha/alpha/genassym.cf 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/alpha/alpha/genassym.cf diff -u src/sys/arch/alpha/alpha/genassym.cf:1.27 src/sys/arch/alpha/alpha/genassym.cf:1.28 --- src/sys/arch/alpha/alpha/genassym.cf:1.27 Sat Sep 19 01:24:31 2020 +++ src/sys/arch/alpha/alpha/genassym.cf Sun Jul 11 01:54:42 2021 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.27 2020/09/19 01:24:31 thorpej Exp $ +# $NetBSD: genassym.cf,v 1.28 2021/07/11 01:54:42 thorpej Exp $ # # Copyright (c) 1982, 1990, 1993 @@ -84,6 +84,7 @@ include # general constants define VM_MAX_ADDRESS VM_MAX_ADDRESS +define ALPHA_PGBYTES ALPHA_PGBYTES # Register offsets, for stack frames. define FRAME_V0 FRAME_V0
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat Jul 10 20:22:38 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Added Files: src/sys/arch/alpha/alpha: pmap_subr.s Log Message: Move the optimized pmap_zero_page() from pmap.c to a new pmap_subr.s, and optimize it a teeny bit little more. Provide an optimized (for 21164, anyway) pmap_copy_page() as well. To generate a diff of this commit: cvs rdiff -u -r1.296 -r1.297 src/sys/arch/alpha/alpha/pmap.c cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/alpha/pmap_subr.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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.296 src/sys/arch/alpha/alpha/pmap.c:1.297 --- src/sys/arch/alpha/alpha/pmap.c:1.296 Mon Jul 5 15:12:00 2021 +++ src/sys/arch/alpha/alpha/pmap.c Sat Jul 10 20:22:37 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.296 2021/07/05 15:12:00 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.297 2021/07/10 20:22:37 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.296 2021/07/05 15:12:00 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.297 2021/07/10 20:22:37 thorpej Exp $"); #include #include @@ -2758,85 +2758,9 @@ pmap_deactivate(struct lwp *l) pmap_destroy(pmap); } -/* - * pmap_zero_page: [ INTERFACE ] - * - * Zero the specified (machine independent) page by mapping the page - * into virtual memory and clear its contents, one machine dependent - * page at a time. - * - * Note: no locking is necessary in this function. - */ -void -pmap_zero_page(paddr_t phys) -{ - u_long *p0, *p1, *pend; - -#ifdef DEBUG - if (pmapdebug & PDB_FOLLOW) - printf("pmap_zero_page(%lx)\n", phys); -#endif - - p0 = (u_long *)ALPHA_PHYS_TO_K0SEG(phys); - p1 = NULL; - pend = (u_long *)((u_long)p0 + PAGE_SIZE); - - /* - * Unroll the loop a bit, doing 16 quadwords per iteration. - * Do only 8 back-to-back stores, and alternate registers. - */ - do { - __asm volatile( - "# BEGIN loop body\n" - " addq %2, (8 * 8), %1 \n" - " stq $31, (0 * 8)(%0) \n" - " stq $31, (1 * 8)(%0) \n" - " stq $31, (2 * 8)(%0) \n" - " stq $31, (3 * 8)(%0) \n" - " stq $31, (4 * 8)(%0) \n" - " stq $31, (5 * 8)(%0) \n" - " stq $31, (6 * 8)(%0) \n" - " stq $31, (7 * 8)(%0) \n" - " \n" - " addq %3, (8 * 8), %0 \n" - " stq $31, (0 * 8)(%1) \n" - " stq $31, (1 * 8)(%1) \n" - " stq $31, (2 * 8)(%1) \n" - " stq $31, (3 * 8)(%1) \n" - " stq $31, (4 * 8)(%1) \n" - " stq $31, (5 * 8)(%1) \n" - " stq $31, (6 * 8)(%1) \n" - " stq $31, (7 * 8)(%1) \n" - " # END loop body" - : "=r" (p0), "=r" (p1) - : "0" (p0), "1" (p1) - : "memory"); - } while (p0 < pend); -} - -/* - * pmap_copy_page: [ INTERFACE ] - * - * Copy the specified (machine independent) page by mapping the page - * into virtual memory and using memcpy to copy the page, one machine - * dependent page at a time. - * - * Note: no locking is necessary in this function. - */ -void -pmap_copy_page(paddr_t src, paddr_t dst) -{ - const void *s; - void *d; +/* pmap_zero_page() is in pmap_subr.s */ -#ifdef DEBUG - if (pmapdebug & PDB_FOLLOW) - printf("pmap_copy_page(%lx, %lx)\n", src, dst); -#endif - s = (const void *)ALPHA_PHYS_TO_K0SEG(src); - d = (void *)ALPHA_PHYS_TO_K0SEG(dst); - memcpy(d, s, PAGE_SIZE); -} +/* pmap_copy_page() is in pmap_subr.s */ /* * pmap_pageidlezero: [ INTERFACE ] Added files: Index: src/sys/arch/alpha/alpha/pmap_subr.s diff -u /dev/null src/sys/arch/alpha/alpha/pmap_subr.s:1.1 --- /dev/null Sat Jul 10 20:22:38 2021 +++ src/sys/arch/alpha/alpha/pmap_subr.s Sat Jul 10 20:22:37 2021 @@ -0,0 +1,165 @@ +/* $NetBSD: pmap_subr.s,v 1.1 2021/07/10 20:22:37 thorpej Exp $ */ + +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + *
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Jul 9 01:29:21 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: autoconf.c Log Message: If we're netbooting on a system with, for example, an ISA DE204 Ethernet interface, we don't have sufficient information to find the device using the bus/slot scheme that we do with a PCI network interface. However, in these cases, some versions of the SRM console supply the MAC address of the interface in the booted_dev environment variable, like so: BOOTP 1 1 0 0 0 5 0 08-00-2B-xx-xx-xx 1 So, if we weren't able to find the booted device by the usual means, check for this and, if we find a MAC address, try to find the network interface by the MAC address. To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/arch/alpha/alpha/autoconf.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/alpha/alpha/autoconf.c diff -u src/sys/arch/alpha/alpha/autoconf.c:1.57 src/sys/arch/alpha/alpha/autoconf.c:1.58 --- src/sys/arch/alpha/alpha/autoconf.c:1.57 Sat May 22 15:05:36 2021 +++ src/sys/arch/alpha/alpha/autoconf.c Fri Jul 9 01:29:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.57 2021/05/22 15:05:36 thorpej Exp $ */ +/* $NetBSD: autoconf.c,v 1.58 2021/07/09 01:29:20 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -42,7 +42,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.57 2021/05/22 15:05:36 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.58 2021/07/09 01:29:20 thorpej Exp $"); #include "pci.h" @@ -57,6 +57,9 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v #include +#include +#include + #include #include #include @@ -66,8 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v struct bootdev_data *bootdev_data; -void parse_prom_bootdev(void); -static inline int atoi(const char *); +static void parse_prom_bootdev(void); /* * cpu_configure: @@ -138,6 +140,86 @@ qemu_find_rootdev(void) booted_device = device_find_by_xname(cp); } +static bool +parse_dec_macaddr(const char *str, uint8_t enaddr[ETHER_ADDR_LEN]) +{ + char *cp; + long long l; + int i; + + /* + * DEC Ethernet address strings are formatted like so: + * + * XX-XX-XX-XX-XX-XX + */ + + for (i = 0; i < ETHER_ADDR_LEN; i++) { + l = strtoll(str, , 16); + if (l < 0 || l > 0xff) { + /* Not a valid MAC address. */ + return false; + } + if (*cp == '-') { + /* Octet separator. */ + enaddr[i] = (uint8_t)l; + str = cp + 1; + continue; + } + if (*cp == ' ' || *cp == '\0') { + /* End of the string. */ + enaddr[i] = (uint8_t)l; + return i == ETHER_ADDR_LEN - 1; + } + /* Bogus character. */ + break; + } + + /* Encountered bogus character or didn't reach end of string. */ + return false; +} + +static void +netboot_find_rootdev_planb(void) +{ + struct psref psref; + uint8_t enaddr[ETHER_ADDR_LEN]; + char ifname[IFNAMSIZ]; + int i; + + if (strncasecmp(bootinfo.booted_dev, "BOOTP ", 6) != 0 && + strncasecmp(bootinfo.booted_dev, "MOP ", 4) != 0) { + /* We weren't netbooted. */ + return; + } + + for (i = 2; bootinfo.booted_dev[i] != '\0'; i++) { + if (bootinfo.booted_dev[i] == '-') { + if (parse_dec_macaddr(_dev[i - 2], + enaddr)) { +/* Found it! */ +break; + } + } + } + if (bootinfo.booted_dev[i] == '\0') { + /* No MAC address in string. */ + return; + } + + /* Now try to look up the interface by the link address. */ + struct ifnet *ifp = if_get_bylla(enaddr, ETHER_ADDR_LEN, ); + if (ifp == NULL) { + /* No interface attached with that MAC address. */ + return; + } + + strlcpy(ifname, if_name(ifp), sizeof(ifname)); + if_put(ifp, ); + + /* Ok! Now look up the device_t by name! */ + booted_device = device_find_by_xname(ifname); +} + void cpu_rootconf(void) { @@ -147,13 +229,33 @@ cpu_rootconf(void) } if (booted_device == NULL) { + /* + * It's possible that we netbooted from an Ethernet + * interface that can't be matched via the usual + * logic in device_register() (a DE204 in an ISA slot, + * for example). In these cases, the console may have + * provided us with a MAC address that we can use to + * try and find the interface, * e.g.: + * + * BOOTP 1 1 0 0 0 5 0 08-00-2B-xx-xx-xx 1 + */ + netboot_find_rootdev_planb(); + } + + if (booted_device == NULL) { printf("WARNING: can't figure what device matches \"%s\"\n", bootinfo.booted_dev); } rootconf(); } -void +static inline int +atoi(const char *s) +{ + return (int)strtoll(s, NULL, 10); +} + +static void parse_prom_bootdev(void) { static char hacked_boot_dev[128]; @@ -213,12 +315,6 @@ parse_prom_bootdev(void) bootdev_data = } -static inline int -atoi(const char *s) -{ - return (int)strtoll(s, NULL, 10); -} - void device_register(device_t dev, void *aux) {
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed Jul 7 03:30:35 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: locore.s patch.c Log Message: Provide a BWX version of alpha_copystr() and patch it into place if the system supports the BWX extension. The inner loop of the BWX version is 42% shorter than the non-BWX version (7 vs 12 insns). To generate a diff of this commit: cvs rdiff -u -r1.138 -r1.139 src/sys/arch/alpha/alpha/locore.s cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/alpha/patch.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/alpha/alpha/locore.s diff -u src/sys/arch/alpha/alpha/locore.s:1.138 src/sys/arch/alpha/alpha/locore.s:1.139 --- src/sys/arch/alpha/alpha/locore.s:1.138 Wed Jul 7 02:44:04 2021 +++ src/sys/arch/alpha/alpha/locore.s Wed Jul 7 03:30:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.138 2021/07/07 02:44:04 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.139 2021/07/07 03:30:35 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.138 2021/07/07 02:44:04 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.139 2021/07/07 03:30:35 thorpej Exp $"); #include "assym.h" @@ -902,6 +902,44 @@ LEAF_NOPROFILE(lwp_trampoline, 0) /* * alpha_copystr(const void *from, void *to, size_t len, size_t *donep) */ + .arch ev56 +LEAF(alpha_copystr_bwx, 4) + LDGP(pv) + + mov a2, t0 /* t0 = i = len */ + beq a2, 5f /* if (len == 0), bail */ + +1: ldbu t1, 0(a0) /* t1 = *from */ + subl a2, 1, a2 /* len-- */ + addq a0, 1, a0 /* from++ */ + stb t1, 0(a1) /* *to = t1 */ + beq t1, 2f /* if (t1 == '\0'), bail out */ + addq a1, 1, a1 /* to++ */ + bne a2, 1b /* if (len != 0), copy more */ + +2: beq a3, 3f /* if (lenp != NULL) */ + subl t0, a2, t0 /* *lenp = (i - len) */ + stq t0, 0(a3) +3: bne t1, 4f /* *from != '\0'; leave in a huff */ + + mov zero, v0 /* return 0. */ + RET + +4: ldiq v0, ENAMETOOLONG + RET + +5: ldiq t1, 1 /* fool the test above... */ + br zero, 2b + + nop/* pad to same length as... */ + nop/* non-BWX version. */ + nop + nop + nop + EXPORT(alpha_copystr_bwx_end) + END(alpha_copystr_bwx) + .arch ev4 + LEAF(alpha_copystr, 4) LDGP(pv) @@ -935,6 +973,7 @@ LEAF(alpha_copystr, 4) 5: ldiq t1, 1 /* fool the test above... */ br zero, 2b + EXPORT(alpha_copystr_end) END(alpha_copystr) NESTED(copyinstr, 4, 16, ra, IM_RA|IM_S0, 0) Index: src/sys/arch/alpha/alpha/patch.c diff -u src/sys/arch/alpha/alpha/patch.c:1.5 src/sys/arch/alpha/alpha/patch.c:1.6 --- src/sys/arch/alpha/alpha/patch.c:1.5 Fri Sep 4 03:41:49 2020 +++ src/sys/arch/alpha/alpha/patch.c Wed Jul 7 03:30:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: patch.c,v 1.5 2020/09/04 03:41:49 thorpej Exp $ */ +/* $NetBSD: patch.c,v 1.6 2021/07/07 03:30:35 thorpej Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.5 2020/09/04 03:41:49 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.6 2021/07/07 03:30:35 thorpej Exp $"); #include "opt_multiprocessor.h" @@ -57,6 +57,9 @@ void _membar_sync_end(void); void _membar_sync_mp(void); void _membar_sync_mp_end(void); +extern char alpha_copystr_bwx[], alpha_copystr_bwx_end[]; +extern char alpha_copystr[], alpha_copystr_end[]; + static void __attribute__((__unused__)) patchfunc(void *from_s, void *from_e, void *to_s, void *to_e) { @@ -85,6 +88,11 @@ alpha_patch(bool is_mp) * kernel code. */ + if (cpu_amask & ALPHA_AMASK_BWX) { + patchfunc(alpha_copystr_bwx, alpha_copystr_bwx_end, + alpha_copystr, alpha_copystr_end); + } + #if defined(MULTIPROCESSOR) if (is_mp) { KASSERT(curcpu()->ci_flags & CPUF_PRIMARY);
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed Jul 7 03:24:26 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: mainbus.c Log Message: After attaching CPUs, call alpha_patch() in case there are any function patches we wish to do based on discovered architecture features. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/alpha/alpha/mainbus.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/alpha/alpha/mainbus.c diff -u src/sys/arch/alpha/alpha/mainbus.c:1.35 src/sys/arch/alpha/alpha/mainbus.c:1.36 --- src/sys/arch/alpha/alpha/mainbus.c:1.35 Sat Apr 24 23:36:23 2021 +++ src/sys/arch/alpha/alpha/mainbus.c Wed Jul 7 03:24:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.35 2021/04/24 23:36:23 thorpej Exp $ */ +/* $NetBSD: mainbus.c,v 1.36 2021/07/07 03:24:26 thorpej Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.35 2021/04/24 23:36:23 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.36 2021/07/07 03:24:26 thorpej Exp $"); #include #include @@ -92,6 +92,9 @@ mbattach(device_t parent, device_t self, printf("WARNING: %d cpus in machine, %d attached\n", ncpus, cpuattachcnt); + /* Patch-up any routines based on architecture features. */ + alpha_patch(false); + if (alpha_is_qemu) { ma.ma_name = "qemu"; ma.ma_slot = 0; /* meaningless */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed Jul 7 02:44:04 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: locore.s Log Message: Re-arrange alpha_copystr() so that the the error/unlikely cases are forward branches (which will be predicted as not-taken), and that the likely cases are fall-through, with the exception of the loop branch (which is a backward branch, and thus will be predicted as taken). To generate a diff of this commit: cvs rdiff -u -r1.137 -r1.138 src/sys/arch/alpha/alpha/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/alpha/alpha/locore.s diff -u src/sys/arch/alpha/alpha/locore.s:1.137 src/sys/arch/alpha/alpha/locore.s:1.138 --- src/sys/arch/alpha/alpha/locore.s:1.137 Sun May 23 01:00:53 2021 +++ src/sys/arch/alpha/alpha/locore.s Wed Jul 7 02:44:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.137 2021/05/23 01:00:53 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.138 2021/07/07 02:44:04 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.137 2021/05/23 01:00:53 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.138 2021/07/07 02:44:04 thorpej Exp $"); #include "assym.h" @@ -900,15 +900,13 @@ LEAF_NOPROFILE(lwp_trampoline, 0) /**/ /* - * XXX XXX XXX: Should be removed? + * alpha_copystr(const void *from, void *to, size_t len, size_t *donep) */ LEAF(alpha_copystr, 4) LDGP(pv) mov a2, t0 /* t0 = i = len */ - bne a2, 1f /* if (len != 0), proceed */ - ldiq t1, 1 /* else bail */ - br zero, 2f + beq a2, 5f /* if (len == 0), bail */ 1: ldq_u t1, 0(a0) /* t1 = *from */ extbl t1, a0, t1 @@ -927,13 +925,16 @@ LEAF(alpha_copystr, 4) 2: beq a3, 3f /* if (lenp != NULL) */ subl t0, a2, t0 /* *lenp = (i - len) */ stq t0, 0(a3) -3: beq t1, 4f /* *from == '\0'; leave quietly */ +3: bne t1, 4f /* *from != '\0'; leave in a huff */ - ldiq v0, ENAMETOOLONG /* *from != '\0'; error. */ + mov zero, v0 /* return 0. */ RET -4: mov zero, v0 /* return 0. */ +4: ldiq v0, ENAMETOOLONG RET + +5: ldiq t1, 1 /* fool the test above... */ + br zero, 2b END(alpha_copystr) NESTED(copyinstr, 4, 16, ra, IM_RA|IM_S0, 0)
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Mon Jul 5 15:12:01 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Instrument the number of calls to pmap_growkernel(). To generate a diff of this commit: cvs rdiff -u -r1.295 -r1.296 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.295 src/sys/arch/alpha/alpha/pmap.c:1.296 --- src/sys/arch/alpha/alpha/pmap.c:1.295 Mon Jul 5 10:00:22 2021 +++ src/sys/arch/alpha/alpha/pmap.c Mon Jul 5 15:12:00 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.295 2021/07/05 10:00:22 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.296 2021/07/05 15:12:00 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.295 2021/07/05 10:00:22 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.296 2021/07/05 15:12:00 thorpej Exp $"); #include #include @@ -258,6 +258,11 @@ int pmap_pv_lowat __read_mostly = PMAP_ static TAILQ_HEAD(, pmap) pmap_all_pmaps __cacheline_aligned; /* + * Instrument the number of calls to pmap_growkernel(). + */ +static struct evcnt pmap_growkernel_evcnt __read_mostly; + +/* * The pools from which pmap structures and sub-structures are allocated. */ static struct pool_cache pmap_pmap_cache __read_mostly; @@ -1548,6 +1553,10 @@ pmap_init(void) /* Initialize TLB handling. */ pmap_tlb_init(); + /* Instrument pmap_growkernel(). */ + evcnt_attach_dynamic_nozero(_growkernel_evcnt, EVCNT_TYPE_MISC, + NULL, "pmap", "growkernel"); + /* * Set a low water mark on the pv_entry pool, so that we are * more likely to have these around even in extreme memory @@ -3593,6 +3602,8 @@ pmap_growkernel(vaddr_t maxkvaddr) if (maxkvaddr <= virtual_end) goto out; /* we are OK */ + pmap_growkernel_evcnt.ev_count++; + va = virtual_end; while (va < maxkvaddr) {
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Mon Jul 5 10:00:22 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Fix a bug introduced in pmap.c,v 1.287 where, when creating the PTE in pmap_enter(), we would erroneously disregard MOD/REF attributes already present on the page, thus causing FOW/FOR to be set incorrectly. Normally this is not a big problem (an extra page fault will be taken to resolve it), but if you access the mapping in interrupt context (such as during IDE PIO, for example), a KASSERT can fire due to acquiring an rwlock in interrupt context while servicing that fault. Reported and bisected-to-commit by rin@. To generate a diff of this commit: cvs rdiff -u -r1.294 -r1.295 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.294 src/sys/arch/alpha/alpha/pmap.c:1.295 --- src/sys/arch/alpha/alpha/pmap.c:1.294 Sun Jul 4 22:42:35 2021 +++ src/sys/arch/alpha/alpha/pmap.c Mon Jul 5 10:00:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.294 2021/07/04 22:42:35 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.295 2021/07/05 10:00:22 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.294 2021/07/04 22:42:35 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.295 2021/07/05 10:00:22 thorpej Exp $"); #include #include @@ -2344,7 +2344,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd lock = pmap_pvh_lock(pg); mutex_enter(lock); - md->pvh_listx |= attrs; + attrs = (md->pvh_listx |= attrs); mutex_exit(lock); /* Set up referenced/modified emulation for new mapping. */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Mon Jun 21 02:10:46 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: db_disasm.c db_instruction.h Log Message: Remove the /I "alternate format" from db_disasm(), which was internally interpreted as "showregs", whcih would print the values of the registers at each instruction. Unfortunately, this was fundamentally broken because the saved registers accessible to DDB are only valid for the faulting insn that got us into DDB, and not arbitrary isns that can be examined from within DDB. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/alpha/db_disasm.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/alpha/db_instruction.h 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/alpha/alpha/db_disasm.c diff -u src/sys/arch/alpha/alpha/db_disasm.c:1.17 src/sys/arch/alpha/alpha/db_disasm.c:1.18 --- src/sys/arch/alpha/alpha/db_disasm.c:1.17 Mon Jun 21 02:01:13 2021 +++ src/sys/arch/alpha/alpha/db_disasm.c Mon Jun 21 02:10:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_disasm.c,v 1.17 2021/06/21 02:01:13 thorpej Exp $ */ +/* $NetBSD: db_disasm.c,v 1.18 2021/06/21 02:10:46 thorpej Exp $ */ /* * Mach Operating System @@ -48,7 +48,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.17 2021/06/21 02:01:13 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.18 2021/06/21 02:10:46 thorpej Exp $"); #include #include @@ -784,13 +784,6 @@ static const char * const name_of_regist static const char * register_name(struct alpha_print_instruction_context *ctx, int ireg) { - int i; - - for (i = 0; i < ctx->regcount; i++) - if (ctx->regnum[i] == ireg) - break; - if (i >= ctx->regcount) - ctx->regnum[ctx->regcount++] = ireg; return (name_of_register[ireg]); } @@ -824,12 +817,10 @@ int alpha_print_instruction(struct alpha_print_instruction_context *ctx) { const char *opcode; - int ireg; long signed_immediate; bool fstore; pal_instruction p; - ctx->regcount = 0; fstore = false; opcode = op_name[ctx->insn.mem_format.opcode]; @@ -1038,16 +1029,6 @@ loadstore_address: insn_printf(ctx, "%s(%s)", tbuf, register_name(ctx, ctx->insn.mem_format.rb)); } - /* - * For convenience, do the address computation - */ - if (ctx->showregs) { - if (ctx->insn.mem_format.opcode == op_ldah) -signed_immediate <<= 16; - insn_printf(ctx, " <0x%lx>", signed_immediate + - db_register_value(DDB_REGS, - ctx->insn.mem_format.rb)); - } break; case op_br: case op_fbeq: @@ -1084,21 +1065,6 @@ branch_displacement: insn_printf(ctx, "? 0x%x ?", ctx->insn.bits); } - /* - * Print out the registers used in this instruction - */ - if (ctx->showregs && ctx->regcount > 0) { - insn_printf(ctx, "\t<"); - for (ireg = 0; ireg < ctx->regcount; ireg++) { - if (ireg != 0) -insn_printf(ctx, ","); - insn_printf(ctx, "%s=0x%lx", - name_of_register[ctx->regnum[ireg]], - db_register_value(DDB_REGS, ctx->regnum[ireg])); - } - insn_printf(ctx, ">"); - } - /* If printing into a buffer, skip the newline. */ if (ctx->buf == NULL) { insn_printf(ctx, "\n"); @@ -1108,12 +1074,11 @@ branch_displacement: } db_addr_t -db_disasm(db_addr_t loc, bool altfmt) +db_disasm(db_addr_t loc, bool altfmt __unused) { struct alpha_print_instruction_context ctx = { .insn.bits = db_get_value(loc, 4, 0), .pc = loc, - .showregs = altfmt, }; loc += alpha_print_instruction(); Index: src/sys/arch/alpha/alpha/db_instruction.h diff -u src/sys/arch/alpha/alpha/db_instruction.h:1.11 src/sys/arch/alpha/alpha/db_instruction.h:1.12 --- src/sys/arch/alpha/alpha/db_instruction.h:1.11 Mon Jun 21 02:01:13 2021 +++ src/sys/arch/alpha/alpha/db_instruction.h Mon Jun 21 02:10:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_instruction.h,v 1.11 2021/06/21 02:01:13 thorpej Exp $ */ +/* $NetBSD: db_instruction.h,v 1.12 2021/06/21 02:10:46 thorpej Exp $ */ /* * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. @@ -748,9 +748,6 @@ struct alpha_print_instruction_context { char *buf; /* output buffer (if not DDB) */ size_t bufsize; /* size of output buffer */ size_t cursor; /* current next output location */ - int regcount; /* how many rebgs used in this insn */ - int regnum[3]; /* which regs are used in this insn */ - bool showregs; /* show registers */ }; int alpha_print_instruction(struct alpha_print_instruction_context *);
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Mon Jun 21 02:01:13 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: db_disasm.c db_instruction.h Log Message: Allow alpha_print_instruction() to be called from outside DDB, and allow the caller to supply a buffer to contain the pretty-printed insn string, rather than db_printf() (which is used if there is no supplied buffer). To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/alpha/alpha/db_disasm.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/alpha/alpha/db_instruction.h 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/alpha/alpha/db_disasm.c diff -u src/sys/arch/alpha/alpha/db_disasm.c:1.16 src/sys/arch/alpha/alpha/db_disasm.c:1.17 --- src/sys/arch/alpha/alpha/db_disasm.c:1.16 Thu Mar 20 20:51:40 2014 +++ src/sys/arch/alpha/alpha/db_disasm.c Mon Jun 21 02:01:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_disasm.c,v 1.16 2014/03/20 20:51:40 christos Exp $ */ +/* $NetBSD: db_disasm.c,v 1.17 2021/06/21 02:01:13 thorpej Exp $ */ /* * Mach Operating System @@ -48,7 +48,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.16 2014/03/20 20:51:40 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.17 2021/06/21 02:01:13 thorpej Exp $"); #include #include @@ -781,31 +781,47 @@ static const char * const name_of_regist "t10", "t11", "ra", "pv", "at", "gp", "sp", "zero" }; -static int regcount; /* how many regs used in this inst */ -static int regnum[3]; /* which regs used in this inst */ - static const char * -register_name(int ireg) +register_name(struct alpha_print_instruction_context *ctx, int ireg) { int i; - for (i = 0; i < regcount; i++) - if (regnum[i] == ireg) + for (i = 0; i < ctx->regcount; i++) + if (ctx->regnum[i] == ireg) break; - if (i >= regcount) - regnum[regcount++] = ireg; + if (i >= ctx->regcount) + ctx->regnum[ctx->regcount++] = ireg; return (name_of_register[ireg]); } +static void +insn_printf(struct alpha_print_instruction_context *ctx, +const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + + if (ctx->buf != NULL) { + if (ctx->cursor < ctx->bufsize) { + ctx->cursor += vsnprintf(ctx->buf + ctx->cursor, + ctx->bufsize - ctx->cursor, fmt, ap); + } + } else { + db_vprintf(fmt, ap); + } + + va_end(ap); +} + /* * Disassemble instruction at 'loc'. 'altfmt' specifies an * (optional) alternate format. Return address of start of * next instruction. */ -static int -alpha_print_instruction(db_addr_t iadr, alpha_instruction i, -bool showregs) +int +alpha_print_instruction(struct alpha_print_instruction_context *ctx) { const char *opcode; int ireg; @@ -813,18 +829,19 @@ alpha_print_instruction(db_addr_t iadr, bool fstore; pal_instruction p; - regcount = 0; + ctx->regcount = 0; fstore = false; - opcode = op_name[i.mem_format.opcode]; + opcode = op_name[ctx->insn.mem_format.opcode]; /* * Dispatch directly on the opcode, save code * duplication sometimes via "harmless gotos". */ - switch (i.mem_format.opcode) { + switch (ctx->insn.mem_format.opcode) { case op_pal: /* "call_pal" is a long string; just use a space. */ - db_printf("%s %s", opcode, pal_opname(i.pal_format.function)); + insn_printf(ctx, "%s %s", opcode, + pal_opname(ctx->insn.pal_format.function)); break; case op_lda: case op_ldah: @@ -846,49 +863,54 @@ alpha_print_instruction(db_addr_t iadr, * For this and the following three groups we * just need different opcode strings */ - opcode = arit_name(i.operate_lit_format.function); + opcode = arit_name(ctx->insn.operate_lit_format.function); goto operate; break; case op_logical: - opcode = logical_name(i.operate_lit_format.function); + opcode = logical_name(ctx->insn.operate_lit_format.function); goto operate; break; case op_bit: - opcode = bitop_name(i.operate_lit_format.function); + opcode = bitop_name(ctx->insn.operate_lit_format.function); goto operate; break; case op_mul: - opcode = mul_name(i.operate_lit_format.function); + opcode = mul_name(ctx->insn.operate_lit_format.function); operate: /* * Nice and uniform, just check for literals */ - db_printf("%s\t%s,", opcode, - register_name(i.operate_lit_format.ra)); - if (i.operate_lit_format.one) - db_printf("#0x%x", i.operate_lit_format.literal); - else - db_printf("%s", register_name(i.operate_reg_format.rb)); - db_printf(",%s", register_name(i.operate_lit_format.rc)); + insn_printf(ctx, "%s\t%s,", opcode, + register_name(ctx, ctx->insn.operate_lit_format.ra)); + if (ctx->insn.operate_lit_format.one) { + insn_printf(ctx, "#0x%x", + ctx->insn.operate_lit_format.literal); + } else { + insn_printf(ctx, "%s", + register_name(ctx, + ctx->insn.operate_reg_format.rb)); + } +
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun May 30 19:50:23 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Fix DEBUG build. To generate a diff of this commit: cvs rdiff -u -r1.291 -r1.292 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.291 src/sys/arch/alpha/alpha/pmap.c:1.292 --- src/sys/arch/alpha/alpha/pmap.c:1.291 Sun May 30 19:46:21 2021 +++ src/sys/arch/alpha/alpha/pmap.c Sun May 30 19:50:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.291 2021/05/30 19:46:21 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.292 2021/05/30 19:50:23 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.291 2021/05/30 19:46:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.292 2021/05/30 19:50:23 thorpej Exp $"); #include #include @@ -1933,9 +1933,6 @@ pmap_page_protect(struct vm_page *pg, vm struct pmap_tlb_context tlbctx; #ifdef DEBUG - paddr_t pa = VM_PAGE_TO_PHYS(pg); - - if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) || (prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE))) printf("pmap_page_protect(%p, %x)\n", pg, prot); @@ -2576,7 +2573,7 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa if (__predict_true(vtophys_internal(va, pap))) { #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) -printf("0x%lx (kernel vtophys)\n", pa); +printf("0x%lx (kernel vtophys)\n", *pap); #endif return true; } @@ -3278,7 +3275,7 @@ pmap_pv_dump(paddr_t pa) lock = pmap_pvh_lock(pg); mutex_enter(lock); - printf("pa 0x%lx (attrs = 0x%x):\n", pa, md->pvh_listx & PGA_ATTRS); + printf("pa 0x%lx (attrs = 0x%lx):\n", pa, md->pvh_listx & PGA_ATTRS); for (pv = VM_MDPAGE_PVS(pg); pv != NULL; pv = pv->pv_next) printf(" pmap %p, va 0x%lx\n", pv->pv_pmap, pv->pv_va); @@ -4004,7 +4001,7 @@ pmap_asn_alloc(pmap_t const pmap, struct #ifdef DEBUG if (pmapdebug & PDB_ASN) printf("pmap_asn_alloc: generation bumped to %lu\n", - ci->ci_asn_ge); + ci->ci_asn_gen); #endif }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun May 30 19:46:21 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Fix unused variable warning when DIAGNOSTIC is disabled. Pointed out by jklos. To generate a diff of this commit: cvs rdiff -u -r1.290 -r1.291 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.290 src/sys/arch/alpha/alpha/pmap.c:1.291 --- src/sys/arch/alpha/alpha/pmap.c:1.290 Sun May 30 19:41:59 2021 +++ src/sys/arch/alpha/alpha/pmap.c Sun May 30 19:46:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.290 2021/05/30 19:41:59 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.291 2021/05/30 19:46:21 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.290 2021/05/30 19:41:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.291 2021/05/30 19:46:21 thorpej Exp $"); #include #include @@ -1657,7 +1657,6 @@ pmap_destroy(pmap_t pmap) return; pt_entry_t *lev1map = pmap_lev1map(pmap); - int i; rw_enter(_growkernel_lock, RW_READER); @@ -1670,6 +1669,7 @@ pmap_destroy(pmap_t pmap) pool_cache_put(_l1pt_cache, lev1map); #ifdef DIAGNOSTIC + int i; for (i = 0; i < pmap_ncpuids; i++) { pmap->pm_percpu[i].pmc_lev1map = (pt_entry_t *)0xdeadbeefUL; }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun May 30 01:24:19 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Change pmap_physpage_alloc() to return the vm_page * so that the callers have access to it. To generate a diff of this commit: cvs rdiff -u -r1.282 -r1.283 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.282 src/sys/arch/alpha/alpha/pmap.c:1.283 --- src/sys/arch/alpha/alpha/pmap.c:1.282 Sun May 30 00:34:27 2021 +++ src/sys/arch/alpha/alpha/pmap.c Sun May 30 01:24:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.282 2021/05/30 00:34:27 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.283 2021/05/30 01:24:19 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.282 2021/05/30 00:34:27 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.283 2021/05/30 01:24:19 thorpej Exp $"); #include #include @@ -1162,7 +1162,7 @@ static u_int pmap_asn_alloc(pmap_t, stru /* * Misc. functions. */ -static bool pmap_physpage_alloc(int, paddr_t *); +static struct vm_page *pmap_physpage_alloc(int); static void pmap_physpage_free(paddr_t); static int pmap_physpage_addref(void *); static int pmap_physpage_delref(void *); @@ -3349,11 +3349,11 @@ pmap_pv_remove(pmap_t pmap, struct vm_pa static void * pmap_pv_page_alloc(struct pool *pp, int flags) { - paddr_t pg; - - if (pmap_physpage_alloc(PGU_PVENT, )) - return ((void *)ALPHA_PHYS_TO_K0SEG(pg)); - return (NULL); + struct vm_page * const pg = pmap_physpage_alloc(PGU_PVENT); + if (__predict_false(pg == NULL)) { + return NULL; + } + return (void *)ALPHA_PHYS_TO_K0SEG(VM_PAGE_TO_PHYS(pg)); } /* @@ -3376,11 +3376,10 @@ pmap_pv_page_free(struct pool *pp, void * Allocate a single page from the VM system and return the * physical address for that page. */ -static bool -pmap_physpage_alloc(int usage, paddr_t *pap) +static struct vm_page * +pmap_physpage_alloc(int usage) { struct vm_page *pg; - paddr_t pa; /* * Don't ask for a zero'd page in the L1PT case -- we will @@ -3390,7 +3389,6 @@ pmap_physpage_alloc(int usage, paddr_t * pg = uvm_pagealloc(NULL, 0, NULL, usage == PGU_L1PT ? UVM_PGA_USERESERVE : UVM_PGA_USERESERVE|UVM_PGA_ZERO); if (pg != NULL) { - pa = VM_PAGE_TO_PHYS(pg); #ifdef DEBUG struct vm_page_md * const md = VM_PAGE_TO_MD(pg); if (md->pvh_refcnt != 0) { @@ -3399,10 +3397,8 @@ pmap_physpage_alloc(int usage, paddr_t * panic("pmap_physpage_alloc"); } #endif - *pap = pa; - return (true); } - return (false); + return pg; } /* @@ -3485,7 +3481,12 @@ pmap_kptpage_alloc(paddr_t *pap) return true; } - return pmap_physpage_alloc(PGU_NORMAL, pap); + struct vm_page * const pg = pmap_physpage_alloc(PGU_NORMAL); + if (__predict_true(pg != NULL)) { + *pap = VM_PAGE_TO_PHYS(pg); + return true; + } + return false; } /* @@ -3620,15 +3621,14 @@ pmap_l1pt_ctor(void *arg, void *object, static void * pmap_l1pt_alloc(struct pool *pp, int flags) { - paddr_t ptpa; - /* * Attempt to allocate a free page. */ - if (pmap_physpage_alloc(PGU_L1PT, ) == false) - return (NULL); - - return ((void *) ALPHA_PHYS_TO_K0SEG(ptpa)); + struct vm_page * const pg = pmap_physpage_alloc(PGU_L1PT); + if (__predict_false(pg == NULL)) { + return NULL; + } + return (void *)ALPHA_PHYS_TO_K0SEG(VM_PAGE_TO_PHYS(pg)); } /* @@ -3654,18 +3654,18 @@ pmap_l1pt_free(struct pool *pp, void *v) static int pmap_ptpage_alloc(pt_entry_t * const pte, int const usage) { - paddr_t ptpa; - /* * Allocate the page table page. */ - if (pmap_physpage_alloc(usage, ) == false) - return (ENOMEM); + struct vm_page * const pg = pmap_physpage_alloc(usage); + if (__predict_false(pg == NULL)) { + return ENOMEM; + } /* * Initialize the referencing PTE. */ - const pt_entry_t npte = ((ptpa >> PGSHIFT) << PG_SHIFT) | + const pt_entry_t npte = ((VM_PAGE_TO_PHYS(pg) >> PGSHIFT) << PG_SHIFT) | PG_V | PG_KRE | PG_KWE | PG_WIRED; atomic_store_relaxed(pte, npte);
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun May 23 19:13:27 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Fix a bug in pmap_tlb_shootdown_all_user(), where it was not stashing away the pointer to the pmap in the TLB context structure like pmap_tlb_shootdown() was doing. This would result in the following failure scenario: - Page fault handler calls pmap_enter() to map a page. Mapping is the first one for that L2 PT L3 PT, meaning that an L2 PT and an L3 PT must be allocated. - L2 PT allocation succeeds. - L3 PT allocation fails under memory pressure. - pmap_enter() goes to drop the reference on the L2 PT, which, because it was the first of its mappings, frees the L2 PT. Becuse PALcode may have already tried to service a TLB miss though that L2 PT, we must issue an all-user-VA shootdown, and call pmap_tlb_shootdown_all_user() to do so. - pmap_tlb_shootnow() is called and an assert fires because the TLB context structure does not point to a pmap. This did not fail in the pmap_remove() scenario because the TLB context would have already had at least one call to pmap_tlb_shootdown(), which was initializing the pmap pointer properly. PR port-alpha/56200 To generate a diff of this commit: cvs rdiff -u -r1.276 -r1.277 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.276 src/sys/arch/alpha/alpha/pmap.c:1.277 --- src/sys/arch/alpha/alpha/pmap.c:1.276 Sat Apr 3 15:29:02 2021 +++ src/sys/arch/alpha/alpha/pmap.c Sun May 23 19:13:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.276 2021/04/03 15:29:02 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.277 2021/05/23 19:13:27 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.276 2021/04/03 15:29:02 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.277 2021/05/23 19:13:27 thorpej Exp $"); #include #include @@ -743,6 +743,9 @@ pmap_tlb_shootdown_all_user(pmap_t const TLB_CTX_SET_FLAG(tlbctx, TLB_CTX_F_IMB); } + KASSERT(tlbctx->t_pmap == NULL || tlbctx->t_pmap == pmap); + tlbctx->t_pmap = pmap; + TLB_CTX_SET_ALLVA(tlbctx); }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun May 23 01:00:53 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: locore.s Log Message: Fix an error introduced in rev 1.130 where the previous pcb_onfault handler was not restored properly in the kcopyerr case. Also add a comment explaining why it's save for these routines to be wrappers around memcpy(). Fixes port-alpha/56197. To generate a diff of this commit: cvs rdiff -u -r1.136 -r1.137 src/sys/arch/alpha/alpha/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/alpha/alpha/locore.s diff -u src/sys/arch/alpha/alpha/locore.s:1.136 src/sys/arch/alpha/alpha/locore.s:1.137 --- src/sys/arch/alpha/alpha/locore.s:1.136 Sat Sep 19 01:32:16 2020 +++ src/sys/arch/alpha/alpha/locore.s Sun May 23 01:00:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.136 2020/09/19 01:32:16 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.137 2021/05/23 01:00:53 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.136 2020/09/19 01:32:16 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.137 2021/05/23 01:00:53 thorpej Exp $"); #include "assym.h" @@ -987,6 +987,11 @@ NESTED(copyoutstr, 4, 16, ra, IM_RA|IM_S * kcopy() _must_ save and restore the old fault handler since it is * called by uiomove(), which may be in the path of servicing a non-fatal * page fault. + * + * N.B. This implementation is a wrapper around memcpy(), which is + * implemented in src/common/lib/libc/arch/alpha/string/bcopy.S. + * This is safe ONLY because we know that, as implemented, it is + * a LEAF function (and thus does not use any callee-saved registers). */ NESTED(kcopy, 3, 32, ra, IM_RA|IM_S0|IM_S1, 0) LDGP(pv) @@ -1016,10 +1021,7 @@ NESTED(kcopy, 3, 32, ra, IM_RA|IM_S0|IM_ LEAF(kcopyerr, 0) LDGP(pv) - .set noat - ldq at_reg, L_PCB(s1) /* restore the old handler. */ - stq s0, PCB_ONFAULT(at_reg) - .set at + stq s0, PCB_ONFAULT(s1) /* s1 == pcb (from above)*/ ldq ra, (32-8)(sp) /* restore ra. */ ldq s0, (32-16)(sp) /* restore s0. */ ldq s1, (32-24)(sp) /* restore s1. */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat May 22 15:05:37 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: autoconf.c Log Message: Gah, fix cut-and-paste-o. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/arch/alpha/alpha/autoconf.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/alpha/alpha/autoconf.c diff -u src/sys/arch/alpha/alpha/autoconf.c:1.56 src/sys/arch/alpha/alpha/autoconf.c:1.57 --- src/sys/arch/alpha/alpha/autoconf.c:1.56 Sat May 22 15:04:33 2021 +++ src/sys/arch/alpha/alpha/autoconf.c Sat May 22 15:05:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.56 2021/05/22 15:04:33 thorpej Exp $ */ +/* $NetBSD: autoconf.c,v 1.57 2021/05/22 15:05:36 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -42,7 +42,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.56 2021/05/22 15:04:33 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.57 2021/05/22 15:05:36 thorpej Exp $"); #include "pci.h" @@ -116,13 +116,6 @@ qemu_find_rootdev(void) } } - if (prom_qemu_getenv("rootdev", buf, sizeof(buf))) { - snprintf(bootinfo.booted_dev, sizeof(bootinfo.booted_dev), - "rootdev=%s", buf); - booted_device = device_find_by_xname(buf); - return; - } - const size_t devlen = strlen("/dev/"); const char *cp = buf; char *ecp = [sizeof(buf) - 1];
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat May 22 15:04:34 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: autoconf.c Log Message: qemu_find_rootdev(): Zero the buffer that we use to fetch the Qemu "prom" root device variable; junk past the trailing NUL would cause the way we parse the string to fail. Also parse rootdev= and root= the same way ("be liberal in what you accept" approach). To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/arch/alpha/alpha/autoconf.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/alpha/alpha/autoconf.c diff -u src/sys/arch/alpha/alpha/autoconf.c:1.55 src/sys/arch/alpha/alpha/autoconf.c:1.56 --- src/sys/arch/alpha/alpha/autoconf.c:1.55 Sat Oct 3 17:31:46 2020 +++ src/sys/arch/alpha/alpha/autoconf.c Sat May 22 15:04:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.55 2020/10/03 17:31:46 thorpej Exp $ */ +/* $NetBSD: autoconf.c,v 1.56 2021/05/22 15:04:33 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -42,7 +42,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.55 2020/10/03 17:31:46 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.56 2021/05/22 15:04:33 thorpej Exp $"); #include "pci.h" @@ -100,11 +100,22 @@ cpu_configure(void) static void qemu_find_rootdev(void) { - char buf[32]; + char buf[32] = { 0 }; /* * Check for "rootdev=wd0". */ + if (! prom_qemu_getenv("rootdev", buf, sizeof(buf))) { + /* + * Check "root=/dev/wd0a", "root=/dev/hda1", etc. + */ + if (! prom_qemu_getenv("root", buf, sizeof(buf))) { + printf("WARNING: no rootdev= or root= arguments " + "provided by Qemu\n"); + return; + } + } + if (prom_qemu_getenv("rootdev", buf, sizeof(buf))) { snprintf(bootinfo.booted_dev, sizeof(bootinfo.booted_dev), "rootdev=%s", buf); @@ -112,35 +123,26 @@ qemu_find_rootdev(void) return; } - /* - * Check for "root=/dev/wd0a", "root=/dev/hda1", etc. - */ - if (prom_qemu_getenv("root", buf, sizeof(buf))) { - const size_t devlen = strlen("/dev/"); - const char *cp = buf; - char *ecp = [sizeof(buf) - 1]; - - snprintf(bootinfo.booted_dev, sizeof(bootinfo.booted_dev), - "root=%s", buf); - - /* Find the start of the device xname. */ - if (strlen(cp) > devlen && strncmp(cp, "/dev/", devlen) == 0) { - cp += devlen; - } + const size_t devlen = strlen("/dev/"); + const char *cp = buf; + char *ecp = [sizeof(buf) - 1]; + + /* Find the start of the device xname. */ + if (strlen(cp) > devlen && strncmp(cp, "/dev/", devlen) == 0) { + cp += devlen; + } - /* Now strip any partition letter off the end. */ - while (ecp != cp) { - if (*ecp >= '0' && *ecp <= '9') { -break; - } - *ecp-- = '\0'; + /* Now strip any partition letter off the end. */ + while (ecp != cp) { + if (*ecp >= '0' && *ecp <= '9') { + break; } - - booted_device = device_find_by_xname(cp); - return; + *ecp-- = '\0'; } - printf("WARNING: no rootdev= or root= arguments provided by Qemu\n"); + snprintf(bootinfo.booted_dev, sizeof(bootinfo.booted_dev), + "root=%s", cp); + booted_device = device_find_by_xname(cp); } void
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed May 5 15:34:54 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: interrupt.c machdep.c Log Message: Disable preemption around the main work of badaddr_read() and delay(); they both use "current CPU" resources. To generate a diff of this commit: cvs rdiff -u -r1.96 -r1.97 src/sys/arch/alpha/alpha/interrupt.c cvs rdiff -u -r1.369 -r1.370 src/sys/arch/alpha/alpha/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/alpha/alpha/interrupt.c diff -u src/sys/arch/alpha/alpha/interrupt.c:1.96 src/sys/arch/alpha/alpha/interrupt.c:1.97 --- src/sys/arch/alpha/alpha/interrupt.c:1.96 Wed May 5 14:58:57 2021 +++ src/sys/arch/alpha/alpha/interrupt.c Wed May 5 15:34:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: interrupt.c,v 1.96 2021/05/05 14:58:57 thorpej Exp $ */ +/* $NetBSD: interrupt.c,v 1.97 2021/05/05 15:34:54 thorpej Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.96 2021/05/05 14:58:57 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.97 2021/05/05 15:34:54 thorpej Exp $"); #include #include @@ -383,6 +383,9 @@ badaddr(void *addr, size_t size) int badaddr_read(void *addr, size_t size, void *rptr) { + lwp_t * const l = curlwp; + KPREEMPT_DISABLE(l); + struct mchkinfo *mcp = ()->ci_mcinfo; long rcpt; int rv; @@ -450,6 +453,9 @@ badaddr_read(void *addr, size_t size, vo break; } } + + KPREEMPT_ENABLE(l); + /* Return non-zero (i.e. true) if it's a bad address. */ return (rv); } Index: src/sys/arch/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.369 src/sys/arch/alpha/alpha/machdep.c:1.370 --- src/sys/arch/alpha/alpha/machdep.c:1.369 Thu Oct 15 01:00:01 2020 +++ src/sys/arch/alpha/alpha/machdep.c Wed May 5 15:34:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.369 2020/10/15 01:00:01 thorpej Exp $ */ +/* $NetBSD: machdep.c,v 1.370 2021/05/05 15:34:54 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2019, 2020 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.369 2020/10/15 01:00:01 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.370 2021/05/05 15:34:54 thorpej Exp $"); #include #include @@ -1706,6 +1706,9 @@ delay(unsigned long n) return; } + lwp_t * const l = curlwp; + KPREEMPT_DISABLE(l); + pcc0 = alpha_rpcc() & 0xUL; cycles = 0; usec = 0; @@ -1734,6 +1737,8 @@ delay(unsigned long n) } pcc0 = pcc1; } + + KPREEMPT_ENABLE(l); } #ifdef EXEC_ECOFF
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed May 5 14:58:57 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: interrupt.c Log Message: Make scb_strat() static. To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/arch/alpha/alpha/interrupt.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/alpha/alpha/interrupt.c diff -u src/sys/arch/alpha/alpha/interrupt.c:1.95 src/sys/arch/alpha/alpha/interrupt.c:1.96 --- src/sys/arch/alpha/alpha/interrupt.c:1.95 Tue Apr 20 01:29:40 2021 +++ src/sys/arch/alpha/alpha/interrupt.c Wed May 5 14:58:57 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: interrupt.c,v 1.95 2021/04/20 01:29:40 thorpej Exp $ */ +/* $NetBSD: interrupt.c,v 1.96 2021/05/05 14:58:57 thorpej Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.95 2021/04/20 01:29:40 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.96 2021/05/05 14:58:57 thorpej Exp $"); #include #include @@ -92,7 +92,7 @@ __KERNEL_RCSID(0, "$NetBSD: interrupt.c, struct scbvec scb_iovectab[SCB_VECTOIDX(SCB_SIZE - SCB_IOVECBASE)] __read_mostly; -void scb_stray(void *, u_long); +static void scb_stray(void *, u_long); void scb_init(void) @@ -105,7 +105,7 @@ scb_init(void) } } -void +static void scb_stray(void *arg, u_long vec) {
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed May 5 03:54:16 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: cpu.c Log Message: Decorate cpu_info_list with __read_mostly; it's never modified once all the CPUs are attached. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/sys/arch/alpha/alpha/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/alpha/alpha/cpu.c diff -u src/sys/arch/alpha/alpha/cpu.c:1.103 src/sys/arch/alpha/alpha/cpu.c:1.104 --- src/sys/arch/alpha/alpha/cpu.c:1.103 Thu Oct 15 01:00:01 2020 +++ src/sys/arch/alpha/alpha/cpu.c Wed May 5 03:54:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.103 2020/10/15 01:00:01 thorpej Exp $ */ +/* $NetBSD: cpu.c,v 1.104 2021/05/05 03:54:16 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.103 2020/10/15 01:00:01 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.104 2021/05/05 03:54:16 thorpej Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -84,7 +84,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.10 struct cpu_info cpu_info_primary __cacheline_aligned = { .ci_curlwp = }; -struct cpu_info *cpu_info_list = _info_primary; +struct cpu_info *cpu_info_list __read_mostly = _info_primary; #if defined(MULTIPROCESSOR) /*
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Apr 20 01:29:40 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: interrupt.c Log Message: Don't use atomics to manipulate cpu_info::ci_intrdepth: it's modified only in the interrupt service path by the owning CPU, at entry and exit. Even if the r/m/w cycle of incrementing the value were interrupted, the result would still be the same because the interrupting frame will have completed its own symmetrical increment/decrement cycle upon return. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/arch/alpha/alpha/interrupt.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/alpha/alpha/interrupt.c diff -u src/sys/arch/alpha/alpha/interrupt.c:1.94 src/sys/arch/alpha/alpha/interrupt.c:1.95 --- src/sys/arch/alpha/alpha/interrupt.c:1.94 Tue Apr 20 00:09:45 2021 +++ src/sys/arch/alpha/alpha/interrupt.c Tue Apr 20 01:29:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: interrupt.c,v 1.94 2021/04/20 00:09:45 thorpej Exp $ */ +/* $NetBSD: interrupt.c,v 1.95 2021/04/20 01:29:40 thorpej Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.94 2021/04/20 00:09:45 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.95 2021/04/20 01:29:40 thorpej Exp $"); #include #include @@ -193,7 +193,7 @@ interrupt(unsigned long a0, unsigned lon switch (a0) { case ALPHA_INTR_XPROC: /* interprocessor interrupt */ #if defined(MULTIPROCESSOR) - atomic_inc_ulong(>ci_intrdepth); + ci->ci_intrdepth++; alpha_ipi_process(ci, framep); @@ -205,7 +205,7 @@ interrupt(unsigned long a0, unsigned lon hwrpb->rpb_txrdy != 0) cpu_iccb_receive(); - atomic_dec_ulong(>ci_intrdepth); + ci->ci_intrdepth--; #else printf("WARNING: received interprocessor interrupt!\n"); #endif /* MULTIPROCESSOR */ @@ -226,7 +226,7 @@ interrupt(unsigned long a0, unsigned lon * "was processing interrupts when the clock interrupt * happened". */ - atomic_add_long(>ci_intrdepth, 0x10); + ci->ci_intrdepth += 0x10; sc->sc_evcnt_clock.ev_count++; ci->ci_data.cpu_nintr++; if (platform.clockintr) { @@ -251,18 +251,18 @@ interrupt(unsigned long a0, unsigned lon schedhz != 0) schedclock(ci->ci_curlwp); } - atomic_add_long(>ci_intrdepth, -0x10); + ci->ci_intrdepth -= 0x10; break; case ALPHA_INTR_ERROR: /* Machine Check or Correctable Error */ - atomic_inc_ulong(>ci_intrdepth); + ci->ci_intrdepth++; a0 = alpha_pal_rdmces(); if (platform.mcheck_handler != NULL && (void *)framep->tf_regs[FRAME_PC] != XentArith) (*platform.mcheck_handler)(a0, framep, a1, a2); else machine_check(a0, framep, a1, a2); - atomic_dec_ulong(>ci_intrdepth); + ci->ci_intrdepth--; break; case ALPHA_INTR_DEVICE: /* I/O device interrupt */ @@ -272,14 +272,14 @@ interrupt(unsigned long a0, unsigned lon KDASSERT(a1 >= SCB_IOVECBASE && a1 < SCB_SIZE); atomic_inc_ulong(>sc_evcnt_device.ev_count); - atomic_inc_ulong(>ci_intrdepth); + ci->ci_intrdepth++; ci->ci_data.cpu_nintr++; struct scbvec * const scb = _iovectab[idx]; (*scb->scb_func)(scb->scb_arg, a1); - atomic_dec_ulong(>ci_intrdepth); + ci->ci_intrdepth--; break; }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: rin Date: Thu Apr 15 00:19:52 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: interrupt.c Log Message: Contrary to comment here, nowadays hardclock() and statclock() should be called with cpu_intr_p() is turning on, if used from the interrupt context. Otherwise, entropy_enter() is used instead of entropy_enter_intr(), which results in KASSERT() failure. Therefore, bump ci_intrdepth for clock interrupt. Remove stale comment also. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/arch/alpha/alpha/interrupt.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/alpha/alpha/interrupt.c diff -u src/sys/arch/alpha/alpha/interrupt.c:1.92 src/sys/arch/alpha/alpha/interrupt.c:1.93 --- src/sys/arch/alpha/alpha/interrupt.c:1.92 Sat Oct 10 03:05:04 2020 +++ src/sys/arch/alpha/alpha/interrupt.c Thu Apr 15 00:19:52 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: interrupt.c,v 1.92 2020/10/10 03:05:04 thorpej Exp $ */ +/* $NetBSD: interrupt.c,v 1.93 2021/04/15 00:19:52 rin Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.92 2020/10/10 03:05:04 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.93 2021/04/15 00:19:52 rin Exp $"); #include #include @@ -212,12 +212,7 @@ interrupt(unsigned long a0, unsigned lon break; case ALPHA_INTR_CLOCK: /* clock interrupt */ - /* - * We don't increment the interrupt depth for the - * clock interrupt, since it is *sampled* from - * the clock interrupt, so if we did, all system - * time would be counted as interrupt time. - */ + atomic_inc_ulong(>ci_intrdepth); sc->sc_evcnt_clock.ev_count++; ci->ci_data.cpu_nintr++; if (platform.clockintr) { @@ -242,6 +237,7 @@ interrupt(unsigned long a0, unsigned lon schedhz != 0) schedclock(ci->ci_curlwp); } + atomic_dec_ulong(>ci_intrdepth); break; case ALPHA_INTR_ERROR: /* Machine Check or Correctable Error */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat Apr 3 15:29:02 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Slight tweak to last: Our IPL gets raised to IPL_SCHED by simply *trying* to acquire the pmap activation lock, regardless of whether or not that was successful. So, in addition to remember if we acquired it, also remember if we tried, and drop back to IPL_VM if so. To generate a diff of this commit: cvs rdiff -u -r1.275 -r1.276 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.275 src/sys/arch/alpha/alpha/pmap.c:1.276 --- src/sys/arch/alpha/alpha/pmap.c:1.275 Sat Apr 3 14:56:13 2021 +++ src/sys/arch/alpha/alpha/pmap.c Sat Apr 3 15:29:02 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.275 2021/04/03 14:56:13 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.276 2021/04/03 15:29:02 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.275 2021/04/03 14:56:13 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.276 2021/04/03 15:29:02 thorpej Exp $"); #include #include @@ -915,7 +915,7 @@ pmap_tlb_shootnow(const struct pmap_tlb_ const struct cpu_info *ci = curcpu(); const u_long this_cpu = 1UL << ci->ci_cpuid; u_long active_cpus; - bool activation_locked; + bool activation_locked, activation_lock_tried; /* * Figure out who to notify. If it's for the kernel or @@ -929,6 +929,7 @@ pmap_tlb_shootnow(const struct pmap_tlb_ if (TLB_CTX_FLAGS(tlbctx) & (TLB_CTX_F_ASM | TLB_CTX_F_MULTI)) { active_cpus = pmap_all_cpus(); activation_locked = false; + activation_lock_tried = false; } else { KASSERT(tlbctx->t_pmap != NULL); activation_locked = PMAP_ACT_TRYLOCK(tlbctx->t_pmap); @@ -938,6 +939,7 @@ pmap_tlb_shootnow(const struct pmap_tlb_ TLB_COUNT(shootnow_over_notify); active_cpus = pmap_all_cpus(); } + activation_lock_tried = true; } #if defined(MULTIPROCESSOR) @@ -959,14 +961,17 @@ pmap_tlb_shootnow(const struct pmap_tlb_ * Now that the remotes have been notified, release the * activation lock. */ - if (activation_locked) { - KASSERT(tlbctx->t_pmap != NULL); - PMAP_ACT_UNLOCK(tlbctx->t_pmap); + if (activation_lock_tried) { + if (activation_locked) { + KASSERT(tlbctx->t_pmap != NULL); + PMAP_ACT_UNLOCK(tlbctx->t_pmap); + } /* - * When we acquired the activation lock, we - * raised IPL to IPL_SCHED, which blocks out - * IPIs. Force our IPL back down to IPL_VM - * so that we can receive IPIs. + * When we tried to acquire the activation lock, we + * raised IPL to IPL_SCHED (even if we ultimately + * failed to acquire the lock), which blocks out IPIs. + * Force our IPL back down to IPL_VM so that we can + * receive IPIs. */ alpha_pal_swpipl(IPL_VM); }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: tnn Date: Sun Feb 28 21:34:34 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: sys_machdep.c Log Message: support building alpha kernel without PCI bus To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/sys_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/alpha/alpha/sys_machdep.c diff -u src/sys/arch/alpha/alpha/sys_machdep.c:1.21 src/sys/arch/alpha/alpha/sys_machdep.c:1.22 --- src/sys/arch/alpha/alpha/sys_machdep.c:1.21 Mon Feb 6 02:14:12 2012 +++ src/sys/arch/alpha/alpha/sys_machdep.c Sun Feb 28 21:34:34 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_machdep.c,v 1.21 2012/02/06 02:14:12 matt Exp $ */ +/* $NetBSD: sys_machdep.c,v 1.22 2021/02/28 21:34:34 tnn Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.21 2012/02/06 02:14:12 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.22 2021/02/28 21:34:34 tnn Exp $"); #include #include @@ -188,6 +188,7 @@ sys_sysarch(struct lwp *l, const struct break; } +#if NPCI > 0 case ALPHA_PCI_CONF_READWRITE: { struct alpha_pci_conf_readwrite_args args; @@ -222,6 +223,7 @@ sys_sysarch(struct lwp *l, const struct } break; } +#endif default: error = EINVAL;
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Dec 29 17:16:15 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: >From the Infinitesimal Optimizations Department: in pmap_kremove(), update the globally visible stats outside of the loop. To generate a diff of this commit: cvs rdiff -u -r1.273 -r1.274 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.273 src/sys/arch/alpha/alpha/pmap.c:1.274 --- src/sys/arch/alpha/alpha/pmap.c:1.273 Fri Sep 11 03:54:14 2020 +++ src/sys/arch/alpha/alpha/pmap.c Tue Dec 29 17:16:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.273 2020/09/11 03:54:14 simonb Exp $ */ +/* $NetBSD: pmap.c,v 1.274 2020/12/29 17:16:15 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.273 2020/09/11 03:54:14 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.274 2020/12/29 17:16:15 thorpej Exp $"); #include #include @@ -2309,6 +2309,7 @@ pmap_kremove(vaddr_t va, vsize_t size) pt_entry_t *pte, opte; pmap_t const pmap = pmap_kernel(); struct pmap_tlb_context tlbctx; + int count = 0; #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_ENTER)) @@ -2330,12 +2331,16 @@ pmap_kremove(vaddr_t va, vsize_t size) atomic_store_relaxed(pte, PG_NV); pmap_tlb_shootdown(pmap, va, opte, ); - /* Update stats. */ - PMAP_STAT_DECR(pmap->pm_stats.resident_count, 1); - PMAP_STAT_DECR(pmap->pm_stats.wired_count, 1); + count++; } } + /* Update stats. */ + if (__predict_true(count != 0)) { + PMAP_STAT_DECR(pmap->pm_stats.resident_count, count); + PMAP_STAT_DECR(pmap->pm_stats.wired_count, count); + } + pmap_tlb_shootnow(); TLB_COUNT(reason_kremove); }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun Oct 11 18:39:48 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: qemu.c Log Message: initclocks() now fixes up tick and tickadj if hz changes, so we no longer need to do it. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/alpha/qemu.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/alpha/alpha/qemu.c diff -u src/sys/arch/alpha/alpha/qemu.c:1.4 src/sys/arch/alpha/alpha/qemu.c:1.5 --- src/sys/arch/alpha/alpha/qemu.c:1.4 Wed Oct 7 14:07:42 2020 +++ src/sys/arch/alpha/alpha/qemu.c Sun Oct 11 18:39:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: qemu.c,v 1.4 2020/10/07 14:07:42 thorpej Exp $ */ +/* $NetBSD: qemu.c,v 1.5 2020/10/11 18:39:48 thorpej Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -147,13 +147,9 @@ qemu_clock_init(void * const v __unused) /* * hz=1024 is a little bananas for an emulated - * virtual machine. Reset to something more - * reasonable, and recalculate everything based - * on it. + * virtual machine. Let MI code drive schedhz. */ hz = 50; - tick = 100 / hz; - tickadj = (24 / (60 * hz)) ? (24 / (60 * hz)) : 1; schedhz = 0; qemu_nsec_per_tick = 10UL / hz;
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed Oct 7 14:07:42 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: qemu.c Log Message: - qemu_hardclock(): fix check for spurious hardclock call. - qemu_clock_init(): Initialize qemu_nsec_per_tick *after* adjusting hz. Error pointed out by Jonathan Kollasch. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/alpha/alpha/qemu.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/alpha/alpha/qemu.c diff -u src/sys/arch/alpha/alpha/qemu.c:1.3 src/sys/arch/alpha/alpha/qemu.c:1.4 --- src/sys/arch/alpha/alpha/qemu.c:1.3 Sat Oct 3 17:32:49 2020 +++ src/sys/arch/alpha/alpha/qemu.c Wed Oct 7 14:07:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: qemu.c,v 1.3 2020/10/03 17:32:49 thorpej Exp $ */ +/* $NetBSD: qemu.c,v 1.4 2020/10/07 14:07:42 thorpej Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -121,7 +121,7 @@ qemu_set_alarm_relative(unsigned long ns static void qemu_hardclock(struct clockframe * const framep) { - if (__predict_false(qemu_nsec_per_tick == 0)) { + if (__predict_false(qemu_nsec_per_tick == (unsigned long)-1)) { /* Spurious; qemu_clock_init() hasn't been called yet. */ return; } @@ -138,7 +138,6 @@ qemu_clock_init(void * const v __unused) /* First-time initialization... */ if (qemu_nsec_per_tick == (unsigned long)-1) { KASSERT(CPU_IS_PRIMARY(curcpu())); - qemu_nsec_per_tick = 10UL / hz; /* * Override the clockintr routine; the Qemu alarm is @@ -157,6 +156,8 @@ qemu_clock_init(void * const v __unused) tickadj = (24 / (60 * hz)) ? (24 / (60 * hz)) : 1; schedhz = 0; + qemu_nsec_per_tick = 10UL / hz; + printf("Using the Qemu CPU alarm for %d Hz hardclock.\n", hz); }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat Oct 3 17:32:49 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: qemu.c Log Message: Provide an alternate delay function that uses the Qemu get-time hypercall. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/alpha/alpha/qemu.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/alpha/alpha/qemu.c diff -u src/sys/arch/alpha/alpha/qemu.c:1.2 src/sys/arch/alpha/alpha/qemu.c:1.3 --- src/sys/arch/alpha/alpha/qemu.c:1.2 Tue Sep 29 01:33:00 2020 +++ src/sys/arch/alpha/alpha/qemu.c Sat Oct 3 17:32:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: qemu.c,v 1.2 2020/09/29 01:33:00 thorpej Exp $ */ +/* $NetBSD: qemu.c,v 1.3 2020/10/03 17:32:49 thorpej Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -56,8 +56,10 @@ struct qemu_softc { struct timecounter sc_tc; }; -static u_int -qemu_get_timecount(struct timecounter * const tc __unused) +static unsigned long qemu_nsec_per_tick __read_mostly = (unsigned long)-1; + +static inline unsigned long +qemu_get_vmtime(void) { register unsigned long v0 __asm("$0"); register unsigned long a0 __asm("$16") = 7; /* Qemu get-time */ @@ -67,7 +69,41 @@ qemu_get_timecount(struct timecounter * : "i"(PAL_cserve) : "$17", "$18", "$19", "$20", "$21"); - return (u_int)v0; + return v0; +} + +static void +qemu_delay(unsigned long usec) +{ + /* Get starting point. */ + const unsigned long base = qemu_get_vmtime(); + + /* convert request from usec to nsec */ + const unsigned long nsec = usec * 1000; + KASSERT(nsec > usec); + + /* Figure out finish line. */ + const unsigned long finished = base + nsec; + KASSERT(finished > base); + + unsigned long now; + + /* Spin until we're finished. */ + while ((now = qemu_get_vmtime()) < finished) { + /* + * If we have more than one clock tick worth of spinning + * to do, when use WTINT to wait at a low power state. + */ + if (finished - now > qemu_nsec_per_tick) { + alpha_pal_wtint(0); + } + } +} + +static u_int +qemu_get_timecount(struct timecounter * const tc __unused) +{ + return (u_int)qemu_get_vmtime(); } static inline void @@ -82,8 +118,6 @@ qemu_set_alarm_relative(unsigned long ns : "$0", "$18", "$19", "$20", "$21"); } -static unsigned long qemu_nsec_per_tick __read_mostly; - static void qemu_hardclock(struct clockframe * const framep) { @@ -102,7 +136,7 @@ static void qemu_clock_init(void * const v __unused) { /* First-time initialization... */ - if (qemu_nsec_per_tick == 0) { + if (qemu_nsec_per_tick == (unsigned long)-1) { KASSERT(CPU_IS_PRIMARY(curcpu())); qemu_nsec_per_tick = 10UL / hz; @@ -175,6 +209,11 @@ qemu_attach(device_t parent, device_t se * Qemu's PALcode implements WTINT; use it to save host cycles. */ cpu_idle_fn = cpu_idle_wtint; + + /* + * Use Qemu's "VM time" hypercall to implement delay(). + */ + alpha_delay_fn = qemu_delay; } CFATTACH_DECL_NEW(qemu, sizeof(struct qemu_softc),
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: skrll Date: Thu Oct 1 07:21:36 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: mcclock.c Log Message: Fix build To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/alpha/mcclock.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/alpha/alpha/mcclock.c diff -u src/sys/arch/alpha/alpha/mcclock.c:1.20 src/sys/arch/alpha/alpha/mcclock.c:1.21 --- src/sys/arch/alpha/alpha/mcclock.c:1.20 Thu Oct 1 06:59:34 2020 +++ src/sys/arch/alpha/alpha/mcclock.c Thu Oct 1 07:21:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mcclock.c,v 1.20 2020/10/01 06:59:34 skrll Exp $ */ +/* $NetBSD: mcclock.c,v 1.21 2020/10/01 07:21:36 skrll Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,12 +29,13 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.20 2020/10/01 06:59:34 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.21 2020/10/01 07:21:36 skrll Exp $"); #include "opt_clock_compat_osf1.h" #include #include +#include #include #include #include
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: skrll Date: Thu Oct 1 06:59:34 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: mcclock.c Log Message: KNF To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/alpha/mcclock.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/alpha/alpha/mcclock.c diff -u src/sys/arch/alpha/alpha/mcclock.c:1.19 src/sys/arch/alpha/alpha/mcclock.c:1.20 --- src/sys/arch/alpha/alpha/mcclock.c:1.19 Tue Sep 29 01:20:59 2020 +++ src/sys/arch/alpha/alpha/mcclock.c Thu Oct 1 06:59:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mcclock.c,v 1.19 2020/09/29 01:20:59 thorpej Exp $ */ +/* $NetBSD: mcclock.c,v 1.20 2020/10/01 06:59:34 skrll Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,17 +29,17 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.19 2020/09/29 01:20:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.20 2020/10/01 06:59:34 skrll Exp $"); #include "opt_clock_compat_osf1.h" #include -#include -#include +#include #include +#include #include +#include -#include #include #include
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Sep 29 01:20:59 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: mcclock.c Log Message: mcclock_init(): Only do our work if called on the primary CPU. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/alpha/mcclock.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/alpha/alpha/mcclock.c diff -u src/sys/arch/alpha/alpha/mcclock.c:1.18 src/sys/arch/alpha/alpha/mcclock.c:1.19 --- src/sys/arch/alpha/alpha/mcclock.c:1.18 Mon Nov 21 19:50:37 2011 +++ src/sys/arch/alpha/alpha/mcclock.c Tue Sep 29 01:20:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mcclock.c,v 1.18 2011/11/21 19:50:37 christos Exp $ */ +/* $NetBSD: mcclock.c,v 1.19 2020/09/29 01:20:59 thorpej Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.18 2011/11/21 19:50:37 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcclock.c,v 1.19 2020/09/29 01:20:59 thorpej Exp $"); #include "opt_clock_compat_osf1.h" @@ -37,6 +37,7 @@ __KERNEL_RCSID(0, "$NetBSD: mcclock.c,v #include #include #include +#include #include #include @@ -136,6 +137,11 @@ mcclock_init(void *dev) { struct mc146818_softc *sc = dev; + /* Only do this on the primary CPU. */ + if (! CPU_IS_PRIMARY(curcpu())) { + return; + } + /* enable interval clock interrupt */ (*sc->sc_mcwrite)(sc, MC_REGA, MC_BASE_32_KHz | MC_RATE_1024_Hz); (*sc->sc_mcwrite)(sc, MC_REGB,
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun Sep 27 23:17:36 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: clock.c Log Message: Don't use the PCC timecunter on emulated Qemu systems. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/alpha/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/alpha/alpha/clock.c diff -u src/sys/arch/alpha/alpha/clock.c:1.43 src/sys/arch/alpha/alpha/clock.c:1.44 --- src/sys/arch/alpha/alpha/clock.c:1.43 Fri Sep 4 03:41:49 2020 +++ src/sys/arch/alpha/alpha/clock.c Sun Sep 27 23:17:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.43 2020/09/04 03:41:49 thorpej Exp $ */ +/* $NetBSD: clock.c,v 1.44 2020/09/27 23:17:36 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.43 2020/09/04 03:41:49 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.44 2020/09/27 23:17:36 thorpej Exp $"); #include #include @@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1. #include #include +#include #include #include #include @@ -78,7 +79,6 @@ clockattach(void (*fns)(void *), void *d void cpu_initclocks(void) { - uint64_t pcc_freq; if (clock_init == NULL) panic("cpu_initclocks: no clock attached"); @@ -99,10 +99,13 @@ cpu_initclocks(void) schedhz = 16; /* - * Initialize PCC timecounter. + * Initialize PCC timecounter, unless we're running in Qemu + * (we will use a different timecounter in that case). */ - pcc_freq = cpu_frequency(curcpu()); - cc_init(NULL, pcc_freq, "PCC", PCC_QUAL); + if (! alpha_is_qemu) { + const uint64_t pcc_freq = cpu_frequency(curcpu()); + cc_init(NULL, pcc_freq, "PCC", PCC_QUAL); + } /* * Get the clock started.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat Sep 19 01:32:16 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: locore.s Log Message: - The Alpha fast-soft-intrs implementation supports 2 soft interrupt levels, so in exception_return() ensure we clear ineligible-at-new-IPL softint bits from the SSIR, otherwise we could loop forever in the following scenario: processing softnet -> clock interrupt -> schedule softclock - If the softint thread blocks, it's possible to bounce back through the softint return trampoline at something other than IPL_HIGH. This is not a problem other than it's contrary to what alpha_softint_dispatch() expect, so make alpha_softint_return() go to IPL_HIGH before it does anything else. These two fixes make fast-soft-interrupts work on Alpha. To generate a diff of this commit: cvs rdiff -u -r1.135 -r1.136 src/sys/arch/alpha/alpha/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/alpha/alpha/locore.s diff -u src/sys/arch/alpha/alpha/locore.s:1.135 src/sys/arch/alpha/alpha/locore.s:1.136 --- src/sys/arch/alpha/alpha/locore.s:1.135 Fri Sep 18 00:11:31 2020 +++ src/sys/arch/alpha/alpha/locore.s Sat Sep 19 01:32:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.135 2020/09/18 00:11:31 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.136 2020/09/19 01:32:16 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.135 2020/09/18 00:11:31 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.136 2020/09/19 01:32:16 thorpej Exp $"); #include "assym.h" @@ -265,9 +265,21 @@ LEAF(exception_return, 1) /* XXX shoul GET_CURLWP mov v0, s0/* s0 = curlwp */ - /* see if a soft interrupt is pending. */ -2: ldq t1, L_CPU(s0) /* t1 = curlwp->l_cpu */ - ldq t1, CPU_INFO_SSIR(t1) /* soft int pending? */ +2: /* + * Check to see if a soft interrupt is pending. We need to only + * check for soft ints eligible to run at the new IPL. We generate + * the mask of elible soft ints to run by masking the ssir with: + * + * (ALPHA_ALL_SOFTINTS << ((ipl) << 1)) + * + * See alpha_softint_dispatch(). + */ + ldq t1, L_CPU(s0) /* t1 = curlwp->l_cpu */ + ldiq t2, ALPHA_ALL_SOFTINTS /* t2 = ALPHA_ALL_SOFTINTS */ + ldq t1, CPU_INFO_SSIR(t1) /* t1 = t1->ci_ssir */ + sll s3, 1, t3 /* t3 = ipl << 1 */ + sll t2, t3, t2 /* t2 <<= t3 */ + and t1, t2, t1 /* t1 &= t2 */ bne t1, 6f/* yes */ /* no */ @@ -743,7 +755,14 @@ NESTED_NOPROFILE(alpha_softint_switchto, LEAF_NOPROFILE(alpha_softint_return, 0) /* - * Step 1: Re-adjust the mutex count after mi_switch(). + * Step 1: Go to IPL_HIGH, which is what the alpha_softint_dispatch() + * expects. We will have arrived here at IPL_SCHED. + */ + ldiq a0, ALPHA_PSL_IPL_HIGH + call_pal PAL_OSF1_swpipl + + /* + * Step 2: Re-adjust the mutex count after mi_switch(). */ GET_CURLWP ldq v0, L_CPU(v0) @@ -752,7 +771,7 @@ LEAF_NOPROFILE(alpha_softint_return, 0) stl t0, CPU_INFO_MTX_COUNT(v0) /* - * Step 2: Pop alpha_softint_switchto()'s stack frame + * Step 3: Pop alpha_softint_switchto()'s stack frame * and return. */ ldq ra, 0(sp) /* restore ra */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Sep 18 00:11:31 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: locore.s Log Message: - Give lwp0 the same kernel thread backstop as all of the others get in cpu_lwp_fork(). - Add a bunch of comments to lwp_trampoline() to explain what's going on. - In alpha_softint_switchto() tweak how we save the RA in the stack frame. To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 src/sys/arch/alpha/alpha/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/alpha/alpha/locore.s diff -u src/sys/arch/alpha/alpha/locore.s:1.134 src/sys/arch/alpha/alpha/locore.s:1.135 --- src/sys/arch/alpha/alpha/locore.s:1.134 Thu Sep 17 00:48:56 2020 +++ src/sys/arch/alpha/alpha/locore.s Fri Sep 18 00:11:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.134 2020/09/17 00:48:56 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.135 2020/09/18 00:11:31 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.134 2020/09/17 00:48:56 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.135 2020/09/18 00:11:31 thorpej Exp $"); #include "assym.h" @@ -159,8 +159,17 @@ NESTED_NOPROFILE(locorestart,1,0,ra,0,0) /* * All ready to go! Call main()! + * + * We're going to play a little trick there, though. We are + * going to fake our return address as the kthread backstop. + * Hitting the backstop will trigger a panic, and we want lwp0 + * to work like other kthreads in that regard. We will still + * leep the "main returned" backstop here in case something + * goes horribly wrong. */ - CALL(main) + lda ra, alpha_kthread_backstop + jsr s0, main + ldgp gp, 0(s0) /* This should never happen. */ PANIC("main() returned",Lmain_returned_pmsg) @@ -669,7 +678,7 @@ NESTED_NOPROFILE(alpha_softint_switchto, ldq a3, L_PCB(a0) /* a3 = from->l_pcb */ lda sp, -16(sp) /* set up stack frame */ - stq ra, (16-8)(sp) /* save ra */ + stq ra, 0(sp) /* save ra */ /* * Step 1: Save the current LWP's context. We don't @@ -727,7 +736,7 @@ NESTED_NOPROFILE(alpha_softint_switchto, SET_CURLWP(s0) /* clobbers a0, v0, t0, t8..t11 */ ldq sp, PCB_HWPCB_KSP(a3) /* restore sp */ ldq s0, PCB_CONTEXT+(0 * 8)(a3) /* restore s0 */ - ldq ra, (16-8)(sp) /* restore ra */ + ldq ra, 0(sp) /* restore ra */ lda sp, 16(sp) /* pop stack frame */ RET END(alpha_softint_switchto) @@ -746,7 +755,7 @@ LEAF_NOPROFILE(alpha_softint_return, 0) * Step 2: Pop alpha_softint_switchto()'s stack frame * and return. */ - ldq ra, (16-8)(sp) /* restore ra */ + ldq ra, 0(sp) /* restore ra */ lda sp, 16(sp) /* pop stack frame */ RET END(alpha_softint_return) @@ -851,20 +860,22 @@ LEAF(cpu_switchto, 0) /* * lwp_trampoline() * - * Arrange for a function to be invoked neatly, after a cpu_lwp_fork(). + * Arrange for a function to be invoked neatly, after a cpu_lwp_fork(), + * which has set up our pcb_context for us. But we actually *get here* + * via cpu_switchto(), which returns the LWP we switched away from in v0. * * Invokes the function specified by the s0 register with the return * address specified by the s1 register and with one argument specified * by the s2 register. */ LEAF_NOPROFILE(lwp_trampoline, 0) - mov v0, a0 - mov s3, a1 - CALL(lwp_startup) - mov s0, pv - mov s1, ra - mov s2, a0 - jmp zero, (pv) + mov v0, a0 /* a0 = prev_lwp (from cpu_switchto()) */ + mov s3, a1 /* a1 = new_lwp (that's us!) */ + CALL(lwp_startup) /* lwp_startup(prev_lwp, new_lwp); */ + mov s0, pv /* pv = func */ + mov s1, ra /* ra = (probably exception_return()) */ + mov s2, a0 /* a0 = arg */ + jmp zero, (pv) /* func(arg) */ END(lwp_trampoline) /**/
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Sep 18 00:09:29 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: db_trace.c Log Message: - Add exception_return() to the list of trap vector symbols, which will enable us to trace back through an exception if the fault happens during the exception return. - Identify and report the kernel thread backstop when back tracing kernel threads. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/alpha/db_trace.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/alpha/alpha/db_trace.c diff -u src/sys/arch/alpha/alpha/db_trace.c:1.28 src/sys/arch/alpha/alpha/db_trace.c:1.29 --- src/sys/arch/alpha/alpha/db_trace.c:1.28 Mon Feb 6 02:14:10 2012 +++ src/sys/arch/alpha/alpha/db_trace.c Fri Sep 18 00:09:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.28 2012/02/06 02:14:10 matt Exp $ */ +/* $NetBSD: db_trace.c,v 1.29 2020/09/18 00:09:29 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.28 2012/02/06 02:14:10 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.29 2020/09/18 00:09:29 thorpej Exp $"); #include #include @@ -85,6 +85,12 @@ static struct special_symbol { { (vaddr_t), "syscall" }, { (vaddr_t), "unaligned access fault" }, { (vaddr_t), "console restart" }, + + /* + * We'll not know what trap we took, but we'll find the + * trap frame, at least... + */ + { (vaddr_t)_return, "(exception return)" }, { 0 } }; @@ -256,6 +262,16 @@ db_stack_trace_print(db_expr_t addr, boo } /* + * If the previous RA pointed at the kernel thread + * backstop, then we are at the root of the call + * graph. + */ + if (symval == (vaddr_t)_kthread_backstop) { + (*pr)("--- kernel thread backstop ---\n"); + break; + } + + /* * XXX Printing out arguments is Hard. We'd have to * keep lots of state as we traverse the frame, figuring * out where the arguments to the function are stored
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Sep 18 00:06:36 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: vm_machdep.c Log Message: Rather than having exception_return() at the root of the call graph for kernel threads, provide a backstop that will prevent them from ever accidentally trying to return to user space. To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/sys/arch/alpha/alpha/vm_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/alpha/alpha/vm_machdep.c diff -u src/sys/arch/alpha/alpha/vm_machdep.c:1.116 src/sys/arch/alpha/alpha/vm_machdep.c:1.117 --- src/sys/arch/alpha/alpha/vm_machdep.c:1.116 Sat Aug 29 20:06:59 2020 +++ src/sys/arch/alpha/alpha/vm_machdep.c Fri Sep 18 00:06:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.116 2020/08/29 20:06:59 thorpej Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.117 2020/09/18 00:06:35 thorpej Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.116 2020/08/29 20:06:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.117 2020/09/18 00:06:35 thorpej Exp $"); #include #include @@ -60,6 +60,20 @@ cpu_lwp_free2(struct lwp *l) } /* + * This is a backstop used to ensure that kernel threads never do + * something silly like attempt to return to userspace. We achieve + * this by putting this at the root of their call graph instead of + * exception_return(). + */ +void +alpha_kthread_backstop(void) +{ + struct lwp * const l = curlwp; + + panic("kthread lwp %p (%s) hit the backstop", l, l->l_name); +} + +/* * Finish a fork operation, with thread l2 nearly set up. * Copy and update the pcb and trap frame, making the child ready to run. * @@ -130,6 +144,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp */ { struct trapframe *l2tf; + uint64_t call_root; /* * Pick a stack pointer, leaving room for a trapframe; @@ -148,12 +163,24 @@ cpu_lwp_fork(struct lwp *l1, struct lwp l2tf->tf_regs[FRAME_A3] = 0; /* no error */ l2tf->tf_regs[FRAME_A4] = 1; /* is child */ + /* + * Normal LWPs have their return address set to + * exception_return() so that they'll pop into + * user space. But kernel threads don't have + * a user space, so we put a backtop in place + * just in case they try. + */ + if (__predict_true(l2->l_proc != )) + call_root = (uint64_t)exception_return; + else + call_root = (uint64_t)alpha_kthread_backstop; + pcb2->pcb_hw.apcb_ksp = (uint64_t)l2->l_md.md_tf; pcb2->pcb_context[0] = (uint64_t)func; /* s0: pc */ pcb2->pcb_context[1] = - (uint64_t)exception_return; /* s1: ra */ + call_root;/* s1: ra */ pcb2->pcb_context[2] = (uint64_t)arg; /* s2: arg */ pcb2->pcb_context[3] =
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Sep 18 00:04:58 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: debug.s Log Message: Fix entering the kernel debugger when MULTIPROCESSOR is enabled; the arguments to alpha_debug() were getting clobbered by the call to cpu_pause_resume_all(), but they need to be passed along to ddb_trap(). To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/alpha/alpha/debug.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/alpha/alpha/debug.s diff -u src/sys/arch/alpha/alpha/debug.s:1.12 src/sys/arch/alpha/alpha/debug.s:1.13 --- src/sys/arch/alpha/alpha/debug.s:1.12 Thu Aug 20 21:34:03 2009 +++ src/sys/arch/alpha/alpha/debug.s Fri Sep 18 00:04:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: debug.s,v 1.12 2009/08/20 21:34:03 skrll Exp $ */ +/* $NetBSD: debug.s,v 1.13 2020/09/18 00:04:58 thorpej Exp $ */ /*- * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc. @@ -30,9 +30,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ -__KERNEL_RCSID(6, "$NetBSD: debug.s,v 1.12 2009/08/20 21:34:03 skrll Exp $") +__KERNEL_RCSID(6, "$NetBSD: debug.s,v 1.13 2020/09/18 00:04:58 thorpej Exp $") #include "opt_multiprocessor.h" +#include "opt_ddb.h" #include "opt_kgdb.h" /* @@ -64,17 +65,30 @@ BSS(debug_stack_bottom, DEBUG_STACK_SIZE * a3 kernel trap entry point * a4 frame pointer */ -NESTED_NOPROFILE(alpha_debug, 5, 32, ra, IM_RA|IM_S0, 0) +NESTED_NOPROFILE(alpha_debug, 5, 64, ra, +IM_RA|IM_S0|IM_S1|IM_S2|IM_S3|IM_S4|IM_S5, 0) br pv, 1f 1: LDGP(pv) lda t0, FRAME_SIZE*8(a4) /* what would sp have been? */ stq t0, FRAME_SP*8(a4) /* belatedly save sp for ddb view */ - lda sp, -32(sp) /* set up stack frame */ - stq ra, (32-8)(sp) /* save ra */ - stq s0, (32-16)(sp) /* save s0 */ + lda sp, -64(sp) /* set up stack frame */ + stq s0, (0*8)(sp) /* save s0 ... */ + stq s1, (1*8)(sp) + stq s2, (2*8)(sp) + stq s3, (3*8)(sp) + stq s4, (4*8)(sp) + stq s5, (5*8)(sp) /* ... through s5 */ + stq ra, (6*8)(sp) /* save ra */ /* Remember our current stack pointer. */ - mov sp, s0 + mov sp, s5 + + /* Save off our arguments. */ + mov a0, s0 + mov a1, s1 + mov a2, s2 + mov a3, s3 + mov a4, s4 #if defined(MULTIPROCESSOR) /* Pause all other CPUs. */ @@ -95,19 +109,24 @@ NESTED_NOPROFILE(alpha_debug, 5, 32, ra, 2: lda sp, debug_stack_top /* sp <- debug_stack_top */ -3: /* Dispatch to the debugger - arguments are already in place. */ +3: /* Dispatch to the debugger. */ #if defined(KGDB) - mov a3, a0 /* a0 == entry (trap type) */ - mov a4, a1 /* a1 == frame pointer */ + mov s3, a0 /* a0 == entry (trap type) */ + mov s4, a1 /* a1 == frame pointer */ CALL(kgdb_trap) br 9f #endif #if defined(DDB) + mov s0, a1 /* same arguments as the call */ + mov s1, a1 /* to alpha_debug() */ + mov s2, a2 /* (these may have been clobbered */ + mov s3, a3 /* when pausing other CPUs.) */ + mov s4, a4 CALL(ddb_trap) br 9f #endif 9: /* Debugger return value in v0; switch back to our previous stack. */ - mov s0, sp + mov s5, sp #if defined(MULTIPROCESSOR) mov v0, s0 @@ -119,8 +138,13 @@ NESTED_NOPROFILE(alpha_debug, 5, 32, ra, mov s0, v0 #endif - ldq ra, (32-8)(sp) /* restore ra */ - ldq s0, (32-16)(sp) /* restore s0 */ - lda sp, 32(sp) /* pop stack frame */ + ldq s0, (0*8)(sp) /* restore s0 ... */ + ldq s1, (1*8)(sp) + ldq s2, (2*8)(sp) + ldq s3, (3*8)(sp) + ldq s4, (4*8)(sp) + ldq s5, (5*8)(sp) /* ... through s5 */ + ldq ra, (6*8)(sp) /* restore ra */ + lda sp, 64(sp) /* pop stack frame */ RET END(alpha_debug)
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Sep 18 00:02:43 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: db_interface.c Log Message: Use alpha_pal_swpipl() directly instead of splhigh()/splx(), do avoid soft int processing while dealing with entering / leaving the debugger. Soft ints will be correctly handled during exception_return(). To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/db_interface.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/alpha/alpha/db_interface.c diff -u src/sys/arch/alpha/alpha/db_interface.c:1.34 src/sys/arch/alpha/alpha/db_interface.c:1.35 --- src/sys/arch/alpha/alpha/db_interface.c:1.34 Mon Feb 6 02:14:10 2012 +++ src/sys/arch/alpha/alpha/db_interface.c Fri Sep 18 00:02:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.34 2012/02/06 02:14:10 matt Exp $ */ +/* $NetBSD: db_interface.c,v 1.35 2020/09/18 00:02:43 thorpej Exp $ */ /* * Mach Operating System @@ -52,7 +52,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.34 2012/02/06 02:14:10 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.35 2020/09/18 00:02:43 thorpej Exp $"); #include #include @@ -176,7 +176,7 @@ int ddb_trap(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long entry, db_regs_t *regs) { struct cpu_info *ci = curcpu(); - int s; + unsigned long psl; if (entry != ALPHA_KENTRY_IF || (a0 != ALPHA_IF_CODE_BPT && a0 != ALPHA_IF_CODE_BUGCHK)) { @@ -200,7 +200,12 @@ ddb_trap(unsigned long a0, unsigned long /* Our register state is simply the trapframe. */ ddb_regp = ci->ci_db_regs = regs; - s = splhigh(); + /* + * Use SWPIPL directly; we want to avoid processing + * software interrrupts when we go back. Soft ints + * will be caught later, so not to worry. + */ + psl = alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH); db_active++; cnpollc(true); /* Set polling mode, unblank video */ @@ -210,7 +215,7 @@ ddb_trap(unsigned long a0, unsigned long cnpollc(false); /* Resume interrupt mode */ db_active--; - splx(s); + alpha_pal_swpipl(psl); ddb_regp = ci->ci_db_regs = NULL;
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: simonb Date: Fri Sep 11 03:54:14 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Fix shift tyop in a comment. To generate a diff of this commit: cvs rdiff -u -r1.272 -r1.273 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.272 src/sys/arch/alpha/alpha/pmap.c:1.273 --- src/sys/arch/alpha/alpha/pmap.c:1.272 Tue Sep 8 21:41:37 2020 +++ src/sys/arch/alpha/alpha/pmap.c Fri Sep 11 03:54:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.272 2020/09/08 21:41:37 riastradh Exp $ */ +/* $NetBSD: pmap.c,v 1.273 2020/09/11 03:54:14 simonb Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.272 2020/09/08 21:41:37 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.273 2020/09/11 03:54:14 simonb Exp $"); #include #include @@ -439,7 +439,7 @@ pmap_activation_lock(pmap_t const pmap) * changes. In order amortize the cost of these operations, we will * queue up to 8 addresses to invalidate in a batch. Any more than * that, and we will hit the entire TLB. - 8 + * * Some things that add complexity: * * ==> ASNs. A CPU may have valid TLB entries for other than the current
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: riastradh Date: Tue Sep 8 21:41:37 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: alpha: Use load-acquire/store-release. Omit needless membar in pmap_kenter_pa while here -- caller must ensure pmap_kenter_pa on one CPU happens before use of the VA on another CPU anyway, so there is no benefit to a membar here. ok thorpej@ To generate a diff of this commit: cvs rdiff -u -r1.271 -r1.272 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.271 src/sys/arch/alpha/alpha/pmap.c:1.272 --- src/sys/arch/alpha/alpha/pmap.c:1.271 Thu Sep 3 02:09:09 2020 +++ src/sys/arch/alpha/alpha/pmap.c Tue Sep 8 21:41:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.271 2020/09/03 02:09:09 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.272 2020/09/08 21:41:37 riastradh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.271 2020/09/03 02:09:09 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.272 2020/09/08 21:41:37 riastradh Exp $"); #include #include @@ -979,7 +979,7 @@ pmap_tlb_shootnow(const struct pmap_tlb_ int backoff = SPINLOCK_BACKOFF_MIN; u_int spins = 0; - while (atomic_load_relaxed(_context) != NULL) { + while (atomic_load_acquire(_context) != NULL) { SPINLOCK_BACKOFF(backoff); if (spins++ > 0x0fff) { printf("TLB LOCAL MASK = 0x%016lx\n", @@ -994,7 +994,6 @@ pmap_tlb_shootnow(const struct pmap_tlb_ panic("pmap_tlb_shootnow"); } } - membar_consumer(); } KASSERT(tlb_context == NULL); #endif /* MULTIPROCESSOR */ @@ -1025,8 +1024,7 @@ pmap_tlb_shootdown_ipi(struct cpu_info * KASSERT(tlb_context != NULL); pmap_tlb_invalidate(tlb_context, ci); if (atomic_and_ulong_nv(_pending, ~(1UL << ci->ci_cpuid)) == 0) { - membar_producer(); - atomic_store_relaxed(_context, NULL); + atomic_store_release(_context, NULL); } } #endif /* MULTIPROCESSOR */ @@ -2275,7 +2273,6 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v /* Set the new PTE. */ const pt_entry_t opte = atomic_load_relaxed(pte); atomic_store_relaxed(pte, npte); - PMAP_MP(membar_enter()); PMAP_STAT_INCR(pmap->pm_stats.resident_count, 1); PMAP_STAT_INCR(pmap->pm_stats.wired_count, 1);
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Sep 4 04:09:52 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: locore.s Log Message: Save a few instructions every time we manipulate pcb::pcb_onfault. To generate a diff of this commit: cvs rdiff -u -r1.129 -r1.130 src/sys/arch/alpha/alpha/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/alpha/alpha/locore.s diff -u src/sys/arch/alpha/alpha/locore.s:1.129 src/sys/arch/alpha/alpha/locore.s:1.130 --- src/sys/arch/alpha/alpha/locore.s:1.129 Fri Sep 4 02:54:56 2020 +++ src/sys/arch/alpha/alpha/locore.s Fri Sep 4 04:09:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.129 2020/09/04 02:54:56 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.130 2020/09/04 04:09:52 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.129 2020/09/04 02:54:56 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.130 2020/09/04 04:09:52 thorpej Exp $"); #include "assym.h" @@ -781,17 +781,11 @@ NESTED(copyinstr, 4, 16, ra, IM_RA|IM_S0 beq t1, copyerr_efault /* if it's not, error out. */ /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */ GET_CURLWP - mov v0, s0 + ldq s0, L_PCB(v0) /* s0 = pcb */ lda v0, copyerr /* set up fault handler. */ - .set noat - ldq at_reg, L_PCB(s0) - stq v0, PCB_ONFAULT(at_reg) - .set at + stq v0, PCB_ONFAULT(s0) CALL(alpha_copystr) /* do the copy. */ - .set noat - ldq at_reg, L_PCB(s0) - stq zero, PCB_ONFAULT(at_reg) /* kill the fault handler. */ - .set at + stq zero, PCB_ONFAULT(s0) /* kill the fault handler. */ ldq ra, (16-8)(sp) /* restore ra. */ ldq s0, (16-16)(sp) /* restore s0. */ lda sp, 16(sp) /* kill stack frame. */ @@ -808,17 +802,11 @@ NESTED(copyoutstr, 4, 16, ra, IM_RA|IM_S beq t1, copyerr_efault /* if it's not, error out. */ /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */ GET_CURLWP - mov v0, s0 + ldq s0, L_PCB(v0) /* s0 = pcb */ lda v0, copyerr /* set up fault handler. */ - .set noat - ldq at_reg, L_PCB(s0) - stq v0, PCB_ONFAULT(at_reg) - .set at + stq v0, PCB_ONFAULT(s0) CALL(alpha_copystr) /* do the copy. */ - .set noat - ldq at_reg, L_PCB(s0) - stq zero, PCB_ONFAULT(at_reg) /* kill the fault handler. */ - .set at + stq zero, PCB_ONFAULT(s0) /* kill the fault handler. */ ldq ra, (16-8)(sp) /* restore ra. */ ldq s0, (16-16)(sp) /* restore s0. */ lda sp, 16(sp) /* kill stack frame. */ @@ -847,18 +835,12 @@ NESTED(kcopy, 3, 32, ra, IM_RA|IM_S0|IM_ mov v0, a0 /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */ GET_CURLWP - mov v0, s1/* s1 = curlwp */ + ldq s1, L_PCB(v0) /* s1 = pcb */ lda v0, kcopyerr /* set up fault handler. */ - .set noat - ldq at_reg, L_PCB(s1) - ldq s0, PCB_ONFAULT(at_reg) /* save old handler. */ - stq v0, PCB_ONFAULT(at_reg) - .set at + ldq s0, PCB_ONFAULT(s1) /* save old handler. */ + stq v0, PCB_ONFAULT(s1) CALL(memcpy)/* do the copy. */ - .set noat - ldq at_reg, L_PCB(s1) /* restore the old handler. */ - stq s0, PCB_ONFAULT(at_reg) - .set at + stq s0, PCB_ONFAULT(s1) /* restore the old handler. */ ldq ra, (32-8)(sp) /* restore ra. */ ldq s0, (32-16)(sp) /* restore s0. */ ldq s1, (32-24)(sp) /* restore s1. */ @@ -894,17 +876,11 @@ NESTED(copyin, 3, 16, ra, IM_RA|IM_S0, 0 mov v0, a0 /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */ GET_CURLWP - mov v0, s0/* s0 = curlwp */ + ldq s0, L_PCB(v0) /* s = pcb */ lda v0, copyerr /* set up fault handler. */ - .set noat - ldq at_reg, L_PCB(s0) - stq v0, PCB_ONFAULT(at_reg) - .set at + stq v0, PCB_ONFAULT(s0) CALL(memcpy)/* do the copy. */ - .set noat - ldq at_reg, L_PCB(s0) /* kill the fault handler. */ - stq zero, PCB_ONFAULT(at_reg) - .set at + stq zero, PCB_ONFAULT(s0) /* kill the fault handler. */ ldq ra, (16-8)(sp) /* restore ra. */ ldq s0, (16-16)(sp) /* restore s0. */ lda sp, 16(sp) /* kill stack frame. */ @@ -926,17 +902,11 @@ NESTED(copyout, 3, 16, ra, IM_RA|IM_S0, mov v0, a0 /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */ GET_CURLWP - mov v0, s0/* s0 = curlwp */ + ldq s0, L_PCB(v0) /* s0 = pcb */ lda v0, copyerr /* set up fault handler. */ - .set noat - ldq at_reg, L_PCB(s0) - stq v0, PCB_ONFAULT(at_reg) - .set at + stq v0, PCB_ONFAULT(s0) CALL(memcpy)/* do the copy. */ - .set noat - ldq at_reg, L_PCB(s0) /* kill the fault handler. */ - stq zero, PCB_ONFAULT(at_reg) - .set at + stq zero, PCB_ONFAULT(s0) /* kill the fault handler. */ ldq ra, (16-8)(sp) /* restore ra. */ ldq s0,
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Sep 4 03:41:49 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: clock.c dec_2100_a50.c dec_2100_a500.c dec_6600.c dec_kn20aa.c dec_kn8ae.c patch.c Log Message: Include To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/alpha/clock.c \ src/sys/arch/alpha/alpha/dec_kn8ae.c cvs rdiff -u -r1.67 -r1.68 src/sys/arch/alpha/alpha/dec_2100_a50.c cvs rdiff -u -r1.23 -r1.24 src/sys/arch/alpha/alpha/dec_2100_a500.c cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/dec_6600.c cvs rdiff -u -r1.65 -r1.66 src/sys/arch/alpha/alpha/dec_kn20aa.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/alpha/alpha/patch.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/alpha/alpha/clock.c diff -u src/sys/arch/alpha/alpha/clock.c:1.42 src/sys/arch/alpha/alpha/clock.c:1.43 --- src/sys/arch/alpha/alpha/clock.c:1.42 Mon Feb 6 02:14:10 2012 +++ src/sys/arch/alpha/alpha/clock.c Fri Sep 4 03:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.42 2012/02/06 02:14:10 matt Exp $ */ +/* $NetBSD: clock.c,v 1.43 2020/09/04 03:41:49 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,12 +39,13 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.42 2012/02/06 02:14:10 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.43 2020/09/04 03:41:49 thorpej Exp $"); #include #include #include #include +#include #include #include Index: src/sys/arch/alpha/alpha/dec_kn8ae.c diff -u src/sys/arch/alpha/alpha/dec_kn8ae.c:1.42 src/sys/arch/alpha/alpha/dec_kn8ae.c:1.43 --- src/sys/arch/alpha/alpha/dec_kn8ae.c:1.42 Mon Nov 4 16:57:41 2013 +++ src/sys/arch/alpha/alpha/dec_kn8ae.c Fri Sep 4 03:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dec_kn8ae.c,v 1.42 2013/11/04 16:57:41 christos Exp $ */ +/* $NetBSD: dec_kn8ae.c,v 1.43 2020/09/04 03:41:49 thorpej Exp $ */ /* * Copyright (c) 1997 by Matthew Jacob @@ -32,13 +32,15 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_kn8ae.c,v 1.42 2013/11/04 16:57:41 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_kn8ae.c,v 1.43 2020/09/04 03:41:49 thorpej Exp $"); #include #include #include +#include #include #include + #include #include Index: src/sys/arch/alpha/alpha/dec_2100_a50.c diff -u src/sys/arch/alpha/alpha/dec_2100_a50.c:1.67 src/sys/arch/alpha/alpha/dec_2100_a50.c:1.68 --- src/sys/arch/alpha/alpha/dec_2100_a50.c:1.67 Sat Oct 13 17:58:54 2012 +++ src/sys/arch/alpha/alpha/dec_2100_a50.c Fri Sep 4 03:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dec_2100_a50.c,v 1.67 2012/10/13 17:58:54 jdc Exp $ */ +/* $NetBSD: dec_2100_a50.c,v 1.68 2020/09/04 03:41:49 thorpej Exp $ */ /* * Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University. @@ -34,12 +34,14 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_2100_a50.c,v 1.67 2012/10/13 17:58:54 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_2100_a50.c,v 1.68 2020/09/04 03:41:49 thorpej Exp $"); #include #include #include +#include #include + #include #include Index: src/sys/arch/alpha/alpha/dec_2100_a500.c diff -u src/sys/arch/alpha/alpha/dec_2100_a500.c:1.23 src/sys/arch/alpha/alpha/dec_2100_a500.c:1.24 --- src/sys/arch/alpha/alpha/dec_2100_a500.c:1.23 Sat Oct 13 17:58:54 2012 +++ src/sys/arch/alpha/alpha/dec_2100_a500.c Fri Sep 4 03:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dec_2100_a500.c,v 1.23 2012/10/13 17:58:54 jdc Exp $ */ +/* $NetBSD: dec_2100_a500.c,v 1.24 2020/09/04 03:41:49 thorpej Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -60,12 +60,14 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_2100_a500.c,v 1.23 2012/10/13 17:58:54 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_2100_a500.c,v 1.24 2020/09/04 03:41:49 thorpej Exp $"); #include #include #include +#include #include + #include #include Index: src/sys/arch/alpha/alpha/dec_6600.c diff -u src/sys/arch/alpha/alpha/dec_6600.c:1.34 src/sys/arch/alpha/alpha/dec_6600.c:1.35 --- src/sys/arch/alpha/alpha/dec_6600.c:1.34 Sat Oct 13 17:58:54 2012 +++ src/sys/arch/alpha/alpha/dec_6600.c Fri Sep 4 03:41:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dec_6600.c,v 1.34 2012/10/13 17:58:54 jdc Exp $ */ +/* $NetBSD: dec_6600.c,v 1.35 2020/09/04 03:41:49 thorpej Exp $ */ /* * Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University. @@ -31,12 +31,14 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_6600.c,v 1.34 2012/10/13 17:58:54 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_6600.c,v 1.35 2020/09/04 03:41:49 thorpej Exp $"); #include #include #include +#include #include + #include #include Index: src/sys/arch/alpha/alpha/dec_kn20aa.c diff -u src/sys/arch/alpha/alpha/dec_kn20aa.c:1.65
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Sep 4 03:36:44 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: prom.c Log Message: Fix a typo. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/arch/alpha/alpha/prom.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/alpha/alpha/prom.c diff -u src/sys/arch/alpha/alpha/prom.c:1.55 src/sys/arch/alpha/alpha/prom.c:1.56 --- src/sys/arch/alpha/alpha/prom.c:1.55 Thu Sep 3 04:18:30 2020 +++ src/sys/arch/alpha/alpha/prom.c Fri Sep 4 03:36:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: prom.c,v 1.55 2020/09/03 04:18:30 thorpej Exp $ */ +/* $NetBSD: prom.c,v 1.56 2020/09/04 03:36:44 thorpej Exp $ */ /* * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University @@ -27,7 +27,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.55 2020/09/03 04:18:30 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.56 2020/09/04 03:36:44 thorpej Exp $"); #include "opt_multiprocessor.h" @@ -77,7 +77,7 @@ prom_lev1map(void) /* * Find the level 1 map that we're currently running on. */ - apcb = (struct alpha_pcb *)) + apcb = (struct alpha_pcb *) ALPHA_PHYS_TO_K0SEG((paddr_t)curlwp->l_md.md_pcbpaddr); return ((pt_entry_t *)ALPHA_PHYS_TO_K0SEG(apcb->apcb_ptbr << PGSHIFT));
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Sep 4 01:56:29 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: cpu.c Log Message: Decorate some symbols with the appropriate things for better cache behavior. Assert that cpu_infos are cache line aligned. To generate a diff of this commit: cvs rdiff -u -r1.99 -r1.100 src/sys/arch/alpha/alpha/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/alpha/alpha/cpu.c diff -u src/sys/arch/alpha/alpha/cpu.c:1.99 src/sys/arch/alpha/alpha/cpu.c:1.100 --- src/sys/arch/alpha/alpha/cpu.c:1.99 Sat Aug 29 20:06:59 2020 +++ src/sys/arch/alpha/alpha/cpu.c Fri Sep 4 01:56:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.99 2020/08/29 20:06:59 thorpej Exp $ */ +/* $NetBSD: cpu.c,v 1.100 2020/09/04 01:56:29 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.99 2020/08/29 20:06:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.100 2020/09/04 01:56:29 thorpej Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -80,7 +80,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.99 #include #include -struct cpu_info cpu_info_primary = { +struct cpu_info cpu_info_primary __cacheline_aligned = { .ci_curlwp = }; struct cpu_info *cpu_info_list = _info_primary; @@ -93,9 +93,9 @@ struct cpu_info *cpu_info_list = _in struct cpu_info *cpu_info[ALPHA_MAXPROCS]; /* Bitmask of CPUs booted, currently running, and paused. */ -volatile u_long cpus_booted; -volatile u_long cpus_running; -volatile u_long cpus_paused; +volatile u_long cpus_booted __read_mostly; +volatile u_long cpus_running __read_mostly; +volatile u_long cpus_paused __read_mostly; void cpu_boot_secondary(struct cpu_info *); #endif /* MULTIPROCESSOR */ @@ -108,7 +108,8 @@ void cpu_boot_secondary(struct cpu_info * Note, we invert the AMASK so that if a bit is set, it means "has * extension". */ -u_long cpu_implver, cpu_amask; +u_long cpu_implver __read_mostly; +u_long cpu_amask __read_mostly; /* Definition of the driver for autoconfig. */ static int cpumatch(device_t, cfdata_t, void *); @@ -276,7 +277,12 @@ recognized: if (ma->ma_slot == hwrpb->rpb_primary_cpu_id) ci = _info_primary; else { + /* + * kmem_zalloc() will guarante cache line alignment for + * all allocations >= CACHE_LINE_SIZE. + */ ci = kmem_zalloc(sizeof(*ci), KM_SLEEP); + KASSERT(((uintptr_t)ci & (CACHE_LINE_SIZE - 1)) == 0); } #if defined(MULTIPROCESSOR) cpu_info[ma->ma_slot] = ci;
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Thu Sep 3 15:38:17 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: locore.s multiproc.s Log Message: Garbage-collect the SWITCH_CONTEXT macro, since it now expands to just "call_pal PAL_OSF1_swpctx". To generate a diff of this commit: cvs rdiff -u -r1.127 -r1.128 src/sys/arch/alpha/alpha/locore.s cvs rdiff -u -r1.13 -r1.14 src/sys/arch/alpha/alpha/multiproc.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/alpha/alpha/locore.s diff -u src/sys/arch/alpha/alpha/locore.s:1.127 src/sys/arch/alpha/alpha/locore.s:1.128 --- src/sys/arch/alpha/alpha/locore.s:1.127 Thu Sep 3 04:18:30 2020 +++ src/sys/arch/alpha/alpha/locore.s Thu Sep 3 15:38:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.127 2020/09/03 04:18:30 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.128 2020/09/03 15:38:17 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,21 +67,12 @@ #include -__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.127 2020/09/03 04:18:30 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.128 2020/09/03 15:38:17 thorpej Exp $"); #include "assym.h" .stabs __FILE__,132,0,0,kernel_text -/* - * Perform actions necessary to switch to a new context. The - * hwpcb should be in a0. Clobbers v0, t0, t8..t11, a0. - */ -#define SWITCH_CONTEXT \ - /* Swap in the new context. */ \ - call_pal PAL_OSF1_swpctx - - /* don't reorder instructions; paranoia. */ .set noreorder .text @@ -152,7 +143,7 @@ NESTED_NOPROFILE(locorestart,1,0,ra,0,0) */ lda a0, lwp0 ldq a0, L_MD_PCBPADDR(a0) /* phys addr of PCB */ - SWITCH_CONTEXT + call_pal PAL_OSF1_swpctx /* clobbers a0, t0, t8-t11, a0 */ /* PROM is no longer mapped. */ lda t0, prom_mapped @@ -680,9 +671,10 @@ LEAF(cpu_switchto, 0) mov a0, s4/* save old curlwp */ mov a1, s2/* save new lwp */ - ldq a0, L_MD_PCBPADDR(s2) /* save new pcbpaddr */ - SWITCH_CONTEXT/* swap the context */ + /* Switch to the new PCB. */ + ldq a0, L_MD_PCBPADDR(s2) + call_pal PAL_OSF1_swpctx /* clobbers a0, t0, t8-t11, a0 */ GET_CPUINFO stq s2, CPU_INFO_CURLWP(v0) /* curlwp = l */ Index: src/sys/arch/alpha/alpha/multiproc.s diff -u src/sys/arch/alpha/alpha/multiproc.s:1.13 src/sys/arch/alpha/alpha/multiproc.s:1.14 --- src/sys/arch/alpha/alpha/multiproc.s:1.13 Mon Apr 28 20:23:10 2008 +++ src/sys/arch/alpha/alpha/multiproc.s Thu Sep 3 15:38:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: multiproc.s,v 1.13 2008/04/28 20:23:10 martin Exp $ */ +/* $NetBSD: multiproc.s,v 1.14 2020/09/03 15:38:17 thorpej Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -__KERNEL_RCSID(5, "$NetBSD: multiproc.s,v 1.13 2008/04/28 20:23:10 martin Exp $") +__KERNEL_RCSID(5, "$NetBSD: multiproc.s,v 1.14 2020/09/03 15:38:17 thorpej Exp $") /* * Multiprocessor glue code. @@ -67,7 +67,7 @@ NESTED_NOPROFILE(cpu_spinup_trampoline,0 ldq a0, CPU_INFO_IDLE_LWP(s0) stq a0, CPU_INFO_CURLWP(s0) /* set curlwp */ ldq a0, L_MD_PCBPADDR(a0) - SWITCH_CONTEXT + call_pal PAL_OSF1_swpctx /* Invalidate TLB and I-stream. */ ldiq a0, -2 /* TBIA */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Thu Sep 3 02:05:03 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: - Remove redundant memory barriers. For the ones that remain, use the membar_ops(3) names to make it clear how they pair up (even though most of them expand to the MB instruction anyway). To generate a diff of this commit: cvs rdiff -u -r1.269 -r1.270 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.269 src/sys/arch/alpha/alpha/pmap.c:1.270 --- src/sys/arch/alpha/alpha/pmap.c:1.269 Sat Aug 29 20:06:59 2020 +++ src/sys/arch/alpha/alpha/pmap.c Thu Sep 3 02:05:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.269 2020/08/29 20:06:59 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.270 2020/09/03 02:05:03 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020 @@ -135,7 +135,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.269 2020/08/29 20:06:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.270 2020/09/03 02:05:03 thorpej Exp $"); #include #include @@ -951,7 +951,6 @@ pmap_tlb_shootnow(const struct pmap_tlb_ TLB_COUNT(shootnow_remote); tlb_context = tlbctx; tlb_pending = remote_cpus; - alpha_wmb(); alpha_multicast_ipi(remote_cpus, ALPHA_IPI_SHOOTDOWN); } #endif /* MULTIPROCESSOR */ @@ -983,7 +982,6 @@ pmap_tlb_shootnow(const struct pmap_tlb_ while (atomic_load_relaxed(_context) != NULL) { SPINLOCK_BACKOFF(backoff); if (spins++ > 0x0fff) { -alpha_mb(); printf("TLB LOCAL MASK = 0x%016lx\n", this_cpu); printf("TLB REMOTE MASK = 0x%016lx\n", @@ -996,6 +994,7 @@ pmap_tlb_shootnow(const struct pmap_tlb_ panic("pmap_tlb_shootnow"); } } + membar_consumer(); } KASSERT(tlb_context == NULL); #endif /* MULTIPROCESSOR */ @@ -1026,7 +1025,7 @@ pmap_tlb_shootdown_ipi(struct cpu_info * KASSERT(tlb_context != NULL); pmap_tlb_invalidate(tlb_context, ci); if (atomic_and_ulong_nv(_pending, ~(1UL << ci->ci_cpuid)) == 0) { - alpha_wmb(); + membar_producer(); atomic_store_relaxed(_context, NULL); } } @@ -1614,7 +1613,7 @@ pmap_destroy(pmap_t pmap) printf("pmap_destroy(%p)\n", pmap); #endif - PMAP_MP(alpha_mb()); + PMAP_MP(membar_exit()); if (atomic_dec_ulong_nv(>pm_count) > 0) return; @@ -1650,7 +1649,7 @@ pmap_reference(pmap_t pmap) #endif atomic_inc_ulong(>pm_count); - PMAP_MP(alpha_mb()); + PMAP_MP(membar_enter()); } /* @@ -2306,7 +2305,7 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v /* Set the new PTE. */ const pt_entry_t opte = atomic_load_relaxed(pte); atomic_store_relaxed(pte, npte); - PMAP_MP(alpha_mb()); + PMAP_MP(membar_enter()); PMAP_STAT_INCR(pmap->pm_stats.resident_count, 1); PMAP_STAT_INCR(pmap->pm_stats.wired_count, 1); @@ -2369,7 +2368,6 @@ pmap_kremove(vaddr_t va, vsize_t size) PMAP_STAT_DECR(pmap->pm_stats.wired_count, 1); } } - PMAP_MP(alpha_wmb()); pmap_tlb_shootnow(); TLB_COUNT(reason_kremove); @@ -2614,7 +2612,6 @@ pmap_deactivate(struct lwp *l) * the kernel pmap. */ ci->ci_pmap = pmap_kernel(); - PMAP_MP(alpha_mb()); KASSERT(atomic_load_relaxed(>pm_count) > 1); pmap_destroy(pmap); }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Thu Sep 3 02:03:14 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: ipifuncs.c Log Message: - alpha_ipi_process(): Continue processing IPIs until the ipimask reads 0. Issue a memory barrier between the atomic swap and performing the work. - alpha_send_ipi(): Issue a memory barrier before setting the ipimask to ensure all memory accesses prior to signalling the IPI have completed. Also issue a memory barrier getween setting the ipimask and calling PALcode to write the IPIR. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/arch/alpha/alpha/ipifuncs.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/alpha/alpha/ipifuncs.c diff -u src/sys/arch/alpha/alpha/ipifuncs.c:1.52 src/sys/arch/alpha/alpha/ipifuncs.c:1.53 --- src/sys/arch/alpha/alpha/ipifuncs.c:1.52 Sat Aug 29 20:06:59 2020 +++ src/sys/arch/alpha/alpha/ipifuncs.c Thu Sep 3 02:03:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ipifuncs.c,v 1.52 2020/08/29 20:06:59 thorpej Exp $ */ +/* $NetBSD: ipifuncs.c,v 1.53 2020/09/03 02:03:14 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.52 2020/08/29 20:06:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.53 2020/09/03 02:03:14 thorpej Exp $"); /* * Interprocessor interrupt handlers. @@ -125,22 +125,20 @@ alpha_ipi_process(struct cpu_info *ci, s } #endif - pending_ipis = atomic_swap_ulong(>ci_ipis, 0); - - /* - * For various reasons, it is possible to have spurious calls - * to this routine, so just bail out now if there are none - * pending. - */ - if (pending_ipis == 0) - return; + while ((pending_ipis = atomic_swap_ulong(>ci_ipis, 0)) != 0) { + /* + * Ensure the atomic swap is globally visible before + * we do any of the work. + */ + membar_enter(); - sc->sc_evcnt_ipi.ev_count++; + sc->sc_evcnt_ipi.ev_count++; - for (bit = 0; bit < ALPHA_NIPIS; bit++) { - if (pending_ipis & (1UL << bit)) { - sc->sc_evcnt_which_ipi[bit].ev_count++; - (*ipifuncs[bit])(ci, framep); + for (bit = 0; bit < ALPHA_NIPIS; bit++) { + if (pending_ipis & (1UL << bit)) { +sc->sc_evcnt_which_ipi[bit].ev_count++; +(*ipifuncs[bit])(ci, framep); + } } } } @@ -156,7 +154,24 @@ alpha_send_ipi(u_long const cpu_id, u_lo KASSERT(cpu_info[cpu_id] != NULL); KASSERT(cpus_running & (1UL << cpu_id)); + /* + * Make sure all loads and stores prior to calling + * alpha_send_ipi() have completed before informing + * the CPU of the work we are asking it to do. + */ + membar_exit(); atomic_or_ulong(_info[cpu_id]->ci_ipis, ipimask); + + /* + * Ensure that the store of ipimask completes before actually + * writing to the IPIR. + * + * Note: we use MB rather than WMB because how the IPIR + * is implemented is not architecturally specified, and + * WMB is only guaranteed to provide ordering for stores + * to regions of the same memory-likeness. + */ + alpha_mb(); alpha_pal_wripir(cpu_id); }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: riastradh Date: Wed Sep 2 17:40:23 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: machdep.c Log Message: Nix trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.361 -r1.362 src/sys/arch/alpha/alpha/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/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.361 src/sys/arch/alpha/alpha/machdep.c:1.362 --- src/sys/arch/alpha/alpha/machdep.c:1.361 Sat Aug 29 19:06:32 2020 +++ src/sys/arch/alpha/alpha/machdep.c Wed Sep 2 17:40:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.361 2020/08/29 19:06:32 thorpej Exp $ */ +/* $NetBSD: machdep.c,v 1.362 2020/09/02 17:40:23 riastradh Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.361 2020/08/29 19:06:32 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.362 2020/09/02 17:40:23 riastradh Exp $"); #include #include @@ -732,7 +732,7 @@ nobootinfo: case 'Q': boothowto |= AB_QUIET; break; - + case 'v': /* verbose boot */ case 'V': boothowto |= AB_VERBOSE; @@ -1273,7 +1273,7 @@ dumpsys(void) n = bytes - i; if (n > BYTES_PER_DUMP) n = BYTES_PER_DUMP; - + error = (*dump)(dumpdev, blkno, (void *)ALPHA_PHYS_TO_K0SEG(maddr), n); if (error) @@ -1436,7 +1436,7 @@ getframe(const struct lwp *l, int sig, i else frame = (void *)(alpha_pal_rdusp()); return (frame); -} +} void buildcontext(struct lwp *l, const void *catcher, const void *tramp, const void *fp) @@ -1514,7 +1514,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, c * the trampoline version numbers are coordinated with machine- * dependent code in libc. */ - + tf->tf_regs[FRAME_A0] = sig; tf->tf_regs[FRAME_A1] = (uint64_t)>sf_si; tf->tf_regs[FRAME_A2] = (uint64_t)>sf_uc; @@ -1905,7 +1905,7 @@ cpu_need_resched(struct cpu_info *ci, st void cpu_signotify(struct lwp *l) { - + KASSERT(kpreempt_disabled()); if (l->l_cpu != curcpu()) {
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Sep 1 08:22:36 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: fp_complete.c Log Message: - compare_{le,lt)(): Use float64_{le,lt}_quiet() to avoid raising exceptions on QNaNs. - alpha_fp_interpret(): Instructions are 32-bits wide, so don't use a uint64_t to contain them. - alpha_fp_complete(): Operations on NaNs trap on Alpha, but the exception summary reports INV (invalid operation) rather than SWC (software completion) in this case. So also interpret the instruction if INV is set in the exception summary. This will emulate operations on NaN and correctly suppress FP traps for QNaNs. This fixes bin/55633, which was caused by: -> Input string "nanotime" is passed to awk's internal is_number(). -> strtod() interprets as "nan" and returns QNaN as the result. -> Result compared against HUGE_VAL, blows up because cmptle is called with a NaN operand, and the hardware doesn't care that it's quiet. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/alpha/alpha/fp_complete.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/alpha/alpha/fp_complete.c diff -u src/sys/arch/alpha/alpha/fp_complete.c:1.23 src/sys/arch/alpha/alpha/fp_complete.c:1.24 --- src/sys/arch/alpha/alpha/fp_complete.c:1.23 Mon Mar 25 19:24:30 2019 +++ src/sys/arch/alpha/alpha/fp_complete.c Tue Sep 1 08:22:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fp_complete.c,v 1.23 2019/03/25 19:24:30 maxv Exp $ */ +/* $NetBSD: fp_complete.c,v 1.24 2020/09/01 08:22:36 thorpej Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -35,7 +35,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.23 2019/03/25 19:24:30 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.24 2020/09/01 08:22:36 thorpej Exp $"); #include #include @@ -199,13 +199,13 @@ ldt(unsigned int rn, t_float *v, struct static float64 compare_lt(float64 a, float64 b) { - return CMP_RESULT(float64_lt(a, b)); + return CMP_RESULT(float64_lt_quiet(a, b)); } static float64 compare_le(float64 a, float64 b) { - return CMP_RESULT(float64_le(a, b)); + return CMP_RESULT(float64_le_quiet(a, b)); } static float64 @@ -502,7 +502,7 @@ float64_unk(float64 a, float64 b) */ static void -alpha_fp_interpret(alpha_instruction *pc, struct lwp *l, uint64_t bits) +alpha_fp_interpret(alpha_instruction *pc, struct lwp *l, uint32_t bits) { s_float sfa, sfb, sfc; t_float tfa, tfb, tfc; @@ -634,13 +634,15 @@ alpha_fp_complete(u_long a0, u_long a1, pc = (alpha_instruction *)l->l_md.md_tf->tf_regs[FRAME_PC]; trigger_pc = pc - 1; /* for ALPHA_AMASK_PAT case */ if (cpu_amask & ALPHA_AMASK_PAT) { - if (a0 & 1 || alpha_fp_sync_complete) { + /* SWC | INV */ + if (a0 & 3 || alpha_fp_sync_complete) { sig = alpha_fp_complete_at(trigger_pc, l, ucode); goto done; } } *ucode = a0; - if (!(a0 & 1)) + /* SWC | INV */ + if (!(a0 & 3)) return sig; /* * At this point we are somewhere in the trap shadow of one or more instruc-
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun Aug 30 16:26:56 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: prom.c Log Message: When initializing the PROM interface, check to see if we're running inside Qemu by consulting the system serial number, and quickly abort calls into the PROM if we are. This is a temporary measure until I can figure out why calling into the Qemu PROM interface blows up. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/arch/alpha/alpha/prom.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/alpha/alpha/prom.c diff -u src/sys/arch/alpha/alpha/prom.c:1.52 src/sys/arch/alpha/alpha/prom.c:1.53 --- src/sys/arch/alpha/alpha/prom.c:1.52 Sat Aug 29 15:16:12 2020 +++ src/sys/arch/alpha/alpha/prom.c Sun Aug 30 16:26:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: prom.c,v 1.52 2020/08/29 15:16:12 thorpej Exp $ */ +/* $NetBSD: prom.c,v 1.53 2020/08/30 16:26:56 thorpej Exp $ */ /* * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University @@ -27,7 +27,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.52 2020/08/29 15:16:12 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.53 2020/08/30 16:26:56 thorpej Exp $"); #include "opt_multiprocessor.h" @@ -59,6 +59,8 @@ int alpha_console; extern struct prom_vec prom_dispatch_v; +static int prom_is_qemu; /* XXX */ + static kmutex_t prom_lock; #ifdef _PMAP_MAY_USE_PROM_CONSOLE @@ -80,6 +82,19 @@ prom_lev1map(void) } #endif /* _PMAP_MAY_USE_PROM_CONSOLE */ +static void +prom_check_qemu(const struct rpb * const rpb) +{ + if (!prom_is_qemu) { + if (rpb->rpb_ssn[0] == 'Q' && + rpb->rpb_ssn[1] == 'E' && + rpb->rpb_ssn[2] == 'M' && + rpb->rpb_ssn[3] == 'U') { + prom_is_qemu = 1; + } + } +} + void init_prom_interface(struct rpb *rpb) { @@ -90,6 +105,8 @@ init_prom_interface(struct rpb *rpb) struct crb *c; + prom_check_qemu(rpb); + c = (struct crb *)((char *)rpb + rpb->rpb_crb_off); prom_dispatch_v.routine_arg = c->crb_v_dispatch; @@ -192,6 +209,10 @@ promcnputc(dev_t dev, int c) prom_return_t ret; unsigned char *to = (unsigned char *)0x2000; + /* XXX */ + if (prom_is_qemu) + return; + prom_enter(); *to = c; @@ -212,6 +233,10 @@ promcngetc(dev_t dev) { prom_return_t ret; + /* XXX */ + if (prom_is_qemu) + return 0; + for (;;) { prom_enter(); ret.bits = prom_getc(alpha_console); @@ -231,6 +256,10 @@ promcnlookc(dev_t dev, char *cp) { prom_return_t ret; + /* XXX */ + if (prom_is_qemu) + return 0; + prom_enter(); ret.bits = prom_getc(alpha_console); prom_leave(); @@ -247,6 +276,10 @@ prom_getenv(int id, char *buf, int len) unsigned char *to = (unsigned char *)0x2000; prom_return_t ret; + /* XXX */ + if (prom_is_qemu) + return 0; + prom_enter(); ret.bits = prom_getenv_disp(id, to, len); if (ret.u.status & 0x4)
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat Aug 29 15:29:30 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: interrupt.c Log Message: In ipl2psl_table[], use IPL_SCHED instead of IPL_CLOCK (the legacy name), and add a comment noting that this is the level IPIs come in with on alpha. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/arch/alpha/alpha/interrupt.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/alpha/alpha/interrupt.c diff -u src/sys/arch/alpha/alpha/interrupt.c:1.81 src/sys/arch/alpha/alpha/interrupt.c:1.82 --- src/sys/arch/alpha/alpha/interrupt.c:1.81 Sun Jan 17 10:44:57 2016 +++ src/sys/arch/alpha/alpha/interrupt.c Sat Aug 29 15:29:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: interrupt.c,v 1.81 2016/01/17 10:44:57 martin Exp $ */ +/* $NetBSD: interrupt.c,v 1.82 2020/08/29 15:29:30 thorpej Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.81 2016/01/17 10:44:57 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.82 2020/08/29 15:29:30 thorpej Exp $"); #include #include @@ -530,7 +530,7 @@ const static uint8_t ipl2psl_table[] = { [IPL_NONE] = ALPHA_PSL_IPL_0, [IPL_SOFTCLOCK] = ALPHA_PSL_IPL_SOFT, [IPL_VM] = ALPHA_PSL_IPL_IO, - [IPL_CLOCK] = ALPHA_PSL_IPL_CLOCK, + [IPL_SCHED] = ALPHA_PSL_IPL_CLOCK, /* also IPIs */ [IPL_HIGH] = ALPHA_PSL_IPL_HIGH, };
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat Aug 29 15:16:12 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: prom.c Log Message: Make sure init_prom_interface() only runs once, otherwise we initialize a mutex twice, and that upsets LOCKDEBUG. But instead of seeing a proper message about it, the output happens before the PROM console interfcace is initialized, we would end up with a translation fault back into SRM. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/arch/alpha/alpha/prom.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/alpha/alpha/prom.c diff -u src/sys/arch/alpha/alpha/prom.c:1.51 src/sys/arch/alpha/alpha/prom.c:1.52 --- src/sys/arch/alpha/alpha/prom.c:1.51 Fri Feb 21 13:33:07 2020 +++ src/sys/arch/alpha/alpha/prom.c Sat Aug 29 15:16:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: prom.c,v 1.51 2020/02/21 13:33:07 skrll Exp $ */ +/* $NetBSD: prom.c,v 1.52 2020/08/29 15:16:12 thorpej Exp $ */ /* * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University @@ -27,7 +27,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.51 2020/02/21 13:33:07 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.52 2020/08/29 15:16:12 thorpej Exp $"); #include "opt_multiprocessor.h" @@ -83,6 +83,11 @@ prom_lev1map(void) void init_prom_interface(struct rpb *rpb) { + static bool prom_interface_initialized; + + if (prom_interface_initialized) + return; + struct crb *c; c = (struct crb *)((char *)rpb + rpb->rpb_crb_off); @@ -91,6 +96,7 @@ init_prom_interface(struct rpb *rpb) prom_dispatch_v.routine = c->crb_v_dispatch->entry_va; mutex_init(_lock, MUTEX_DEFAULT, IPL_HIGH); + prom_interface_initialized = true; } void
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun Aug 16 20:04:36 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: - Undo part of rev 1.264; go back to not acquiring the pmap lock in pmap_activate(). As of rev 1.211, the pmap::pm_lev1map field is stable across the life of the pmap, and so the conditino that the change in 1.264 was intended to avoid would not have happened anyway. - Explicitly use __cacheline_aligned / COHERENCY_UNIT rather than 64 in a couple of places. - Update comments around the lev1map lifecycle, and add some assertions to enforce the assumptions being described. - Remove some dubious DEBUG tests that are not MP-safe. - Chage some long-form #ifdef DIAGNOSTIC checks / panics to KASSERTs. - Remove the PMAP_ACTIVATE() macro because it's no longer used anywhere except for pmap_activate(). Just open-code the equivalent there. - In pmap_activate(), only perform the SWPCTX if either the PTBR or the ASN are different than what the PCB already has. Also assert that preemption is disabled and that the specified lwp is curlwp. - In pmap_deactivate(), add similar assertions, and add a comment explaining why a SWPCTX to get off of the deactivated lev1map is not necessaray. - Refactor some duplicated code in pmap_growkernel() into a new pmap_kptpage_alloc() function. - In pmap_growkernel(), assert that any user pmap published on the all-pmaps list does not reference the kernel_lev1map. - In pmap_asn_alloc(), get out early if we're called with the kernel pmap, since all kernel mappings are ASM. Remove bogus assertions around the value of pmap::pm_lev1map and the current ASN, and simply assert that pmap::pm_lev1map is never kernel_lev1map. Also assert that preemption is disabled, since we're manipulating per-cpu data structures. - Convert the "too much uptime" panic to a simple KASSERT, and update the comment to reflect that we're only subject to the longer 75 billion year ASN generation overflow (because CPUs that don't implement ASNs never go through this code path). To generate a diff of this commit: cvs rdiff -u -r1.266 -r1.267 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.266 src/sys/arch/alpha/alpha/pmap.c:1.267 --- src/sys/arch/alpha/alpha/pmap.c:1.266 Fri Jan 17 22:03:56 2020 +++ src/sys/arch/alpha/alpha/pmap.c Sun Aug 16 20:04:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.266 2020/01/17 22:03:56 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.267 2020/08/16 20:04:36 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.266 2020/01/17 22:03:56 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.267 2020/08/16 20:04:36 thorpej Exp $"); #include #include @@ -219,7 +219,7 @@ static pt_entry_t *VPT; static struct { struct pmap k_pmap; struct pmap_asn_info k_asni[ALPHA_MAXPROCS]; -} kernel_pmap_store; +} kernel_pmap_store __cacheline_aligned; struct pmap *const kernel_pmap_ptr = _pmap_store.k_pmap; @@ -384,17 +384,18 @@ static krwlock_t pmap_growkernel_lock; #define PMAP_HEAD_TO_MAP_LOCK() rw_enter(_main_lock, RW_WRITER) #define PMAP_HEAD_TO_MAP_UNLOCK() rw_exit(_main_lock) -struct { - kmutex_t lock; -} __aligned(64) static pmap_pvh_locks[64] __aligned(64); +static union { + kmutex_t lock; + uint8_t pad[COHERENCY_UNIT]; +} pmap_pvh_locks[64] __cacheline_aligned; + +#define PVH_LOCK_HASH(pg) \ + uintptr_t)(pg)) >> 6) & 63) static inline kmutex_t * pmap_pvh_lock(struct vm_page *pg) { - - /* Cut bits 11-6 out of page address and use directly as offset. */ - return (kmutex_t *)((uintptr_t)_pvh_locks + - ((uintptr_t)pg & (63 << 6))); + return _pvh_locks[PVH_LOCK_HASH(pg)].lock; } #if defined(MULTIPROCESSOR) @@ -498,31 +499,12 @@ static int pmap_physpage_addref(void *); static int pmap_physpage_delref(void *); /* - * PMAP_ISACTIVE{,_TEST}: + * PMAP_ISACTIVE: * * Check to see if a pmap is active on the current processor. */ -#define PMAP_ISACTIVE_TEST(pm, cpu_id) \ - (((pm)->pm_cpus & (1UL << (cpu_id))) != 0) - -#if defined(DEBUG) && !defined(MULTIPROCESSOR) #define PMAP_ISACTIVE(pm, cpu_id) \ -({ \ - /*\ - * XXX This test is not MP-safe.\ - */\ - int isactive_ = PMAP_ISACTIVE_TEST(pm, cpu_id); \ - \ - if ((curlwp->l_flag & LW_IDLE) != 0 &&\ - curproc->p_vmspace != NULL &&\ - ((curproc->p_sflag & PS_WEXIT) == 0) && \ - (isactive_ ^ ((pm) == curproc->p_vmspace->vm_map.pmap))) \ - panic("PMAP_ISACTIVE"); \ - (isactive_); \ -}) -#else -#define PMAP_ISACTIVE(pm, cpu_id) PMAP_ISACTIVE_TEST(pm, cpu_id) -#endif /* DEBUG && !MULTIPROCESSOR
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun Aug 16 18:05:52 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: vm_machdep.c Log Message: In cpu_lwp_fork(), make sure that the PTBR field in l2's HWPCB references the lev1map associated with l2's pmap. Otherwise, the first time we SWPCTX to l2, we'll be on l1's page tables until the first pmap_activate() call for l2. To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/sys/arch/alpha/alpha/vm_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/alpha/alpha/vm_machdep.c diff -u src/sys/arch/alpha/alpha/vm_machdep.c:1.114 src/sys/arch/alpha/alpha/vm_machdep.c:1.115 --- src/sys/arch/alpha/alpha/vm_machdep.c:1.114 Mon Mar 19 10:31:56 2018 +++ src/sys/arch/alpha/alpha/vm_machdep.c Sun Aug 16 18:05:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.114 2018/03/19 10:31:56 martin Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.115 2020/08/16 18:05:52 thorpej Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.114 2018/03/19 10:31:56 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.115 2020/08/16 18:05:52 thorpej Exp $"); #include #include @@ -109,9 +109,15 @@ cpu_lwp_fork(struct lwp *l1, struct lwp pcb2->pcb_hw.apcb_usp = alpha_pal_rdusp(); /* - * Arrange for a non-local goto when the new process - * is started, to resume here, returning nonzero from setjmp. + * Put l2's lev1map into its PTBR so that it will be on its + * own page tables as the SWPCTX to its PCB is made. ASN + * doesn't matter at this point; that will be handled on l2's + * first pmap_activate() call. */ + pmap_t const pmap2 = l2->l_proc->p_vmspace->vm_map.pmap; + pcb2->pcb_hw.apcb_ptbr = + ALPHA_K0SEG_TO_PHYS((vaddr_t)pmap2->pm_lev1map) >> PGSHIFT; + #ifdef DIAGNOSTIC /* * If l1 != curlwp && l1 == , we are creating a kernel
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat Aug 15 16:09:07 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: ipifuncs.c Log Message: Convert some #ifdef DIAGNOSTIC checks to KASSERTs. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/arch/alpha/alpha/ipifuncs.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/alpha/alpha/ipifuncs.c diff -u src/sys/arch/alpha/alpha/ipifuncs.c:1.50 src/sys/arch/alpha/alpha/ipifuncs.c:1.51 --- src/sys/arch/alpha/alpha/ipifuncs.c:1.50 Sun Dec 1 15:34:44 2019 +++ src/sys/arch/alpha/alpha/ipifuncs.c Sat Aug 15 16:09:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ipifuncs.c,v 1.50 2019/12/01 15:34:44 ad Exp $ */ +/* $NetBSD: ipifuncs.c,v 1.51 2020/08/15 16:09:07 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.50 2019/12/01 15:34:44 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.51 2020/08/15 16:09:07 thorpej Exp $"); /* * Interprocessor interrupt handlers. @@ -159,13 +159,9 @@ void alpha_send_ipi(u_long cpu_id, u_long ipimask) { -#ifdef DIAGNOSTIC - if (cpu_id >= hwrpb->rpb_pcs_cnt || - cpu_info[cpu_id] == NULL) - panic("alpha_send_ipi: bogus cpu_id"); - if (((1UL << cpu_id) & cpus_running) == 0) - panic("alpha_send_ipi: CPU %ld not running", cpu_id); -#endif + KASSERT(cpu_id < hwrpb->rpb_pcs_cnt); + KASSERT(cpu_info[cpu_id] != NULL); + KASSERT(cpus_running & (1UL << cpu_id)); atomic_or_ulong(_info[cpu_id]->ci_ipis, ipimask); alpha_pal_wripir(cpu_id);
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Jul 21 13:37:19 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: db_instruction.h Log Message: Sort op_mskqh, op_insqh, and op_extqh. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/alpha/alpha/db_instruction.h 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/alpha/alpha/db_instruction.h diff -u src/sys/arch/alpha/alpha/db_instruction.h:1.9 src/sys/arch/alpha/alpha/db_instruction.h:1.10 --- src/sys/arch/alpha/alpha/db_instruction.h:1.9 Mon Feb 6 02:14:10 2012 +++ src/sys/arch/alpha/alpha/db_instruction.h Tue Jul 21 13:37:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: db_instruction.h,v 1.9 2012/02/06 02:14:10 matt Exp $ */ +/* $NetBSD: db_instruction.h,v 1.10 2020/07/21 13:37:18 thorpej Exp $ */ /* * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. @@ -357,9 +357,9 @@ typedef union { #define op_msklh 0x62 #define op_inslh 0x67 #define op_extlh 0x6a -#define op_extqh 0x7a -#define op_insqh 0x77 #define op_mskqh 0x72 +#define op_insqh 0x77 +#define op_extqh 0x7a /* MUL, "function" opcodes (bits 5..11) */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat Feb 22 20:29:16 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: machdep.c Log Message: Fix a couple of printf formats in debug messages. To generate a diff of this commit: cvs rdiff -u -r1.358 -r1.359 src/sys/arch/alpha/alpha/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/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.358 src/sys/arch/alpha/alpha/machdep.c:1.359 --- src/sys/arch/alpha/alpha/machdep.c:1.358 Sat Feb 22 17:33:42 2020 +++ src/sys/arch/alpha/alpha/machdep.c Sat Feb 22 20:29:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.358 2020/02/22 17:33:42 thorpej Exp $ */ +/* $NetBSD: machdep.c,v 1.359 2020/02/22 20:29:15 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.358 2020/02/22 17:33:42 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.359 2020/02/22 20:29:15 thorpej Exp $"); #include #include @@ -457,7 +457,7 @@ nobootinfo: } #if 0 - printf("Memory cluster count: %d\n", mddtp->mddt_cluster_cnt); + printf("Memory cluster count: %" PRIu64 "\n", mddtp->mddt_cluster_cnt); #endif for (i = 0; i < mddtp->mddt_cluster_cnt; i++) { @@ -601,7 +601,7 @@ nobootinfo: maxmem = physmem; #if 0 printf("totalphysmem = %d\n", totalphysmem); - printf("physmem = %d\n", physmem); + printf("physmem = %lu\n", physmem); printf("resvmem = %d\n", resvmem); printf("unusedmem = %d\n", unusedmem); printf("unknownmem = %d\n", unknownmem);
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat Feb 22 17:33:42 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: machdep.c Log Message: Make it clear that the pfn argument to alpha_init() is no longer used. To generate a diff of this commit: cvs rdiff -u -r1.357 -r1.358 src/sys/arch/alpha/alpha/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/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.357 src/sys/arch/alpha/alpha/machdep.c:1.358 --- src/sys/arch/alpha/alpha/machdep.c:1.357 Tue Dec 31 13:07:09 2019 +++ src/sys/arch/alpha/alpha/machdep.c Sat Feb 22 17:33:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.357 2019/12/31 13:07:09 ad Exp $ */ +/* $NetBSD: machdep.c,v 1.358 2020/02/22 17:33:42 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.357 2019/12/31 13:07:09 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.358 2020/02/22 17:33:42 thorpej Exp $"); #include #include @@ -216,8 +216,9 @@ const pcu_ops_t * const pcu_ops_md_defs[ }; void -alpha_init(u_long pfn, u_long ptb, u_long bim, u_long bip, u_long biv) - /* pfn: first free PFN number */ +alpha_init(u_long xxx_pfn __unused, u_long ptb, u_long bim, u_long bip, +u_long biv) + /* pfn: first free PFN number (no longer used) */ /* ptb: PFN of current level 1 page table */ /* bim: bootinfo magic */ /* bip: bootinfo pointer */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: skrll Date: Fri Feb 21 13:33:07 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: prom.c Log Message: Use designated initialisers To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/arch/alpha/alpha/prom.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/alpha/alpha/prom.c diff -u src/sys/arch/alpha/alpha/prom.c:1.50 src/sys/arch/alpha/alpha/prom.c:1.51 --- src/sys/arch/alpha/alpha/prom.c:1.50 Mon Sep 3 16:29:22 2018 +++ src/sys/arch/alpha/alpha/prom.c Fri Feb 21 13:33:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: prom.c,v 1.50 2018/09/03 16:29:22 riastradh Exp $ */ +/* $NetBSD: prom.c,v 1.51 2020/02/21 13:33:07 skrll Exp $ */ /* * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University @@ -27,7 +27,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.50 2018/09/03 16:29:22 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.51 2020/02/21 13:33:07 skrll Exp $"); #include "opt_multiprocessor.h" @@ -46,8 +46,13 @@ __KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.5 #include /* XXX this is to fake out the console routines, while booting. */ -struct consdev promcons = { NULL, NULL, promcngetc, promcnputc, - nullcnpollc, NULL, NULL, NULL, makedev(23,0), 1 }; +struct consdev promcons = { + .cn_getc = promcngetc, + .cn_putc = promcnputc, + .cn_pollc = nullcnpollc, + .cn_dev = makedev(23,0), + .cn_pri = 1 +}; struct rpb *hwrpb; int alpha_console;
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: skrll Date: Fri Jan 17 21:59:05 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Trailing whitespace To generate a diff of this commit: cvs rdiff -u -r1.264 -r1.265 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.264 src/sys/arch/alpha/alpha/pmap.c:1.265 --- src/sys/arch/alpha/alpha/pmap.c:1.264 Fri Mar 29 03:11:32 2019 +++ src/sys/arch/alpha/alpha/pmap.c Fri Jan 17 21:59:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.264 2019/03/29 03:11:32 thorpej Exp $ */ +/* $NetBSD: pmap.c,v 1.265 2020/01/17 21:59:05 skrll Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.264 2019/03/29 03:11:32 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.265 2020/01/17 21:59:05 skrll Exp $"); #include #include @@ -1011,7 +1011,7 @@ pmap_steal_memory(vsize_t size, vaddr_t { int npgs; vaddr_t va; - paddr_t pa; + paddr_t pa; uvm_physseg_t bank; @@ -1851,7 +1851,7 @@ out: PMAP_MAP_TO_HEAD_UNLOCK(); if (opv) pmap_pv_free(opv); - + return error; }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: skrll Date: Fri Jan 17 22:03:56 UTC 2020 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Convert #if 0'ed code to uvm_hotplug api To generate a diff of this commit: cvs rdiff -u -r1.265 -r1.266 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.265 src/sys/arch/alpha/alpha/pmap.c:1.266 --- src/sys/arch/alpha/alpha/pmap.c:1.265 Fri Jan 17 21:59:05 2020 +++ src/sys/arch/alpha/alpha/pmap.c Fri Jan 17 22:03:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.265 2020/01/17 21:59:05 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.266 2020/01/17 22:03:56 skrll Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.265 2020/01/17 21:59:05 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.266 2020/01/17 22:03:56 skrll Exp $"); #include #include @@ -1030,8 +1030,8 @@ pmap_steal_memory(vsize_t size, vaddr_t #if 0 printf(" bank %d: avail_start 0x%"PRIxPADDR", start 0x%"PRIxPADDR", " - "avail_end 0x%"PRIxPADDR"\n", bank, VM_PHYSMEM_PTR(bank)->avail_start, - VM_PHYSMEM_PTR(bank)->start, VM_PHYSMEM_PTR(bank)->avail_end); + "avail_end 0x%"PRIxPADDR"\n", bank, uvm_physseg_get_avail_start(bank), + uvm_physseg_get_start(bank), uvm_physseg_get_avail_end(bank)); #endif if (uvm_physseg_get_avail_start(bank) != uvm_physseg_get_start(bank) || @@ -1040,7 +1040,7 @@ pmap_steal_memory(vsize_t size, vaddr_t #if 0 printf(" avail_end - avail_start = 0x%"PRIxPADDR"\n", - VM_PHYSMEM_PTR(bank)->avail_end - VM_PHYSMEM_PTR(bank)->avail_start); + uvm_physseg_get_avail_end(bank) - uvm_physseg_get_avail_start(bank)); #endif if (uvm_physseg_get_avail_end(bank) - uvm_physseg_get_avail_start(bank) @@ -1098,14 +1098,16 @@ pmap_init(void) pmap_initialized = true; #if 0 - for (bank = 0; bank < vm_nphysseg; bank++) { + for (uvm_physseg_t bank = uvm_physseg_get_first(); + uvm_physseg_valid_p(bank); + bank = uvm_physseg_get_next(bank)) { printf("bank %d\n", bank); - printf("\tstart = 0x%x\n", ptoa(VM_PHYSMEM_PTR(bank)->start)); - printf("\tend = 0x%x\n", ptoa(VM_PHYSMEM_PTR(bank)->end)); - printf("\tavail_start = 0x%x\n", - ptoa(VM_PHYSMEM_PTR(bank)->avail_start)); - printf("\tavail_end = 0x%x\n", - ptoa(VM_PHYSMEM_PTR(bank)->avail_end)); + printf("\tstart = 0x%lx\n", ptoa(uvm_physseg_get_start(bank))); + printf("\tend = 0x%lx\n", ptoa(uvm_physseg_get_end(bank))); + printf("\tavail_start = 0x%lx\n", + ptoa(uvm_physseg_get_avail_start(bank))); + printf("\tavail_end = 0x%lx\n", + ptoa(uvm_physseg_get_avail_end(bank))); } #endif }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Apr 5 14:12:14 UTC 2019 Modified Files: src/sys/arch/alpha/alpha: machdep.c Log Message: Prrovide a basic (i.e. empty) module_init_md(). MODULAR doesn't quite work yet (missing support for a couple of relocations), but at last the kernel links. To generate a diff of this commit: cvs rdiff -u -r1.353 -r1.354 src/sys/arch/alpha/alpha/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/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.353 src/sys/arch/alpha/alpha/machdep.c:1.354 --- src/sys/arch/alpha/alpha/machdep.c:1.353 Mon Mar 25 19:24:30 2019 +++ src/sys/arch/alpha/alpha/machdep.c Fri Apr 5 14:12:14 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.353 2019/03/25 19:24:30 maxv Exp $ */ +/* $NetBSD: machdep.c,v 1.354 2019/04/05 14:12:14 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.353 2019/03/25 19:24:30 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.354 2019/04/05 14:12:14 thorpej Exp $"); #include #include @@ -80,6 +80,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v #include #include #include +#include #include #include #include @@ -794,6 +795,15 @@ nobootinfo: #endif } +#ifdef MODULAR +/* Push any modules loaded by the boot loader */ +void +module_init_md(void) +{ + /* nada. */ +} +#endif /* MODULAR */ + void consinit(void) {
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Fri Mar 29 03:11:32 UTC 2019 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Fix a couple of latent MP issues in the Alpha pmap: - In pmap_activate(), even though we manipulate the active mask with atomic ops, the lev1map pointer needs to stay consistent, so we do, in fact, have to take the pmap lock there. - In pmap_emulate_reference(), some of the DEBUG checks done here are race-prone, so don't do them. (Leave them #if 0'd out for documentary purposes.) To generate a diff of this commit: cvs rdiff -u -r1.263 -r1.264 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.263 src/sys/arch/alpha/alpha/pmap.c:1.264 --- src/sys/arch/alpha/alpha/pmap.c:1.263 Fri Mar 1 04:29:20 2019 +++ src/sys/arch/alpha/alpha/pmap.c Fri Mar 29 03:11:32 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.263 2019/03/01 04:29:20 mrg Exp $ */ +/* $NetBSD: pmap.c,v 1.264 2019/03/29 03:11:32 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.263 2019/03/01 04:29:20 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.264 2019/03/29 03:11:32 thorpej Exp $"); #include #include @@ -2126,6 +2126,14 @@ pmap_activate(struct lwp *l) printf("pmap_activate(%p)\n", l); #endif + /* + * Lock the pmap across the work we do here; although the + * in-use mask is manipulated with an atomic op and the + * ASN info is per-cpu, the lev1map pointer needs to remain + * consistent across the entire call. + */ + PMAP_LOCK(pmap); + /* Mark the pmap in use by this processor. */ atomic_or_ulong(>pm_cpus, (1UL << cpu_id)); @@ -2133,6 +2141,8 @@ pmap_activate(struct lwp *l) pmap_asn_alloc(pmap, cpu_id); PMAP_ACTIVATE(pmap, l, cpu_id); + + PMAP_UNLOCK(pmap); } /* @@ -2140,10 +2150,6 @@ pmap_activate(struct lwp *l) * * Mark that the pmap used by the specified process is no longer * in use by the processor. - * - * The comment above pmap_activate() wrt. locking applies here, - * as well. Note that we use only a single `atomic' operation, - * so no locking is necessary. */ void pmap_deactivate(struct lwp *l) @@ -2156,7 +2162,8 @@ pmap_deactivate(struct lwp *l) #endif /* - * Mark the pmap no longer in use by this processor. + * Mark the pmap no longer in use by this processor. Because + * this is all we're doing, no need to take the pmap lock. */ atomic_and_ulong(>pm_cpus, ~(1UL << cpu_number())); } @@ -2635,7 +2642,7 @@ pmap_emulate_reference(struct lwp *l, va printf("*pte = 0x%lx\n", *pte); } #endif -#ifdef DEBUG/* These checks are more expensive */ +#if 0/*DEBUG*/ /* These checks are, expensive, racy, and unreliable. */ if (!pmap_pte_v(pte)) panic("pmap_emulate_reference: invalid pte"); if (type == ALPHA_MMCSR_FOW) {
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: mrg Date: Fri Mar 1 04:29:20 UTC 2019 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: fix a typo in a comment To generate a diff of this commit: cvs rdiff -u -r1.262 -r1.263 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.262 src/sys/arch/alpha/alpha/pmap.c:1.263 --- src/sys/arch/alpha/alpha/pmap.c:1.262 Sat Jan 27 23:07:36 2018 +++ src/sys/arch/alpha/alpha/pmap.c Fri Mar 1 04:29:20 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.262 2018/01/27 23:07:36 chs Exp $ */ +/* $NetBSD: pmap.c,v 1.263 2019/03/01 04:29:20 mrg Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.262 2018/01/27 23:07:36 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.263 2019/03/01 04:29:20 mrg Exp $"); #include #include @@ -2245,7 +2245,7 @@ pmap_copy_page(paddr_t src, paddr_t dst) * pmap_pageidlezero: [ INTERFACE ] * * Page zero'er for the idle loop. Returns true if the - * page was zero'd, FLASE if we aborted for some reason. + * page was zero'd, FALSE if we aborted for some reason. */ bool pmap_pageidlezero(paddr_t pa)
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: martin Date: Mon Mar 19 10:31:56 UTC 2018 Modified Files: src/sys/arch/alpha/alpha: vm_machdep.c Log Message: Nowadays we can create new kernel threads late after boot, so if we are unable to find physically continous pages for their uarea, just allocate them via uvm_km_alloc(), that is: make cpu_uarea_alloc() fail instead of panic. cpu_uarea_free() already deals with this. Should fix PR port-alpha/53077. Discussed with maxv and mrg. To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/sys/arch/alpha/alpha/vm_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/alpha/alpha/vm_machdep.c diff -u src/sys/arch/alpha/alpha/vm_machdep.c:1.113 src/sys/arch/alpha/alpha/vm_machdep.c:1.114 --- src/sys/arch/alpha/alpha/vm_machdep.c:1.113 Fri May 16 19:18:21 2014 +++ src/sys/arch/alpha/alpha/vm_machdep.c Mon Mar 19 10:31:56 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.113 2014/05/16 19:18:21 matt Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.114 2018/03/19 10:31:56 martin Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.113 2014/05/16 19:18:21 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.114 2018/03/19 10:31:56 martin Exp $"); #include #include @@ -227,11 +227,8 @@ cpu_uarea_alloc(bool system) * direct-mapped. */ error = uvm_pglistalloc(USPACE, 0, ptoa(physmem), 0, 0, , 1, 1); - if (error) { - if (!system) - return NULL; - panic("%s: uvm_pglistalloc failed: %d", __func__, error); - } + if (error) + return NULL; /* * Get the physical address from the first page.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: mrg Date: Sat Mar 19 20:57:48 UTC 2016 Modified Files: src/sys/arch/alpha/alpha: compat_16_machdep.c Log Message: remove some dead code. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/alpha/compat_16_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/alpha/alpha/compat_16_machdep.c diff -u src/sys/arch/alpha/alpha/compat_16_machdep.c:1.19 src/sys/arch/alpha/alpha/compat_16_machdep.c:1.20 --- src/sys/arch/alpha/alpha/compat_16_machdep.c:1.19 Fri May 16 19:18:21 2014 +++ src/sys/arch/alpha/alpha/compat_16_machdep.c Sat Mar 19 20:57:48 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_16_machdep.c,v 1.19 2014/05/16 19:18:21 matt Exp $ */ +/* $NetBSD: compat_16_machdep.c,v 1.20 2016/03/19 20:57:48 mrg Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -86,7 +86,7 @@ #include #include -__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.19 2014/05/16 19:18:21 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.20 2016/03/19 20:57:48 mrg Exp $"); #ifdef DEBUG @@ -113,7 +113,7 @@ sendsig_sigcontext(const ksiginfo_t *ksi sig_t catcher = SIGACTION(p, sig).sa_handler; tf = l->l_md.md_tf; - fp = getframe(l, sig, ), frame; + fp = getframe(l, sig, ); fp--; #ifdef DEBUG
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: martin Date: Sun Jan 17 10:44:57 UTC 2016 Modified Files: src/sys/arch/alpha/alpha: interrupt.c Log Message: PR port-alpha/50667: add missing va_start/va_end. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/sys/arch/alpha/alpha/interrupt.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/alpha/alpha/interrupt.c diff -u src/sys/arch/alpha/alpha/interrupt.c:1.80 src/sys/arch/alpha/alpha/interrupt.c:1.81 --- src/sys/arch/alpha/alpha/interrupt.c:1.80 Mon Feb 6 02:14:11 2012 +++ src/sys/arch/alpha/alpha/interrupt.c Sun Jan 17 10:44:57 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: interrupt.c,v 1.80 2012/02/06 02:14:11 matt Exp $ */ +/* $NetBSD: interrupt.c,v 1.81 2016/01/17 10:44:57 martin Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.80 2012/02/06 02:14:11 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.81 2016/01/17 10:44:57 martin Exp $"); #include #include @@ -518,8 +518,12 @@ rlprintf(struct timeval *t, const char * va_list ap; static const struct timeval msgperiod[1] = {{ 5, 0 }}; - if (ratecheck(t, msgperiod)) - vprintf(fmt, ap); + if (!ratecheck(t, msgperiod)) + return; + + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); } const static uint8_t ipl2psl_table[] = {
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: martin Date: Mon Dec 14 10:12:45 UTC 2015 Modified Files: src/sys/arch/alpha/alpha: dec_kn300.c Log Message: Make it compile To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/dec_kn300.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/alpha/alpha/dec_kn300.c diff -u src/sys/arch/alpha/alpha/dec_kn300.c:1.41 src/sys/arch/alpha/alpha/dec_kn300.c:1.42 --- src/sys/arch/alpha/alpha/dec_kn300.c:1.41 Sun Dec 13 19:43:27 2015 +++ src/sys/arch/alpha/alpha/dec_kn300.c Mon Dec 14 10:12:45 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: dec_kn300.c,v 1.41 2015/12/13 19:43:27 christos Exp $ */ +/* $NetBSD: dec_kn300.c,v 1.42 2015/12/14 10:12:45 martin Exp $ */ /* * Copyright (c) 1998 by Matthew Jacob @@ -34,7 +34,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_kn300.c,v 1.41 2015/12/13 19:43:27 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_kn300.c,v 1.42 2015/12/14 10:12:45 martin Exp $"); #include #include @@ -415,9 +415,6 @@ typedef struct { } mc_soft300; #define CAP_ERR_CRDX 204 -static const char * -corr_type(unsigned long code) - static void kn300_softerr(unsigned long mces, unsigned long type, unsigned long logout, struct trapframe *framep) {
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: christos Date: Sun Dec 13 19:43:27 UTC 2015 Modified Files: src/sys/arch/alpha/alpha: dec_kn300.c Log Message: PR/50523: David Binderman: Fix incorrect shifts. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/arch/alpha/alpha/dec_kn300.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/alpha/alpha/dec_kn300.c diff -u src/sys/arch/alpha/alpha/dec_kn300.c:1.40 src/sys/arch/alpha/alpha/dec_kn300.c:1.41 --- src/sys/arch/alpha/alpha/dec_kn300.c:1.40 Sat Oct 13 13:58:54 2012 +++ src/sys/arch/alpha/alpha/dec_kn300.c Sun Dec 13 14:43:27 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: dec_kn300.c,v 1.40 2012/10/13 17:58:54 jdc Exp $ */ +/* $NetBSD: dec_kn300.c,v 1.41 2015/12/13 19:43:27 christos Exp $ */ /* * Copyright (c) 1998 by Matthew Jacob @@ -34,7 +34,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_kn300.c,v 1.40 2012/10/13 17:58:54 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_kn300.c,v 1.41 2015/12/13 19:43:27 christos Exp $"); #include #include @@ -415,6 +415,9 @@ typedef struct { } mc_soft300; #define CAP_ERR_CRDX 204 +static const char * +corr_type(unsigned long code) + static void kn300_softerr(unsigned long mces, unsigned long type, unsigned long logout, struct trapframe *framep) { @@ -431,8 +434,8 @@ kn300_softerr(unsigned long mces, unsign printf("kn300: CPU ID %d %s correctable error corrected by %s\n", whami, (type == ALPHA_SYS_ERROR)? sys : proc, - ((hdr->mcheck_code & 0xff00) == (EV5_CORRECTED << 16))? proc : - (((hdr->mcheck_code & 0xff00) == (CAP_ERR_CRDX << 16)) ? + ((hdr->mcheck_code & 0xff00) == (EV5_CORRECTED << 8))? proc : + (((hdr->mcheck_code & 0xff00) == (CAP_ERR_CRDX << 8)) ? "I/O Bridge Module" : sys)); printf("Machine Check Code 0x%lx\n", hdr->mcheck_code);
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: martin Date: Sat Oct 10 17:00:12 UTC 2015 Modified Files: src/sys/arch/alpha/alpha: cpu.c Log Message: PR port-alpha/50325: cosmetic fix for cpu attach message from Felix Deichmann. To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/arch/alpha/alpha/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/alpha/alpha/cpu.c diff -u src/sys/arch/alpha/alpha/cpu.c:1.95 src/sys/arch/alpha/alpha/cpu.c:1.96 --- src/sys/arch/alpha/alpha/cpu.c:1.95 Mon Feb 6 02:14:10 2012 +++ src/sys/arch/alpha/alpha/cpu.c Sat Oct 10 17:00:12 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.95 2012/02/06 02:14:10 matt Exp $ */ +/* $NetBSD: cpu.c,v 1.96 2015/10/10 17:00:12 martin Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.95 2012/02/06 02:14:10 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.96 2015/10/10 17:00:12 martin Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -217,7 +217,7 @@ cpuattach(device_t parent, device_t self s = cpunametable[i].cpu_minor_names; for(i = 0; s && s[i]; ++i) { if (i == minor && strlen(s[i]) != 0) { - aprint_normal(" (%s)\n", s[i]); + aprint_normal(" (%s)", s[i]); goto recognized; } }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: christos Date: Sat Mar 7 18:51:44 UTC 2015 Modified Files: src/sys/arch/alpha/alpha: linux_syscall.c osf1_syscall.c Log Message: Adjust to new trace_{enter,exit} signature. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/alpha/linux_syscall.c cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/osf1_syscall.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/alpha/alpha/linux_syscall.c diff -u src/sys/arch/alpha/alpha/linux_syscall.c:1.32 src/sys/arch/alpha/alpha/linux_syscall.c:1.33 --- src/sys/arch/alpha/alpha/linux_syscall.c:1.32 Sun Feb 5 21:14:11 2012 +++ src/sys/arch/alpha/alpha/linux_syscall.c Sat Mar 7 13:51:44 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: linux_syscall.c,v 1.32 2012/02/06 02:14:11 matt Exp $ */ +/* $NetBSD: linux_syscall.c,v 1.33 2015/03/07 18:51:44 christos Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -89,7 +89,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: linux_syscall.c,v 1.32 2012/02/06 02:14:11 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: linux_syscall.c,v 1.33 2015/03/07 18:51:44 christos Exp $); #include sys/param.h #include sys/systm.h @@ -282,7 +282,7 @@ linux_syscall_fancy(struct lwp *l, uint6 args += hidden; - if ((error = trace_enter(code, args, callp-sy_narg)) != 0) + if ((error = trace_enter(code, callp, args)) != 0) goto out; rval[0] = 0; @@ -308,7 +308,7 @@ out: break; } - trace_exit(code, rval, error); + trace_exit(code, callp, args, rval, error); userret(l); } Index: src/sys/arch/alpha/alpha/osf1_syscall.c diff -u src/sys/arch/alpha/alpha/osf1_syscall.c:1.34 src/sys/arch/alpha/alpha/osf1_syscall.c:1.35 --- src/sys/arch/alpha/alpha/osf1_syscall.c:1.34 Sun Feb 5 21:14:12 2012 +++ src/sys/arch/alpha/alpha/osf1_syscall.c Sat Mar 7 13:51:44 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: osf1_syscall.c,v 1.34 2012/02/06 02:14:12 matt Exp $ */ +/* $NetBSD: osf1_syscall.c,v 1.35 2015/03/07 18:51:44 christos Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -89,7 +89,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: osf1_syscall.c,v 1.34 2012/02/06 02:14:12 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: osf1_syscall.c,v 1.35 2015/03/07 18:51:44 christos Exp $); #include sys/param.h #include sys/systm.h @@ -278,7 +278,7 @@ osf1_syscall_fancy(struct lwp *l, uint64 } args += hidden; - if ((error = trace_enter(code, args, callp-sy_narg)) != 0) + if ((error = trace_enter(code, callp, args)) != 0) goto out; rval[0] = 0; @@ -304,7 +304,7 @@ out: break; } - trace_exit(code, rval, error); + trace_exit(code, callp, args, rval, error); userret(l); }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: martin Date: Mon Mar 2 11:07:16 UTC 2015 Modified Files: src/sys/arch/alpha/alpha: trap.c Log Message: Handle EINVAL in fault path, so mmap() access past EOF gets SIGBUS. To generate a diff of this commit: cvs rdiff -u -r1.131 -r1.132 src/sys/arch/alpha/alpha/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/alpha/alpha/trap.c diff -u src/sys/arch/alpha/alpha/trap.c:1.131 src/sys/arch/alpha/alpha/trap.c:1.132 --- src/sys/arch/alpha/alpha/trap.c:1.131 Fri May 16 06:11:21 2014 +++ src/sys/arch/alpha/alpha/trap.c Mon Mar 2 11:07:16 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.131 2014/05/16 06:11:21 martin Exp $ */ +/* $NetBSD: trap.c,v 1.132 2015/03/02 11:07:16 martin Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -93,7 +93,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.131 2014/05/16 06:11:21 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.132 2015/03/02 11:07:16 martin Exp $); #include sys/param.h #include sys/systm.h @@ -496,19 +496,28 @@ do_fault: KSI_INIT_TRAP(ksi); ksi.ksi_addr = (void *)a0; ksi.ksi_trap = a1; /* MMCSR VALUE */ - if (rv == ENOMEM) { + switch (rv) { + case ENOMEM: printf(UVM: pid %d (%s), uid %d killed: out of swap\n, l-l_proc-p_pid, l-l_proc-p_comm, l-l_cred ? kauth_cred_geteuid(l-l_cred) : -1); ksi.ksi_signo = SIGKILL; - } else +break; + case EINVAL: +ksi.ksi_signo = SIGBUS; +ksi.ksi_code = BUS_ADRERR; +break; + case EACCES: ksi.ksi_signo = SIGSEGV; - if (rv == EACCES) ksi.ksi_code = SEGV_ACCERR; - else +break; + default: +ksi.ksi_signo = SIGSEGV; ksi.ksi_code = SEGV_MAPERR; +break; + } break; }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: matt Date: Mon May 19 06:55:54 UTC 2014 Modified Files: src/sys/arch/alpha/alpha: fp_complete.c Log Message: When completing a FP trap, only load the FPU if we don't already own it. While the FPU is on, disable kernel preemption. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/alpha/fp_complete.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/alpha/alpha/fp_complete.c diff -u src/sys/arch/alpha/alpha/fp_complete.c:1.19 src/sys/arch/alpha/alpha/fp_complete.c:1.20 --- src/sys/arch/alpha/alpha/fp_complete.c:1.19 Sun May 18 11:04:51 2014 +++ src/sys/arch/alpha/alpha/fp_complete.c Mon May 19 06:55:54 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: fp_complete.c,v 1.19 2014/05/18 11:04:51 martin Exp $ */ +/* $NetBSD: fp_complete.c,v 1.20 2014/05/19 06:55:54 matt Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -35,7 +35,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: fp_complete.c,v 1.19 2014/05/18 11:04:51 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: fp_complete.c,v 1.20 2014/05/19 06:55:54 matt Exp $); #include opt_compat_osf1.h @@ -408,11 +408,13 @@ alpha_write_fp_c(struct lwp *l, uint64_t if ((md_flags MDLWP_FP_C) == fp_c) return; l-l_md.md_flags = (md_flags ~MDLWP_FP_C) | fp_c; + kpreempt_disable(); if (md_flags MDLWP_FPACTIVE) { alpha_pal_wrfen(1); fp_c_to_fpcr(l); alpha_pal_wrfen(0); } + kpreempt_enable(); } uint64_t @@ -586,7 +588,10 @@ alpha_fp_complete_at(alpha_instruction * this_cannot_happen(6, -1); return SIGSEGV; } - fpu_load(); + kpreempt_disable(); + if ((curlwp-l_md.md_flags MDLWP_FPACTIVE) == 0) { + fpu_load(); + } alpha_pal_wrfen(1); /* * If necessary, lie about the dynamic rounding mode so emulation @@ -612,6 +617,7 @@ alpha_fp_complete_at(alpha_instruction * alpha_write_fpcr(fp_c_to_fpcr_1(orig_fpcr, md_flags)); needsig = changed_flags FP_C_TO_NETBSD_MASK(md_flags); alpha_pal_wrfen(0); + kpreempt_enable(); if (__predict_false(needsig)) { *ucode = needsig; return SIGFPE;
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: matt Date: Mon May 19 07:09:10 UTC 2014 Modified Files: src/sys/arch/alpha/alpha: fp_complete.c Log Message: Update PCU_REENABLE for MP. For UP, add a KASSERT to make sure it's never present. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/alpha/alpha/fp_complete.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/alpha/alpha/fp_complete.c diff -u src/sys/arch/alpha/alpha/fp_complete.c:1.20 src/sys/arch/alpha/alpha/fp_complete.c:1.21 --- src/sys/arch/alpha/alpha/fp_complete.c:1.20 Mon May 19 06:55:54 2014 +++ src/sys/arch/alpha/alpha/fp_complete.c Mon May 19 07:09:10 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: fp_complete.c,v 1.20 2014/05/19 06:55:54 matt Exp $ */ +/* $NetBSD: fp_complete.c,v 1.21 2014/05/19 07:09:10 matt Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -35,7 +35,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: fp_complete.c,v 1.20 2014/05/19 06:55:54 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: fp_complete.c,v 1.21 2014/05/19 07:09:10 matt Exp $); #include opt_compat_osf1.h @@ -731,10 +731,20 @@ fpu_state_load(struct lwp *l, u_int flag struct pcb * const pcb = lwp_getpcb(l); KASSERT(l == curlwp); +#ifdef MULTIPROCESSOR + /* + * If the LWP got switched to another CPU, pcu_switchpoint would have + * called state_release to clear MDLWP_FPACTIVE. Now that we are back + * on the CPU that has our FP context, set MDLWP_FPACTIVE again. + */ if (flags PCU_REENABLE) { - KASSERT(l-l_md.md_flags MDLWP_FPACTIVE); + KASSERT(flags PCU_VALID); + l-l_md.md_flags |= MDLWP_FPACTIVE; return; } +#else + KASSERT((flags PCU_REENABLE) == 0); +#endif /* * Instrument FP usage -- if a process had not previously
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: martin Date: Sun May 18 10:43:54 UTC 2014 Modified Files: src/sys/arch/alpha/alpha: fp_complete.c Log Message: Properly handle PCU_REENABLE in fpu_state_load. Hint from Nick Hudson. This seems to help PR port-alpha/48782 a lot. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/alpha/fp_complete.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/alpha/alpha/fp_complete.c diff -u src/sys/arch/alpha/alpha/fp_complete.c:1.17 src/sys/arch/alpha/alpha/fp_complete.c:1.18 --- src/sys/arch/alpha/alpha/fp_complete.c:1.17 Fri May 16 19:18:21 2014 +++ src/sys/arch/alpha/alpha/fp_complete.c Sun May 18 10:43:54 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: fp_complete.c,v 1.17 2014/05/16 19:18:21 matt Exp $ */ +/* $NetBSD: fp_complete.c,v 1.18 2014/05/18 10:43:54 martin Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -35,7 +35,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: fp_complete.c,v 1.17 2014/05/16 19:18:21 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: fp_complete.c,v 1.18 2014/05/18 10:43:54 martin Exp $); #include opt_compat_osf1.h @@ -723,6 +723,12 @@ void fpu_state_load(struct lwp *l, u_int flags) { struct pcb * const pcb = lwp_getpcb(l); + KASSERT(l == curlwp); + + if (flags PCU_REENABLE) { + l-l_md.md_flags |= MDLWP_FPACTIVE; + return; + } /* * Instrument FP usage -- if a process had not previously
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: martin Date: Sun May 18 11:04:51 UTC 2014 Modified Files: src/sys/arch/alpha/alpha: fp_complete.c Log Message: No need to re-set MDLWP_FPACTIVE in the REENABLE case - it should be set already. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/alpha/fp_complete.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/alpha/alpha/fp_complete.c diff -u src/sys/arch/alpha/alpha/fp_complete.c:1.18 src/sys/arch/alpha/alpha/fp_complete.c:1.19 --- src/sys/arch/alpha/alpha/fp_complete.c:1.18 Sun May 18 10:43:54 2014 +++ src/sys/arch/alpha/alpha/fp_complete.c Sun May 18 11:04:51 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: fp_complete.c,v 1.18 2014/05/18 10:43:54 martin Exp $ */ +/* $NetBSD: fp_complete.c,v 1.19 2014/05/18 11:04:51 martin Exp $ */ /*- * Copyright (c) 2001 Ross Harvey @@ -35,7 +35,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: fp_complete.c,v 1.18 2014/05/18 10:43:54 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: fp_complete.c,v 1.19 2014/05/18 11:04:51 martin Exp $); #include opt_compat_osf1.h @@ -726,7 +726,7 @@ fpu_state_load(struct lwp *l, u_int flag KASSERT(l == curlwp); if (flags PCU_REENABLE) { - l-l_md.md_flags |= MDLWP_FPACTIVE; + KASSERT(l-l_md.md_flags MDLWP_FPACTIVE); return; }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: martin Date: Fri May 16 06:11:21 UTC 2014 Modified Files: src/sys/arch/alpha/alpha: trap.c Log Message: When creating a SIGFPE siginfo for a gentrap, we have no additional info (ucode) available, and the pal interface does not provide additional details either. Hardcode the si_code value to FPE_INTDIV, since the only callers of gentrap in our kernel seem to be the division routines in libkern. To generate a diff of this commit: cvs rdiff -u -r1.130 -r1.131 src/sys/arch/alpha/alpha/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/alpha/alpha/trap.c diff -u src/sys/arch/alpha/alpha/trap.c:1.130 src/sys/arch/alpha/alpha/trap.c:1.131 --- src/sys/arch/alpha/alpha/trap.c:1.130 Thu Mar 20 20:51:40 2014 +++ src/sys/arch/alpha/alpha/trap.c Fri May 16 06:11:21 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.130 2014/03/20 20:51:40 christos Exp $ */ +/* $NetBSD: trap.c,v 1.131 2014/05/16 06:11:21 martin Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -93,7 +93,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.130 2014/03/20 20:51:40 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.131 2014/05/16 06:11:21 martin Exp $); #include sys/param.h #include sys/systm.h @@ -323,7 +323,7 @@ trap(const u_long a0, const u_long a1, c if (framep-tf_regs[FRAME_A0] == -2) { /* weird! */ KSI_INIT_TRAP(ksi); ksi.ksi_signo = SIGFPE; -ksi.ksi_code = alpha_ucode_to_ksiginfo(ucode); +ksi.ksi_code = FPE_INTDIV; ksi.ksi_addr = (void *)l-l_md.md_tf-tf_regs[FRAME_PC]; ksi.ksi_trap = a0; /* exception summary */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: christos Date: Thu Mar 20 20:51:40 UTC 2014 Modified Files: src/sys/arch/alpha/alpha: db_disasm.c machdep.c trap.c Log Message: kill sprintf To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/alpha/alpha/db_disasm.c cvs rdiff -u -r1.342 -r1.343 src/sys/arch/alpha/alpha/machdep.c cvs rdiff -u -r1.129 -r1.130 src/sys/arch/alpha/alpha/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/alpha/alpha/db_disasm.c diff -u src/sys/arch/alpha/alpha/db_disasm.c:1.15 src/sys/arch/alpha/alpha/db_disasm.c:1.16 --- src/sys/arch/alpha/alpha/db_disasm.c:1.15 Sun Feb 5 21:14:10 2012 +++ src/sys/arch/alpha/alpha/db_disasm.c Thu Mar 20 16:51:40 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: db_disasm.c,v 1.15 2012/02/06 02:14:10 matt Exp $ */ +/* $NetBSD: db_disasm.c,v 1.16 2014/03/20 20:51:40 christos Exp $ */ /* * Mach Operating System @@ -48,7 +48,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: db_disasm.c,v 1.15 2012/02/06 02:14:10 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: db_disasm.c,v 1.16 2014/03/20 20:51:40 christos Exp $); #include sys/param.h #include sys/systm.h @@ -199,7 +199,7 @@ pal_opname(int op) return (pal_op_tbl[i].name); } - sprintf(unk, 0x%x, op); + snprintf(unk, sizeof(unk), 0x%x, op); return (unk); } @@ -253,7 +253,7 @@ arit_name(int op) if (name != NULL) return (name); - sprintf(unk, ?arit 0x%x?, op); + snprintf(unk, sizeof(unk), ?arit 0x%x?, op); return (unk); } @@ -301,7 +301,7 @@ logical_name(int op) if (name != NULL) return (name); - sprintf(unk, ?logical 0x%x?, op); + snprintf(unk, sizeof(unk), ?logical 0x%x?, op); return (unk); } @@ -344,7 +344,7 @@ bitop_name(int op) if (name != NULL) return (name); - sprintf(unk, ?bit 0x%x?, op); + snprintf(unk, sizeof(unk), ?bit 0x%x?, op); return (unk); } @@ -366,7 +366,7 @@ mul_name(int op) if (name != NULL) return (name); - sprintf(unk, ?mul 0x%x?, op); + snprintf(unk, sizeof(unk), ?mul 0x%x?, op); return (unk); } @@ -398,7 +398,7 @@ special_name(int op) if (name != NULL) return (name); - sprintf(unk, ?special 0x%x?, op); + snprintf(unk, sizeof(unk), ?special 0x%x?, op); return (unk); } @@ -435,7 +435,7 @@ intmisc_name(int op) case op_ftois: return (ftois); } - sprintf(unk, ?intmisc 0x%x?, op); + snprintf(unk, sizeof(unk), ?intmisc 0x%x?, op); return (unk); } @@ -450,7 +450,7 @@ float_name(const struct tbl *tbl, int op return (tbl[i].name); } - sprintf(unk, ?%s 0x%x?, type, op); + snprintf(unk, sizeof(unk), ?%s 0x%x?, type, op); return (unk); } Index: src/sys/arch/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.342 src/sys/arch/alpha/alpha/machdep.c:1.343 --- src/sys/arch/alpha/alpha/machdep.c:1.342 Tue Sep 11 22:00:53 2012 +++ src/sys/arch/alpha/alpha/machdep.c Thu Mar 20 16:51:40 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.342 2012/09/12 02:00:53 manu Exp $ */ +/* $NetBSD: machdep.c,v 1.343 2014/03/20 20:51:40 christos Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.342 2012/09/12 02:00:53 manu Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.343 2014/03/20 20:51:40 christos Exp $); #include sys/param.h #include sys/systm.h @@ -928,7 +928,7 @@ alpha_unknown_sysname(void) { static char s[128]; /* safe size */ - sprintf(s, %s family, unknown model variation 0x%lx, + snprintf(s, sizeof(s), %s family, unknown model variation 0x%lx, platform.family, hwrpb-rpb_variation SV_ST_MASK); return ((const char *)s); } Index: src/sys/arch/alpha/alpha/trap.c diff -u src/sys/arch/alpha/alpha/trap.c:1.129 src/sys/arch/alpha/alpha/trap.c:1.130 --- src/sys/arch/alpha/alpha/trap.c:1.129 Mon Nov 4 11:57:32 2013 +++ src/sys/arch/alpha/alpha/trap.c Thu Mar 20 16:51:40 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.129 2013/11/04 16:57:32 christos Exp $ */ +/* $NetBSD: trap.c,v 1.130 2014/03/20 20:51:40 christos Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -93,7 +93,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.129 2013/11/04 16:57:32 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.130 2014/03/20 20:51:40 christos Exp $); #include sys/param.h #include sys/systm.h @@ -174,7 +174,7 @@ printtrap(const u_long a0, const u_long entryname = system call; break; default: - sprintf(ubuf, type %lx, entry); + snprintf(ubuf, sizeof(ubuf), type %lx, entry); entryname = (const char *) ubuf; break; }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: matt Date: Wed Jan 1 22:35:54 UTC 2014 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Define kernel_pmap_store as a pmap followed by ALPHA_MAXPROCS pmap_asn_info. kernel_pmap_ptr now points to the pmap in kernel_pmap_store. To generate a diff of this commit: cvs rdiff -u -r1.258 -r1.259 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c diff -u src/sys/arch/alpha/alpha/pmap.c:1.258 src/sys/arch/alpha/alpha/pmap.c:1.259 --- src/sys/arch/alpha/alpha/pmap.c:1.258 Mon Feb 6 02:14:12 2012 +++ src/sys/arch/alpha/alpha/pmap.c Wed Jan 1 22:35:54 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.258 2012/02/06 02:14:12 matt Exp $ */ +/* $NetBSD: pmap.c,v 1.259 2014/01/01 22:35:54 matt Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc. @@ -140,7 +140,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.258 2012/02/06 02:14:12 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.259 2014/01/01 22:35:54 matt Exp $); #include sys/param.h #include sys/systm.h @@ -217,10 +217,12 @@ pt_entry_t *kernel_lev1map; */ static pt_entry_t *VPT; -static struct pmap kernel_pmap_store - [(PMAP_SIZEOF(ALPHA_MAXPROCS) + sizeof(struct pmap) - 1) - / sizeof(struct pmap)]; -struct pmap *const kernel_pmap_ptr = kernel_pmap_store; +static struct { + struct pmap k_pmap; + struct pmap_asn_info k_asni[ALPHA_MAXPROCS]; +} kernel_pmap_store; + +struct pmap *const kernel_pmap_ptr = kernel_pmap_store.k_pmap; paddr_t avail_start; /* PA of first available physical page */ paddr_t avail_end; /* PA of last available physical page */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: christos Date: Mon Nov 4 16:57:32 UTC 2013 Modified Files: src/sys/arch/alpha/alpha: trap.c Log Message: mark variable __diagused To generate a diff of this commit: cvs rdiff -u -r1.128 -r1.129 src/sys/arch/alpha/alpha/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/alpha/alpha/trap.c diff -u src/sys/arch/alpha/alpha/trap.c:1.128 src/sys/arch/alpha/alpha/trap.c:1.129 --- src/sys/arch/alpha/alpha/trap.c:1.128 Sun Feb 19 16:05:59 2012 +++ src/sys/arch/alpha/alpha/trap.c Mon Nov 4 11:57:32 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.128 2012/02/19 21:05:59 rmind Exp $ */ +/* $NetBSD: trap.c,v 1.129 2013/11/04 16:57:32 christos Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -93,7 +93,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.128 2012/02/19 21:05:59 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.129 2013/11/04 16:57:32 christos Exp $); #include sys/param.h #include sys/systm.h @@ -1127,7 +1127,7 @@ startlwp(void *arg) { ucontext_t *uc = arg; lwp_t *l = curlwp; - int error; + int error __diagused; error = cpu_setmcontext(l, uc-uc_mcontext, uc-uc_flags); KASSERT(error == 0);
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: christos Date: Mon Nov 4 16:57:41 UTC 2013 Modified Files: src/sys/arch/alpha/alpha: dec_kn8ae.c Log Message: remove unused variable To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/dec_kn8ae.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/alpha/alpha/dec_kn8ae.c diff -u src/sys/arch/alpha/alpha/dec_kn8ae.c:1.41 src/sys/arch/alpha/alpha/dec_kn8ae.c:1.42 --- src/sys/arch/alpha/alpha/dec_kn8ae.c:1.41 Sun Feb 5 21:14:11 2012 +++ src/sys/arch/alpha/alpha/dec_kn8ae.c Mon Nov 4 11:57:41 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: dec_kn8ae.c,v 1.41 2012/02/06 02:14:11 matt Exp $ */ +/* $NetBSD: dec_kn8ae.c,v 1.42 2013/11/04 16:57:41 christos Exp $ */ /* * Copyright (c) 1997 by Matthew Jacob @@ -32,7 +32,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: dec_kn8ae.c,v 1.41 2012/02/06 02:14:11 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: dec_kn8ae.c,v 1.42 2013/11/04 16:57:41 christos Exp $); #include sys/param.h #include sys/systm.h @@ -470,7 +470,6 @@ void kn8ae_mcheck(unsigned long mces, unsigned long type, unsigned long logout, struct trapframe *framep) { struct mchkinfo *mcp; - int get_dwlpx_regs; struct tlsb_mchk_fatal mcs[TLSB_NODE_MAX+1], *ptr; mc_hdr_ev5 *hdr; mc_uc_ev5 *mptr; @@ -484,7 +483,6 @@ kn8ae_mcheck(unsigned long mces, unsigne return; } - get_dwlpx_regs = 0; ptr = NULL; memset(mcs, 0, sizeof (mcs));
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: matt Date: Wed Jun 26 15:09:59 UTC 2013 Modified Files: src/sys/arch/alpha/alpha: syscall.c Log Message: Use sy_invoke To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/alpha/syscall.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/alpha/alpha/syscall.c diff -u src/sys/arch/alpha/alpha/syscall.c:1.41 src/sys/arch/alpha/alpha/syscall.c:1.42 --- src/sys/arch/alpha/alpha/syscall.c:1.41 Sun Jul 22 14:02:11 2012 +++ src/sys/arch/alpha/alpha/syscall.c Wed Jun 26 15:09:59 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.41 2012/07/22 14:02:11 matt Exp $ */ +/* $NetBSD: syscall.c,v 1.42 2013/06/26 15:09:59 matt Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -89,7 +89,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.41 2012/07/22 14:02:11 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.42 2013/06/26 15:09:59 matt Exp $); #include sys/param.h #include sys/systm.h @@ -190,19 +190,7 @@ syscall(struct lwp *l, uint64_t code, st } args += hidden; - if (!__predict_false(p-p_trace_enabled) - || __predict_false(callp-sy_flags SYCALL_INDIRECT) - || (error = trace_enter(code, args, callp-sy_narg)) == 0) { - rval[0] = 0; - rval[1] = 0; - error = sy_call(callp, l, args, rval); - } - - if (__predict_false(p-p_trace_enabled) - !__predict_false(callp-sy_flags SYCALL_INDIRECT)) { - trace_exit(code, rval, error); - } - + error = sy_invoke(callp, l, args, rval, code); if (__predict_true(error == 0)) { tf-tf_regs[FRAME_V0] = rval[0];
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: matt Date: Sat Jul 28 00:57:05 UTC 2012 Modified Files: src/sys/arch/alpha/alpha: machdep.c Log Message: physmem is defined in uvm_page.c To generate a diff of this commit: cvs rdiff -u -r1.340 -r1.341 src/sys/arch/alpha/alpha/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/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.340 src/sys/arch/alpha/alpha/machdep.c:1.341 --- src/sys/arch/alpha/alpha/machdep.c:1.340 Wed Jun 13 17:13:41 2012 +++ src/sys/arch/alpha/alpha/machdep.c Sat Jul 28 00:57:04 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.340 2012/06/13 17:13:41 njoly Exp $ */ +/* $NetBSD: machdep.c,v 1.341 2012/07/28 00:57:04 matt Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.340 2012/06/13 17:13:41 njoly Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.341 2012/07/28 00:57:04 matt Exp $); #include sys/param.h #include sys/systm.h @@ -143,7 +143,6 @@ void *msgbufaddr; int maxmem; /* max memory per process */ int totalphysmem; /* total amount of physical memory in system */ -int physmem; /* physical memory used by NetBSD + some rsvd */ int resvmem; /* amount of memory reserved for PROM */ int unusedmem; /* amount of memory for OS that we don't use */ int unknownmem; /* amount of memory with an unknown use */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: matt Date: Sun Jul 22 14:02:11 UTC 2012 Modified Files: src/sys/arch/alpha/alpha: syscall.c Log Message: Use new style syscall format which uses __predict_* to optimize branches. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/arch/alpha/alpha/syscall.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/alpha/alpha/syscall.c diff -u src/sys/arch/alpha/alpha/syscall.c:1.40 src/sys/arch/alpha/alpha/syscall.c:1.41 --- src/sys/arch/alpha/alpha/syscall.c:1.40 Tue Feb 21 17:39:17 2012 +++ src/sys/arch/alpha/alpha/syscall.c Sun Jul 22 14:02:11 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.40 2012/02/21 17:39:17 para Exp $ */ +/* $NetBSD: syscall.c,v 1.41 2012/07/22 14:02:11 matt Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -89,7 +89,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.40 2012/02/21 17:39:17 para Exp $); +__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.41 2012/07/22 14:02:11 matt Exp $); #include sys/param.h #include sys/systm.h @@ -104,17 +104,13 @@ __KERNEL_RCSID(0, $NetBSD: syscall.c,v #include machine/alpha.h #include machine/userret.h -void syscall_plain(struct lwp *, uint64_t, struct trapframe *); -void syscall_fancy(struct lwp *, uint64_t, struct trapframe *); +void syscall(struct lwp *, uint64_t, struct trapframe *); void syscall_intern(struct proc *p) { - if (trace_is_enabled(p)) - p-p_md.md_syscall = syscall_fancy; - else - p-p_md.md_syscall = syscall_plain; + p-p_md.md_syscall = syscall; } /* @@ -130,108 +126,21 @@ syscall_intern(struct proc *p) * in the trap frame. On return, it restores the callee-saved registers, * a3, and v0 from the frame before returning to the user process. */ -void -syscall_plain(struct lwp *l, uint64_t code, struct trapframe *framep) -{ - const struct sysent *callp; - int error; - uint64_t rval[2]; - uint64_t *args, copyargs[10];/* XXX */ - u_int hidden, nargs; - struct proc *p = l-l_proc; - - LWP_CACHE_CREDS(l, p); - - curcpu()-ci_data.cpu_nsyscall++; - l-l_md.md_tf = framep; - - callp = p-p_emul-e_sysent; - - switch (code) { - case SYS_syscall: - case SYS___syscall: - /* - * syscall() and __syscall() are handled the same on - * the alpha, as everything is 64-bit aligned, anyway. - */ - code = framep-tf_regs[FRAME_A0]; - hidden = 1; - break; - default: - hidden = 0; - break; - } - - code = (SYS_NSYSENT - 1); - callp += code; - - nargs = callp-sy_narg + hidden; - switch (nargs) { - default: - error = copyin((void *)alpha_pal_rdusp(), copyargs[6], - (nargs - 6) * sizeof(uint64_t)); - if (error) - goto bad; - case 6: - copyargs[5] = framep-tf_regs[FRAME_A5]; - case 5: - copyargs[4] = framep-tf_regs[FRAME_A4]; - case 4: - copyargs[3] = framep-tf_regs[FRAME_A3]; - copyargs[2] = framep-tf_regs[FRAME_A2]; - copyargs[1] = framep-tf_regs[FRAME_A1]; - copyargs[0] = framep-tf_regs[FRAME_A0]; - args = copyargs; - break; - case 3: - case 2: - case 1: - case 0: - args = framep-tf_regs[FRAME_A0]; - break; - } - args += hidden; - - rval[0] = 0; - rval[1] = 0; - - error = sy_call(callp, l, args, rval); - - switch (error) { - case 0: - framep-tf_regs[FRAME_V0] = rval[0]; - framep-tf_regs[FRAME_A4] = rval[1]; - framep-tf_regs[FRAME_A3] = 0; - break; - case ERESTART: - framep-tf_regs[FRAME_PC] -= 4; - break; - case EJUSTRETURN: - break; - default: - bad: - framep-tf_regs[FRAME_V0] = error; - framep-tf_regs[FRAME_A3] = 1; - break; - } - - userret(l); -} void -syscall_fancy(struct lwp *l, uint64_t code, struct trapframe *framep) +syscall(struct lwp *l, uint64_t code, struct trapframe *tf) { const struct sysent *callp; int error; uint64_t rval[2]; uint64_t *args, copyargs[10]; u_int hidden, nargs; - struct proc *p = l-l_proc; + struct proc * const p = l-l_proc; LWP_CACHE_CREDS(l, p); curcpu()-ci_data.cpu_nsyscall++; - l-l_md.md_tf = framep; + l-l_md.md_tf = tf; callp = p-p_emul-e_sysent; @@ -242,7 +151,7 @@ syscall_fancy(struct lwp *l, uint64_t co * syscall() and __syscall() are handled the same on * the alpha, as everything is 64-bit aligned, anyway. */ - code = framep-tf_regs[FRAME_A0]; + code = tf-tf_regs[FRAME_A0]; hidden = 1; break; default: @@ -259,54 +168,60 @@ syscall_fancy(struct lwp *l, uint64_t co error = copyin((void *)alpha_pal_rdusp(), copyargs[6], (nargs - 6) * sizeof(uint64_t)); if (error) { - args = copyargs; goto bad; } case 6: - copyargs[5] = framep-tf_regs[FRAME_A5]; + copyargs[5] = tf-tf_regs[FRAME_A5]; case 5: - copyargs[4] = framep-tf_regs[FRAME_A4]; + copyargs[4] = tf-tf_regs[FRAME_A4]; case 4: - copyargs[3] = framep-tf_regs[FRAME_A3]; - copyargs[2] = framep-tf_regs[FRAME_A2]; - copyargs[1] = framep-tf_regs[FRAME_A1]; - copyargs[0] =
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: njoly Date: Wed Jun 13 17:13:41 UTC 2012 Modified Files: src/sys/arch/alpha/alpha: machdep.c Log Message: Add some descriptions to machdep.unaligned_* sysctls. To generate a diff of this commit: cvs rdiff -u -r1.339 -r1.340 src/sys/arch/alpha/alpha/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/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.339 src/sys/arch/alpha/alpha/machdep.c:1.340 --- src/sys/arch/alpha/alpha/machdep.c:1.339 Mon May 21 14:15:16 2012 +++ src/sys/arch/alpha/alpha/machdep.c Wed Jun 13 17:13:41 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.339 2012/05/21 14:15:16 martin Exp $ */ +/* $NetBSD: machdep.c,v 1.340 2012/06/13 17:13:41 njoly Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.339 2012/05/21 14:15:16 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.340 2012/06/13 17:13:41 njoly Exp $); #include sys/param.h #include sys/systm.h @@ -1550,17 +1550,20 @@ SYSCTL_SETUP(sysctl_machdep_setup, sysc CTL_MACHDEP, CPU_ROOT_DEVICE, CTL_EOL); sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, - CTLTYPE_INT, unaligned_print, NULL, + CTLTYPE_INT, unaligned_print, + SYSCTL_DESCR(Warn about unaligned accesses), NULL, 0, alpha_unaligned_print, 0, CTL_MACHDEP, CPU_UNALIGNED_PRINT, CTL_EOL); sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, - CTLTYPE_INT, unaligned_fix, NULL, + CTLTYPE_INT, unaligned_fix, + SYSCTL_DESCR(Fix up unaligned accesses), NULL, 0, alpha_unaligned_fix, 0, CTL_MACHDEP, CPU_UNALIGNED_FIX, CTL_EOL); sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, - CTLTYPE_INT, unaligned_sigbus, NULL, + CTLTYPE_INT, unaligned_sigbus, + SYSCTL_DESCR(Do SIGBUS for fixed unaligned accesses), NULL, 0, alpha_unaligned_sigbus, 0, CTL_MACHDEP, CPU_UNALIGNED_SIGBUS, CTL_EOL); sysctl_createv(clog, 0, NULL, NULL,
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: para Date: Tue Feb 21 17:39:17 UTC 2012 Modified Files: src/sys/arch/alpha/alpha: machdep.c syscall.c Log Message: follow the sa removal for alpha To generate a diff of this commit: cvs rdiff -u -r1.337 -r1.338 src/sys/arch/alpha/alpha/machdep.c cvs rdiff -u -r1.39 -r1.40 src/sys/arch/alpha/alpha/syscall.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/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.337 src/sys/arch/alpha/alpha/machdep.c:1.338 --- src/sys/arch/alpha/alpha/machdep.c:1.337 Mon Feb 6 02:14:11 2012 +++ src/sys/arch/alpha/alpha/machdep.c Tue Feb 21 17:39:17 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.337 2012/02/06 02:14:11 matt Exp $ */ +/* $NetBSD: machdep.c,v 1.338 2012/02/21 17:39:17 para Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.337 2012/02/06 02:14:11 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.338 2012/02/21 17:39:17 para Exp $); #include sys/param.h #include sys/systm.h @@ -77,8 +77,6 @@ __KERNEL_RCSID(0, $NetBSD: machdep.c,v #include sys/cpu.h #include sys/proc.h #include sys/ras.h -#include sys/sa.h -#include sys/savar.h #include sys/sched.h #include sys/reboot.h #include sys/device.h @@ -1528,25 +1526,6 @@ sendsig_siginfo(const ksiginfo_t *ksi, c #endif } - -void -cpu_upcall(struct lwp *l, int type, int nevents, int ninterrupted, void *sas, void *ap, void *sp, sa_upcall_t upcall) -{ - struct trapframe *tf; - - tf = l-l_md.md_tf; - - tf-tf_regs[FRAME_PC] = (uint64_t)upcall; - tf-tf_regs[FRAME_RA] = 0; - tf-tf_regs[FRAME_A0] = type; - tf-tf_regs[FRAME_A1] = (uint64_t)sas; - tf-tf_regs[FRAME_A2] = nevents; - tf-tf_regs[FRAME_A3] = ninterrupted; - tf-tf_regs[FRAME_A4] = (uint64_t)ap; - tf-tf_regs[FRAME_T12] = (uint64_t)upcall; /* t12 is pv */ - alpha_pal_wrusp((unsigned long)sp); -} - /* * machine dependent system variables. */ Index: src/sys/arch/alpha/alpha/syscall.c diff -u src/sys/arch/alpha/alpha/syscall.c:1.39 src/sys/arch/alpha/alpha/syscall.c:1.40 --- src/sys/arch/alpha/alpha/syscall.c:1.39 Sat Feb 11 23:16:15 2012 +++ src/sys/arch/alpha/alpha/syscall.c Tue Feb 21 17:39:17 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.39 2012/02/11 23:16:15 martin Exp $ */ +/* $NetBSD: syscall.c,v 1.40 2012/02/21 17:39:17 para Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -89,15 +89,11 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.39 2012/02/11 23:16:15 martin Exp $); - -#include opt_sa.h +__KERNEL_RCSID(0, $NetBSD: syscall.c,v 1.40 2012/02/21 17:39:17 para Exp $); #include sys/param.h #include sys/systm.h #include sys/proc.h -#include sys/sa.h -#include sys/savar.h #include sys/signal.h #include sys/syscall.h #include sys/syscallvar.h @@ -151,12 +147,6 @@ syscall_plain(struct lwp *l, uint64_t co callp = p-p_emul-e_sysent; -#ifdef KERN_SA - if (__predict_false((l-l_savp) - (l-l_savp-savp_pflags SAVP_FLAG_DELIVERING))) - l-l_savp-savp_pflags = ~SAVP_FLAG_DELIVERING; -#endif - switch (code) { case SYS_syscall: case SYS___syscall: @@ -245,12 +235,6 @@ syscall_fancy(struct lwp *l, uint64_t co callp = p-p_emul-e_sysent; -#ifdef KERN_SA - if (__predict_false((l-l_savp) - (l-l_savp-savp_pflags SAVP_FLAG_DELIVERING))) - l-l_savp-savp_pflags = ~SAVP_FLAG_DELIVERING; -#endif - switch (code) { case SYS_syscall: case SYS___syscall:
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: matt Date: Sat Jan 21 21:50:24 UTC 2012 Modified Files: src/sys/arch/alpha/alpha: vm_machdep.c Log Message: For cpu_uarea, need uvm.h instead of uvm_extern.h To generate a diff of this commit: cvs rdiff -u -r1.108 -r1.109 src/sys/arch/alpha/alpha/vm_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/alpha/alpha/vm_machdep.c diff -u src/sys/arch/alpha/alpha/vm_machdep.c:1.108 src/sys/arch/alpha/alpha/vm_machdep.c:1.109 --- src/sys/arch/alpha/alpha/vm_machdep.c:1.108 Tue Jun 14 07:53:29 2011 +++ src/sys/arch/alpha/alpha/vm_machdep.c Sat Jan 21 21:50:24 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.108 2011/06/14 07:53:29 matt Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.109 2012/01/21 21:50:24 matt Exp $ */ /* * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. @@ -29,7 +29,7 @@ #include sys/cdefs.h /* RCS ID Copyright macro defns */ -__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.108 2011/06/14 07:53:29 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: vm_machdep.c,v 1.109 2012/01/21 21:50:24 matt Exp $); #include sys/param.h #include sys/systm.h @@ -40,7 +40,7 @@ __KERNEL_RCSID(0, $NetBSD: vm_machdep.c #include sys/core.h #include sys/exec.h -#include uvm/uvm_extern.h +#include uvm/uvm.h #include machine/cpu.h #include machine/alpha.h