CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun Mar 31 19:06:31 UTC 2024 Modified Files: src/sys/arch/alpha/alpha: api_up1000.c autoconf.c dec_1000a.c dec_2000_300.c dec_2100_a50.c dec_2100_a500.c dec_3000_300.c dec_3000_500.c dec_550.c dec_6600.c dec_alphabook1.c dec_axppci_33.c dec_eb164.c dec_eb64plus.c dec_eb66.c dec_kn20aa.c dec_kn300.c dec_kn8ae.c Log Message: Always call platform.device_register(), even if bootdev_data is NULL. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/alpha/api_up1000.c cvs rdiff -u -r1.58 -r1.59 src/sys/arch/alpha/alpha/autoconf.c cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/dec_1000a.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/dec_2000_300.c cvs rdiff -u -r1.69 -r1.70 src/sys/arch/alpha/alpha/dec_2100_a50.c \ src/sys/arch/alpha/alpha/dec_axppci_33.c cvs rdiff -u -r1.25 -r1.26 src/sys/arch/alpha/alpha/dec_2100_a500.c cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/alpha/dec_3000_300.c cvs rdiff -u -r1.47 -r1.48 src/sys/arch/alpha/alpha/dec_3000_500.c cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/dec_550.c cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/dec_6600.c cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/alpha/dec_alphabook1.c cvs rdiff -u -r1.63 -r1.64 src/sys/arch/alpha/alpha/dec_eb164.c cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/alpha/dec_eb64plus.c cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/alpha/dec_eb66.c cvs rdiff -u -r1.67 -r1.68 src/sys/arch/alpha/alpha/dec_kn20aa.c cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/alpha/dec_kn300.c \ 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/api_up1000.c diff -u src/sys/arch/alpha/alpha/api_up1000.c:1.32 src/sys/arch/alpha/alpha/api_up1000.c:1.33 --- src/sys/arch/alpha/alpha/api_up1000.c:1.32 Mon Dec 4 00:32:10 2023 +++ src/sys/arch/alpha/alpha/api_up1000.c Sun Mar 31 19:06:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: api_up1000.c,v 1.32 2023/12/04 00:32:10 thorpej Exp $ */ +/* $NetBSD: api_up1000.c,v 1.33 2024/03/31 19:06:30 thorpej Exp $ */ /* * Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University. @@ -34,7 +34,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: api_up1000.c,v 1.32 2023/12/04 00:32:10 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: api_up1000.c,v 1.33 2024/03/31 19:06:30 thorpej Exp $"); #include #include @@ -178,7 +178,7 @@ api_up1000_device_register(device_t dev, struct bootdev_data *b = bootdev_data; device_t parent = device_parent(dev); - if (found) + if (b == NULL || found) return; if (!initted) { Index: src/sys/arch/alpha/alpha/autoconf.c diff -u src/sys/arch/alpha/alpha/autoconf.c:1.58 src/sys/arch/alpha/alpha/autoconf.c:1.59 --- src/sys/arch/alpha/alpha/autoconf.c:1.58 Fri Jul 9 01:29:20 2021 +++ src/sys/arch/alpha/alpha/autoconf.c Sun Mar 31 19:06:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.58 2021/07/09 01:29:20 thorpej Exp $ */ +/* $NetBSD: autoconf.c,v 1.59 2024/03/31 19:06:30 thorpej Exp $ */ /* * Copyright (c) 1992, 1993 @@ -42,7 +42,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.58 2021/07/09 01:29:20 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.59 2024/03/31 19:06:30 thorpej Exp $"); #include "pci.h" @@ -324,13 +324,6 @@ device_register(device_t dev, void *aux) if (parent != NULL && device_is_a(parent, "pci")) device_pci_register(dev, aux); #endif - - if (bootdev_data == NULL) { - /* - * There is no hope. - */ - return; - } if (platform.device_register) (*platform.device_register)(dev, aux); } Index: src/sys/arch/alpha/alpha/dec_1000a.c diff -u src/sys/arch/alpha/alpha/dec_1000a.c:1.34 src/sys/arch/alpha/alpha/dec_1000a.c:1.35 --- src/sys/arch/alpha/alpha/dec_1000a.c:1.34 Mon Dec 4 00:32:10 2023 +++ src/sys/arch/alpha/alpha/dec_1000a.c Sun Mar 31 19:06:30 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dec_1000a.c,v 1.34 2023/12/04 00:32:10 thorpej Exp $ */ +/* $NetBSD: dec_1000a.c,v 1.35 2024/03/31 19:06:30 thorpej Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,v 1.34 2023/12/04 00:32:10 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dec_1000a.c,v 1.35 2024/03/31 19:06:30 thorpej Exp $"); #include #include @@ -254,7 +254,7 @@ dec_1000a_device_register(device_t dev, struct bootdev_data *b = bootdev_data; device_t parent = device_parent(dev); - if (found) + if (b == NULL || found) return; if (!initted) { Index: src/sys/arch/alpha/alpha/dec_2000_300.c diff -u src/sys/arch/alpha/alpha/dec_2000_300.c:1.21 src/sys/arch/alpha/alpha/dec_2000_300.c:1.22 --- src/sys/arch/alpha/alpha/dec_2000_300.c:1.21 Mon
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun Mar 31 19:06:31 UTC 2024 Modified Files: src/sys/arch/alpha/alpha: api_up1000.c autoconf.c dec_1000a.c dec_2000_300.c dec_2100_a50.c dec_2100_a500.c dec_3000_300.c dec_3000_500.c dec_550.c dec_6600.c dec_alphabook1.c dec_axppci_33.c dec_eb164.c dec_eb64plus.c dec_eb66.c dec_kn20aa.c dec_kn300.c dec_kn8ae.c Log Message: Always call platform.device_register(), even if bootdev_data is NULL. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/alpha/api_up1000.c cvs rdiff -u -r1.58 -r1.59 src/sys/arch/alpha/alpha/autoconf.c cvs rdiff -u -r1.34 -r1.35 src/sys/arch/alpha/alpha/dec_1000a.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/alpha/alpha/dec_2000_300.c cvs rdiff -u -r1.69 -r1.70 src/sys/arch/alpha/alpha/dec_2100_a50.c \ src/sys/arch/alpha/alpha/dec_axppci_33.c cvs rdiff -u -r1.25 -r1.26 src/sys/arch/alpha/alpha/dec_2100_a500.c cvs rdiff -u -r1.48 -r1.49 src/sys/arch/alpha/alpha/dec_3000_300.c cvs rdiff -u -r1.47 -r1.48 src/sys/arch/alpha/alpha/dec_3000_500.c cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/alpha/dec_550.c cvs rdiff -u -r1.36 -r1.37 src/sys/arch/alpha/alpha/dec_6600.c cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/alpha/dec_alphabook1.c cvs rdiff -u -r1.63 -r1.64 src/sys/arch/alpha/alpha/dec_eb164.c cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/alpha/dec_eb64plus.c cvs rdiff -u -r1.30 -r1.31 src/sys/arch/alpha/alpha/dec_eb66.c cvs rdiff -u -r1.67 -r1.68 src/sys/arch/alpha/alpha/dec_kn20aa.c cvs rdiff -u -r1.43 -r1.44 src/sys/arch/alpha/alpha/dec_kn300.c \ 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed Mar 6 07:22:45 UTC 2024 Modified Files: src/sys/arch/alpha/alpha: cpu.c Log Message: Statically initialize the PRIMARY and RUNNING flags in cpu_info_primary. To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed Mar 6 07:22:45 UTC 2024 Modified Files: src/sys/arch/alpha/alpha: cpu.c Log Message: Statically initialize the PRIMARY and RUNNING flags in cpu_info_primary. To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.108 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.107 src/sys/arch/alpha/alpha/cpu.c:1.108 --- src/sys/arch/alpha/alpha/cpu.c:1.107 Sun May 22 11:27:33 2022 +++ src/sys/arch/alpha/alpha/cpu.c Wed Mar 6 07:22:45 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.107 2022/05/22 11:27:33 andvar Exp $ */ +/* $NetBSD: cpu.c,v 1.108 2024/03/06 07:22:45 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.107 2022/05/22 11:27:33 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.108 2024/03/06 07:22:45 thorpej Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -82,7 +82,8 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.10 #include struct cpu_info cpu_info_primary __cacheline_aligned = { - .ci_curlwp = + .ci_curlwp = , + .ci_flags = CPUF_PRIMARY|CPUF_RUNNING, }; struct cpu_info *cpu_info_list __read_mostly = _info_primary; @@ -450,7 +451,8 @@ cpuattach(device_t parent, device_t self if (primary) { cpu_announce_extensions(ci); #if defined(MULTIPROCESSOR) - ci->ci_flags |= CPUF_PRIMARY|CPUF_RUNNING; + KASSERT(ci->ci_flags & CPUF_PRIMARY); + KASSERT(ci->ci_flags & CPUF_RUNNING); atomic_or_ulong(_booted, (1UL << ma->ma_slot)); atomic_or_ulong(_running, (1UL << ma->ma_slot)); #endif /* MULTIPROCESSOR */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun Mar 3 19:56:30 UTC 2024 Modified Files: src/sys/arch/alpha/alpha: prom.c Log Message: prom_uses_prom_console() needs to consider ST_DEC_7000, as well. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sun Mar 3 19:56:30 UTC 2024 Modified Files: src/sys/arch/alpha/alpha: prom.c Log Message: prom_uses_prom_console() needs to consider ST_DEC_7000, as well. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 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.58 src/sys/arch/alpha/alpha/prom.c:1.59 --- src/sys/arch/alpha/alpha/prom.c:1.58 Sat Oct 3 17:31:46 2020 +++ src/sys/arch/alpha/alpha/prom.c Sun Mar 3 19:56:29 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: prom.c,v 1.58 2020/10/03 17:31:46 thorpej Exp $ */ +/* $NetBSD: prom.c,v 1.59 2024/03/03 19:56:29 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.58 2020/10/03 17:31:46 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.59 2024/03/03 19:56:29 thorpej Exp $"); #include "opt_multiprocessor.h" @@ -89,7 +89,7 @@ bool prom_uses_prom_console(void) { #ifdef _PROM_MAY_USE_PROM_CONSOLE - return (cputype == ST_DEC_21000); + return (cputype == ST_DEC_7000 || cputype == ST_DEC_21000); #else return false; #endif
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat Dec 30 23:07:42 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: pmap_bootstrap(): When initializing the L2 PTEs, don't use l2pte_index(), as it is designed to wrap from 1023->0 during the normal course of use. However, when setting up the initial kernel page tables, if we have a large enough config that we end up with more than L2 PT page, we rely on being able to index > 1023 into the adjacent PT pages to initialize those entries. Fixes a MM fault panic during early boot on larger memory configs (reported by Dave McGuire with an 8GB ES40 and John Klos with a 12GB DS25). I've successfully booted at 16GB config in Qemu with this fix. To generate a diff of this commit: cvs rdiff -u -r1.307 -r1.308 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.307 src/sys/arch/alpha/alpha/pmap.c:1.308 --- src/sys/arch/alpha/alpha/pmap.c:1.307 Sat Apr 9 23:38:31 2022 +++ src/sys/arch/alpha/alpha/pmap.c Sat Dec 30 23:07:42 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.307 2022/04/09 23:38:31 riastradh Exp $ */ +/* $NetBSD: pmap.c,v 1.308 2023/12/30 23:07:42 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.307 2022/04/09 23:38:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.308 2023/12/30 23:07:42 thorpej Exp $"); #include #include @@ -1204,13 +1204,15 @@ static bool vtophys_internal(vaddr_t, pa l1pte_ = pmap_l1pte(kernel_lev1map, va); \ if (pmap_pte_v(l1pte_) == 0) { \ printf("kernel level 1 PTE not valid, va 0x%lx " \ - "(line %d)\n", (va), __LINE__); \ + "(line %d) pte=%p *pte=0x%016lx\n", (va), __LINE__, \ + l1pte_, *l1pte_); \ panic("PMAP_KERNEL_PTE");\ }\ l2pte_ = pmap_l2pte(kernel_lev1map, va, l1pte_); \ if (pmap_pte_v(l2pte_) == 0) { \ printf("kernel level 2 PTE not valid, va 0x%lx " \ - "(line %d)\n", (va), __LINE__); \ + "(line %d) pte=%p *pte=0x%016lx\n", (va), __LINE__, \ + l2pte_, *l2pte_); \ panic("PMAP_KERNEL_PTE");\ }\ pmap_l3pte(kernel_lev1map, va, l2pte_);\ @@ -1358,8 +1360,19 @@ pmap_bootstrap(paddr_t ptaddr, u_int max pte = (ALPHA_K0SEG_TO_PHYS(((vaddr_t)lev3map) + (i*PAGE_SIZE)) >> PGSHIFT) << PG_SHIFT; pte |= PG_V | PG_ASM | PG_KRE | PG_KWE | PG_WIRED; - lev2map[l2pte_index(VM_MIN_KERNEL_ADDRESS+ - (i*PAGE_SIZE*NPTEPG))] = pte; + /* + * No need to use l2pte_index() here; it's equivalent + * to just indexing with our loop variable i, but will + * fall over if we end up with more than 1 L2 PT page. + * + * In other words: + * + * l2pte_index(VM_MIN_KERNEL_ADDRESS + + * (i*PAGE_SIZE*NPTEPG)) + * + * ...is the same as 'i' so long as i stays below 1024. + */ + lev2map[i] = pte; } /* Initialize the pmap_growkernel_lock. */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Sat Dec 30 23:07:42 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: pmap_bootstrap(): When initializing the L2 PTEs, don't use l2pte_index(), as it is designed to wrap from 1023->0 during the normal course of use. However, when setting up the initial kernel page tables, if we have a large enough config that we end up with more than L2 PT page, we rely on being able to index > 1023 into the adjacent PT pages to initialize those entries. Fixes a MM fault panic during early boot on larger memory configs (reported by Dave McGuire with an 8GB ES40 and John Klos with a 12GB DS25). I've successfully booted at 16GB config in Qemu with this fix. To generate a diff of this commit: cvs rdiff -u -r1.307 -r1.308 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Nov 21 22:25:16 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: db_disasm.c Log Message: pal_opname(): Make the static buffer for unknown PALcode ops large enough to hold all possible values. alpha_print_instruction(): Make this private if not-_KERNEL. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/alpha/db_disasm.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.19 src/sys/arch/alpha/alpha/db_disasm.c:1.20 --- src/sys/arch/alpha/alpha/db_disasm.c:1.19 Tue Nov 21 22:19:12 2023 +++ src/sys/arch/alpha/alpha/db_disasm.c Tue Nov 21 22:25:16 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: db_disasm.c,v 1.19 2023/11/21 22:19:12 thorpej Exp $ */ +/* $NetBSD: db_disasm.c,v 1.20 2023/11/21 22:25:16 thorpej Exp $ */ /* * Mach Operating System @@ -48,7 +48,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.19 2023/11/21 22:19:12 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.20 2023/11/21 22:25:16 thorpej Exp $"); #include #include @@ -191,7 +191,7 @@ static const struct tbl pal_op_tbl[] = { static const char * pal_opname(int op) { - static char unk[8]; + static char unk[11]; int i; for (i = 0; pal_op_tbl[i].name != NULL; i++) { @@ -199,7 +199,7 @@ pal_opname(int op) return (pal_op_tbl[i].name); } - snprintf(unk, sizeof(unk), "0x%x", op); + snprintf(unk, sizeof(unk), "0x%08x", op); return (unk); } @@ -813,6 +813,9 @@ insn_printf(struct alpha_print_instructi * next instruction. */ +#ifndef _KERNEL +static +#endif int alpha_print_instruction(struct alpha_print_instruction_context *ctx) {
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Nov 21 22:25:16 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: db_disasm.c Log Message: pal_opname(): Make the static buffer for unknown PALcode ops large enough to hold all possible values. alpha_print_instruction(): Make this private if not-_KERNEL. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/alpha/alpha/db_disasm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Nov 21 21:53:06 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: db_interface.c Log Message: Ensure that all fields of db_regs[] are initialized. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 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.39 src/sys/arch/alpha/alpha/db_interface.c:1.40 --- src/sys/arch/alpha/alpha/db_interface.c:1.39 Tue Nov 21 21:23:56 2023 +++ src/sys/arch/alpha/alpha/db_interface.c Tue Nov 21 21:53:06 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.39 2023/11/21 21:23:56 thorpej Exp $ */ +/* $NetBSD: db_interface.c,v 1.40 2023/11/21 21:53:06 thorpej Exp $ */ /* * Mach Operating System @@ -54,7 +54,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.39 2023/11/21 21:23:56 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.40 2023/11/21 21:53:06 thorpej Exp $"); #include #include @@ -105,45 +105,53 @@ static int db_alpha_regop(const struct d #define dbreg(xx) ((long *)(xx)) +#define DBREG(n, r) \ + { .name = __STRING(n),\ + .valuep = ((long *)(r)), \ + .fcn = db_alpha_regop,\ + .modif = NULL, } + const struct db_variable db_regs[] = { - { "v0", dbreg(FRAME_V0), db_alpha_regop }, - { "t0", dbreg(FRAME_T0), db_alpha_regop }, - { "t1", dbreg(FRAME_T1), db_alpha_regop }, - { "t2", dbreg(FRAME_T2), db_alpha_regop }, - { "t3", dbreg(FRAME_T3), db_alpha_regop }, - { "t4", dbreg(FRAME_T4), db_alpha_regop }, - { "t5", dbreg(FRAME_T5), db_alpha_regop }, - { "t6", dbreg(FRAME_T6), db_alpha_regop }, - { "t7", dbreg(FRAME_T7), db_alpha_regop }, - { "s0", dbreg(FRAME_S0), db_alpha_regop }, - { "s1", dbreg(FRAME_S1), db_alpha_regop }, - { "s2", dbreg(FRAME_S2), db_alpha_regop }, - { "s3", dbreg(FRAME_S3), db_alpha_regop }, - { "s4", dbreg(FRAME_S4), db_alpha_regop }, - { "s5", dbreg(FRAME_S5), db_alpha_regop }, - { "s6", dbreg(FRAME_S6), db_alpha_regop }, - { "a0", dbreg(FRAME_A0), db_alpha_regop }, - { "a1", dbreg(FRAME_A1), db_alpha_regop }, - { "a2", dbreg(FRAME_A2), db_alpha_regop }, - { "a3", dbreg(FRAME_A3), db_alpha_regop }, - { "a4", dbreg(FRAME_A4), db_alpha_regop }, - { "a5", dbreg(FRAME_A5), db_alpha_regop }, - { "t8", dbreg(FRAME_T8), db_alpha_regop }, - { "t9", dbreg(FRAME_T9), db_alpha_regop }, - { "t10", dbreg(FRAME_T10), db_alpha_regop }, - { "t11", dbreg(FRAME_T11), db_alpha_regop }, - { "ra", dbreg(FRAME_RA), db_alpha_regop }, - { "t12", dbreg(FRAME_T12), db_alpha_regop }, - { "at", dbreg(FRAME_AT), db_alpha_regop }, - { "gp", dbreg(FRAME_GP), db_alpha_regop }, - { "sp", dbreg(FRAME_SP), db_alpha_regop }, - { "pc", dbreg(FRAME_PC), db_alpha_regop }, - { "ps", dbreg(FRAME_PS), db_alpha_regop }, - { "ai", dbreg(FRAME_T11), db_alpha_regop }, - { "pv", dbreg(FRAME_T12), db_alpha_regop }, + DBREG(v0, FRAME_V0), + DBREG(t0, FRAME_T0), + DBREG(t1, FRAME_T1), + DBREG(t2, FRAME_T2), + DBREG(t3, FRAME_T3), + DBREG(t4, FRAME_T4), + DBREG(t5, FRAME_T5), + DBREG(t6, FRAME_T6), + DBREG(t7, FRAME_T7), + DBREG(s0, FRAME_S0), + DBREG(s1, FRAME_S1), + DBREG(s2, FRAME_S2), + DBREG(s3, FRAME_S3), + DBREG(s4, FRAME_S4), + DBREG(s5, FRAME_S5), + DBREG(s6, FRAME_S6), + DBREG(a0, FRAME_A0), + DBREG(a1, FRAME_A1), + DBREG(a2, FRAME_A2), + DBREG(a3, FRAME_A3), + DBREG(a4, FRAME_A4), + DBREG(a5, FRAME_A5), + DBREG(t8, FRAME_T8), + DBREG(t9, FRAME_T9), + DBREG(t10, FRAME_T10), + DBREG(t11, FRAME_T11), + DBREG(ra, FRAME_RA), + DBREG(t12, FRAME_T12), + DBREG(at, FRAME_AT), + DBREG(gp, FRAME_GP), + DBREG(sp, FRAME_SP), + DBREG(pc, FRAME_PC), + DBREG(ps, FRAME_PS), + DBREG(ai, FRAME_T11), + DBREG(pv, FRAME_T12), }; const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); +#undef DBREG + static int db_alpha_regop(const struct db_variable *vp, db_expr_t *val, int opcode) {
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Nov 21 21:53:06 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: db_interface.c Log Message: Ensure that all fields of db_regs[] are initialized. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Nov 21 20:40:24 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: db_trace.c Log Message: Reduce db_trace.c's exposure to proc/lwp. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Nov 21 20:40:24 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: db_trace.c Log Message: Reduce db_trace.c's exposure to proc/lwp. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 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.36 src/sys/arch/alpha/alpha/db_trace.c:1.37 --- src/sys/arch/alpha/alpha/db_trace.c:1.36 Tue Nov 21 20:29:47 2023 +++ src/sys/arch/alpha/alpha/db_trace.c Tue Nov 21 20:40:24 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.36 2023/11/21 20:29:47 thorpej Exp $ */ +/* $NetBSD: db_trace.c,v 1.37 2023/11/21 20:40:24 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.36 2023/11/21 20:29:47 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.37 2023/11/21 20:40:24 thorpej Exp $"); #include #include @@ -133,9 +133,8 @@ do { \ } static void -decode_syscall(int number, struct proc *p, void (*pr)(const char *, ...)) +decode_syscall(int number, void (*pr)(const char *, ...)) { - (*pr)(" (%d)", number); } @@ -175,8 +174,6 @@ db_stack_trace_print_ra(db_expr_t ra, bo struct trapframe *tf; bool ra_from_tf; u_long last_ipl = ~0L; - struct proc *p = NULL; - struct lwp *l = NULL; char c; bool trace_thread = false; bool lwpaddr = false; @@ -188,13 +185,15 @@ db_stack_trace_print_ra(db_expr_t ra, bo } if (!have_addr) { - p = curproc; addr = DDB_REGS->tf_regs[FRAME_SP] - FRAME_SIZE * 8; tf = (struct trapframe *)addr; callpc = db_alpha_tf_reg(tf, FRAME_PC); frame = (db_addr_t)tf + FRAME_SIZE * 8; ra_from_tf = true; } else { + struct proc *p = NULL; + struct lwp *l = NULL; + if (trace_thread) { if (lwpaddr) { l = (struct lwp *)addr; @@ -293,7 +292,7 @@ db_stack_trace_print_ra(db_expr_t ra, bo tfps = db_alpha_tf_reg(tf, FRAME_PS); if (db_alpha_sym_is_syscall(symval)) { decode_syscall(db_alpha_tf_reg(tf, FRAME_V0), -p, pr); +pr); } if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) { last_ipl = tfps & ALPHA_PSL_IPL_MASK;
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Nov 21 20:29:47 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: db_trace.c Log Message: decode_prologue(): Make pc a db_addr_t, not a db_expr_t. db_stack_trace_print_ra(): Missed one direct reference to XentSys; fix. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 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.35 src/sys/arch/alpha/alpha/db_trace.c:1.36 --- src/sys/arch/alpha/alpha/db_trace.c:1.35 Tue Nov 21 19:59:07 2023 +++ src/sys/arch/alpha/alpha/db_trace.c Tue Nov 21 20:29:47 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.35 2023/11/21 19:59:07 thorpej Exp $ */ +/* $NetBSD: db_trace.c,v 1.36 2023/11/21 20:29:47 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.35 2023/11/21 19:59:07 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.36 2023/11/21 20:29:47 thorpej Exp $"); #include #include @@ -71,7 +71,7 @@ decode_prologue(db_addr_t callpc, db_add { long signed_immediate; alpha_instruction ins; - db_expr_t pc; + db_addr_t pc; pi->pi_regmask = 0; pi->pi_frame_size = 0; @@ -297,8 +297,9 @@ db_stack_trace_print_ra(db_expr_t ra, bo } if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) { last_ipl = tfps & ALPHA_PSL_IPL_MASK; -if (symval != (vaddr_t)) +if (! db_alpha_sym_is_syscall(symval)) { (*pr)(" (from ipl %ld)", last_ipl); +} } (*pr)(" ---\n"); if (tfps & ALPHA_PSL_USERMODE) {
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Nov 21 20:29:47 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: db_trace.c Log Message: decode_prologue(): Make pc a db_addr_t, not a db_expr_t. db_stack_trace_print_ra(): Missed one direct reference to XentSys; fix. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Nov 21 18:57:29 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: db_trace.c Log Message: Don't access insns or frame values directly; use db_read_bytes(). To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Tue Nov 21 18:57:29 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: db_trace.c Log Message: Don't access insns or frame values directly; use db_read_bytes(). To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 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.33 src/sys/arch/alpha/alpha/db_trace.c:1.34 --- src/sys/arch/alpha/alpha/db_trace.c:1.33 Tue Nov 21 14:35:01 2023 +++ src/sys/arch/alpha/alpha/db_trace.c Tue Nov 21 18:57:29 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.33 2023/11/21 14:35:01 riastradh Exp $ */ +/* $NetBSD: db_trace.c,v 1.34 2023/11/21 18:57: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.33 2023/11/21 14:35:01 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.34 2023/11/21 18:57:29 thorpej Exp $"); #include #include @@ -117,7 +117,7 @@ do { \ } while (0) for (pc = func; pc < callpc; pc += sizeof(alpha_instruction)) { - ins.bits = *(unsigned int *)pc; + db_read_bytes(pc, sizeof(ins.bits), (char *)); if (ins.mem_format.opcode == op_lda && ins.mem_format.ra == 30 && @@ -199,6 +199,16 @@ db_alpha_trap_is_syscall(vaddr_t v) return v == (vaddr_t) } +static unsigned long +db_alpha_tf_reg(struct trapframe *tf, unsigned int regno) +{ + unsigned long reg; + + db_read_bytes((db_addr_t)>tf_regs[regno], sizeof(reg), + (char *)); + return reg; +} + static void decode_syscall(int number, struct proc *p, void (*pr)(const char *, ...)) { @@ -248,7 +258,7 @@ db_stack_trace_print_ra(db_expr_t ra, bo p = curproc; addr = DDB_REGS->tf_regs[FRAME_SP] - FRAME_SIZE * 8; tf = (struct trapframe *)addr; - callpc = tf->tf_regs[FRAME_PC]; + callpc = db_alpha_tf_reg(tf, FRAME_PC); frame = (db_addr_t)tf + FRAME_SIZE * 8; ra_from_tf = true; } else { @@ -347,9 +357,11 @@ db_stack_trace_print_ra(db_expr_t ra, bo (*pr)("--- %s", db_alpha_trap_description(symval)); - tfps = tf->tf_regs[FRAME_PS]; - if (db_alpha_trap_is_syscall(symval)) -decode_syscall(tf->tf_regs[FRAME_V0], p, pr); + tfps = db_alpha_tf_reg(tf, FRAME_PS); + if (db_alpha_trap_is_syscall(symval)) { +decode_syscall(db_alpha_tf_reg(tf, FRAME_V0), +p, pr); + } if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) { last_ipl = tfps & ALPHA_PSL_IPL_MASK; if (symval != (vaddr_t)) @@ -360,7 +372,7 @@ db_stack_trace_print_ra(db_expr_t ra, bo (*pr)("--- user mode ---\n"); break; /* Terminate search. */ } - callpc = tf->tf_regs[FRAME_PC]; + callpc = db_alpha_tf_reg(tf, FRAME_PC); frame = (db_addr_t)tf + FRAME_SIZE * 8; ra_from_tf = true; continue; @@ -380,14 +392,19 @@ db_stack_trace_print_ra(db_expr_t ra, bo * in a leaf call). If not, we've found the * root of the call graph. */ - if (ra_from_tf) -callpc = tf->tf_regs[FRAME_RA]; - else { + if (ra_from_tf) { +callpc = db_alpha_tf_reg(tf, FRAME_RA); + } else { (*pr)("--- root of call graph ---\n"); break; } - } else - callpc = *(u_long *)(frame + pi.pi_reg_offset[26]); + } else { + unsigned long reg; + + db_read_bytes(frame + pi.pi_reg_offset[26], + sizeof(reg), (char *)); + callpc = reg; + } frame += pi.pi_frame_size; ra_from_tf = false; }
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: rin Date: Thu Aug 3 03:07:36 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: machdep.c Log Message: alpha: Add support for bootflags [xX] to enable debug messages. To generate a diff of this commit: cvs rdiff -u -r1.375 -r1.376 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.375 src/sys/arch/alpha/alpha/machdep.c:1.376 --- src/sys/arch/alpha/alpha/machdep.c:1.375 Thu Jul 22 01:39:18 2021 +++ src/sys/arch/alpha/alpha/machdep.c Thu Aug 3 03:07:35 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.375 2021/07/22 01:39:18 thorpej Exp $ */ +/* $NetBSD: machdep.c,v 1.376 2023/08/03 03:07:35 rin Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2019, 2020 The NetBSD Foundation, Inc. @@ -69,7 +69,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.375 2021/07/22 01:39:18 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.376 2023/08/03 03:07:35 rin Exp $"); #include #include @@ -797,6 +797,11 @@ nobootinfo: boothowto |= AB_VERBOSE; break; + case 'x': /* debug messages */ + case 'X': + boothowto |= AB_DEBUG; + break; + case '-': /* * Just ignore this. It's not required, but it's
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: rin Date: Thu Aug 3 03:07:36 UTC 2023 Modified Files: src/sys/arch/alpha/alpha: machdep.c Log Message: alpha: Add support for bootflags [xX] to enable debug messages. To generate a diff of this commit: cvs rdiff -u -r1.375 -r1.376 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Thu Jul 21 01:52:28 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: db_trace.c Log Message: Rename functions in previous in preparation for future changes. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 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.31 src/sys/arch/alpha/alpha/db_trace.c:1.32 --- src/sys/arch/alpha/alpha/db_trace.c:1.31 Wed Jul 20 17:03:10 2022 +++ src/sys/arch/alpha/alpha/db_trace.c Thu Jul 21 01:52:28 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.31 2022/07/20 17:03:10 thorpej Exp $ */ +/* $NetBSD: db_trace.c,v 1.32 2022/07/21 01:52:28 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.31 2022/07/20 17:03:10 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.32 2022/07/21 01:52:28 thorpej Exp $"); #include #include @@ -166,7 +166,7 @@ do { \ } static bool -sym_is_trapsymbol(vaddr_t v) +db_alpha_sym_is_trapsymbol(vaddr_t v) { int i; @@ -177,13 +177,13 @@ sym_is_trapsymbol(vaddr_t v) } static bool -sym_is_backstop(vaddr_t v) +db_alpha_sym_is_backstop(vaddr_t v) { return v == (vaddr_t)_kthread_backstop; } static const char * -trap_description(vaddr_t v) +db_alpha_trap_description(vaddr_t v) { int i; @@ -194,7 +194,7 @@ trap_description(vaddr_t v) } static bool -trap_is_syscall(vaddr_t v) +db_alpha_trap_is_syscall(vaddr_t v) { return v == (vaddr_t) } @@ -288,7 +288,7 @@ db_stack_trace_print(db_expr_t addr, boo * backstop, then we are at the root of the call * graph. */ - if (sym_is_backstop(symval)) { + if (db_alpha_sym_is_backstop(symval)) { (*pr)("--- kernel thread backstop ---\n"); break; } @@ -328,13 +328,13 @@ db_stack_trace_print(db_expr_t addr, boo * If we are in a trap vector, frame points to a * trapframe. */ - if (sym_is_trapsymbol(symval)) { + if (db_alpha_sym_is_trapsymbol(symval)) { tf = (struct trapframe *)frame; - (*pr)("--- %s", trap_description(symval)); + (*pr)("--- %s", db_alpha_trap_description(symval)); tfps = tf->tf_regs[FRAME_PS]; - if (trap_is_syscall(symval)) + if (db_alpha_trap_is_syscall(symval)) decode_syscall(tf->tf_regs[FRAME_V0], p, pr); if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) { last_ipl = tfps & ALPHA_PSL_IPL_MASK;
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Thu Jul 21 01:52:28 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: db_trace.c Log Message: Rename functions in previous in preparation for future changes. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed Jul 20 18:25:10 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: locore.s Log Message: Fix a couple of nits with savectx(): - Note that this function is only used by dumpsys(). - Don't safe the PS word; there isn't actually a spot for it in the PCB. - Don't bother returning anything; savectx() is declared void. To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 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.141 src/sys/arch/alpha/alpha/locore.s:1.142 --- src/sys/arch/alpha/alpha/locore.s:1.141 Thu Jul 22 15:48:40 2021 +++ src/sys/arch/alpha/alpha/locore.s Wed Jul 20 18:25:10 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.141 2021/07/22 15:48:40 thorpej Exp $ */ +/* $NetBSD: locore.s,v 1.142 2022/07/20 18:25:10 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.141 2021/07/22 15:48:40 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.142 2022/07/20 18:25:10 thorpej Exp $"); #include "assym.h" @@ -651,13 +651,10 @@ LEAF(restorefpstate, 1) * sanely be used for curlwp iff cpu_switchto won't be called again, e.g. * if called from boot().) * + * N.B. this is actually only used by dumpsys(). + * * Arguments: * a0 'struct pcb *' of the process that needs its context saved - * - * Return: - * v0 0. (note that for child processes, it seems - * like savectx() returns 1, because the return address - * in the PCB is set to the return address from savectx().) */ LEAF(savectx, 1) @@ -672,10 +669,6 @@ LEAF(savectx, 1) stq s5, PCB_CONTEXT+(5 * 8)(a0) stq s6, PCB_CONTEXT+(6 * 8)(a0) stq ra, PCB_CONTEXT+(7 * 8)(a0) /* store ra */ - call_pal PAL_OSF1_rdps /* NOTE: doesn't kill a0 */ - stq v0, PCB_CONTEXT+(8 * 8)(a0) /* store ps, for ipl */ - - mov zero, v0 RET END(savectx)
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed Jul 20 18:25:10 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: locore.s Log Message: Fix a couple of nits with savectx(): - Note that this function is only used by dumpsys(). - Don't safe the PS word; there isn't actually a spot for it in the PCB. - Don't bother returning anything; savectx() is declared void. To generate a diff of this commit: cvs rdiff -u -r1.141 -r1.142 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed Jul 20 17:03:11 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: db_trace.c Log Message: Localize direct refernces to kernel symbols into functions. NFC. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 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.30 src/sys/arch/alpha/alpha/db_trace.c:1.31 --- src/sys/arch/alpha/alpha/db_trace.c:1.30 Sat Jul 24 21:31:32 2021 +++ src/sys/arch/alpha/alpha/db_trace.c Wed Jul 20 17:03:10 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.30 2021/07/24 21:31:32 andvar Exp $ */ +/* $NetBSD: db_trace.c,v 1.31 2022/07/20 17:03:10 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.30 2021/07/24 21:31:32 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.31 2022/07/20 17:03:10 thorpej Exp $"); #include #include @@ -165,15 +165,38 @@ do { \ } } -static int +static bool sym_is_trapsymbol(vaddr_t v) { int i; for (i = 0; special_symbols[i].ss_val != 0; ++i) if (v == special_symbols[i].ss_val) - return 1; - return 0; + return true; + return false; +} + +static bool +sym_is_backstop(vaddr_t v) +{ + return v == (vaddr_t)_kthread_backstop; +} + +static const char * +trap_description(vaddr_t v) +{ + int i; + + for (i = 0; special_symbols[i].ss_val != 0; ++i) + if (v == special_symbols[i].ss_val) + return special_symbols[i].ss_note; + return "(? trap ?)"; +} + +static bool +trap_is_syscall(vaddr_t v) +{ + return v == (vaddr_t) } static void @@ -191,7 +214,6 @@ db_stack_trace_print(db_expr_t addr, boo struct prologue_info pi; db_expr_t diff; db_sym_t sym; - int i; u_long tfps; const char *symname; struct pcb *pcbp; @@ -266,7 +288,7 @@ db_stack_trace_print(db_expr_t addr, boo * backstop, then we are at the root of the call * graph. */ - if (symval == (vaddr_t)_kthread_backstop) { + if (sym_is_backstop(symval)) { (*pr)("--- kernel thread backstop ---\n"); break; } @@ -309,13 +331,10 @@ db_stack_trace_print(db_expr_t addr, boo if (sym_is_trapsymbol(symval)) { tf = (struct trapframe *)frame; - for (i = 0; special_symbols[i].ss_val != 0; ++i) -if (symval == special_symbols[i].ss_val) - (*pr)("--- %s", - special_symbols[i].ss_note); + (*pr)("--- %s", trap_description(symval)); tfps = tf->tf_regs[FRAME_PS]; - if (symval == (vaddr_t)) + if (trap_is_syscall(symval)) decode_syscall(tf->tf_regs[FRAME_V0], p, pr); if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) { last_ipl = tfps & ALPHA_PSL_IPL_MASK;
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: thorpej Date: Wed Jul 20 17:03:11 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: db_trace.c Log Message: Localize direct refernces to kernel symbols into functions. NFC. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:42:56 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: ipifuncs.c Log Message: alpha: Convert ipifuncs.c to membar_release/acquire. No semantic change is possible because all of these membars are just mb on alpha -- change just makes the intent clearer. (Only membar_producer is weaker, wmb.) To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 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.54 src/sys/arch/alpha/alpha/ipifuncs.c:1.55 --- src/sys/arch/alpha/alpha/ipifuncs.c:1.54 Sat Oct 10 03:05:04 2020 +++ src/sys/arch/alpha/alpha/ipifuncs.c Sat Apr 9 23:42:56 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ipifuncs.c,v 1.54 2020/10/10 03:05:04 thorpej Exp $ */ +/* $NetBSD: ipifuncs.c,v 1.55 2022/04/09 23:42:56 riastradh 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.54 2020/10/10 03:05:04 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.55 2022/04/09 23:42:56 riastradh Exp $"); /* * Interprocessor interrupt handlers. @@ -127,10 +127,12 @@ alpha_ipi_process(struct cpu_info *ci, s while ((pending_ipis = atomic_swap_ulong(>ci_ipis, 0)) != 0) { /* - * Ensure the atomic swap is globally visible before - * we do any of the work. + * Ensure everything prior to setting ci_ipis in + * alpha_send_ipi happens-before everything after + * reading ci_ipis here so we're not working on stale + * inputs. */ - membar_enter(); + membar_acquire(); sc->sc_evcnt_ipi.ev_count++; @@ -159,7 +161,7 @@ alpha_send_ipi(u_long const cpu_id, u_lo * alpha_send_ipi() have completed before informing * the CPU of the work we are asking it to do. */ - membar_exit(); + membar_release(); atomic_or_ulong(_info[cpu_id]->ci_ipis, ipimask); /*
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:42:56 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: ipifuncs.c Log Message: alpha: Convert ipifuncs.c to membar_release/acquire. No semantic change is possible because all of these membars are just mb on alpha -- change just makes the intent clearer. (Only membar_producer is weaker, wmb.) To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:39:18 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: cpu.c Log Message: alpha: Convert cpu_iccb_send from membar_exit to membar_release. XXX Maybe this should really use alpha_mb, since it's not writing to normal MI-type memory so technically the membr_* semantics doesn't apply? To generate a diff of this commit: cvs rdiff -u -r1.105 -r1.106 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.105 src/sys/arch/alpha/alpha/cpu.c:1.106 --- src/sys/arch/alpha/alpha/cpu.c:1.105 Sun Feb 27 14:17:10 2022 +++ src/sys/arch/alpha/alpha/cpu.c Sat Apr 9 23:39:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.105 2022/02/27 14:17:10 riastradh Exp $ */ +/* $NetBSD: cpu.c,v 1.106 2022/04/09 23:39:18 riastradh 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.105 2022/02/27 14:17:10 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.106 2022/04/09 23:39:18 riastradh Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -887,7 +887,7 @@ cpu_iccb_send(long cpu_id, const char *m */ strcpy(pcsp->pcs_iccb.iccb_rxbuf, msg); pcsp->pcs_iccb.iccb_rxlen = strlen(msg); - membar_exit(); + membar_release(); atomic_or_ulong(>rpb_rxrdy, cpumask); /* Wait for the message to be received. */
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:39:18 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: cpu.c Log Message: alpha: Convert cpu_iccb_send from membar_exit to membar_release. XXX Maybe this should really use alpha_mb, since it's not writing to normal MI-type memory so technically the membr_* semantics doesn't apply? To generate a diff of this commit: cvs rdiff -u -r1.105 -r1.106 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:36:22 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: alpha: Omit needless membar in pmap_reference. If the pmap is published enough for us to obtain a reference to it then there's no membar needed. If it's not then something else is wrong and we can't use pmap_reference here anyway. Membars are needed only on the destruction side to make sure all use, by any thread, happens-before all freeing in the last user thread. To generate a diff of this commit: cvs rdiff -u -r1.305 -r1.306 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.305 src/sys/arch/alpha/alpha/pmap.c:1.306 --- src/sys/arch/alpha/alpha/pmap.c:1.305 Sat Mar 12 15:32:31 2022 +++ src/sys/arch/alpha/alpha/pmap.c Sat Apr 9 23:36:22 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.305 2022/03/12 15:32:31 riastradh Exp $ */ +/* $NetBSD: pmap.c,v 1.306 2022/04/09 23:36:22 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.305 2022/03/12 15:32:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.306 2022/04/09 23:36:22 riastradh Exp $"); #include #include @@ -1706,7 +1706,6 @@ pmap_reference(pmap_t pmap) newcount = atomic_inc_uint_nv(>pm_count); KASSERT(newcount != 0); - PMAP_MP(membar_enter()); } /*
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:36:22 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: alpha: Omit needless membar in pmap_reference. If the pmap is published enough for us to obtain a reference to it then there's no membar needed. If it's not then something else is wrong and we can't use pmap_reference here anyway. Membars are needed only on the destruction side to make sure all use, by any thread, happens-before all freeing in the last user thread. To generate a diff of this commit: cvs rdiff -u -r1.305 -r1.306 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: skrll Date: Tue Apr 5 04:33:36 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: clock.c Log Message: KNF To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 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.46 src/sys/arch/alpha/alpha/clock.c:1.47 --- src/sys/arch/alpha/alpha/clock.c:1.46 Sat Oct 10 03:05:04 2020 +++ src/sys/arch/alpha/alpha/clock.c Tue Apr 5 04:33:36 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.46 2020/10/10 03:05:04 thorpej Exp $ */ +/* $NetBSD: clock.c,v 1.47 2022/04/05 04:33:36 skrll Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.46 2020/10/10 03:05:04 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.47 2022/04/05 04:33:36 skrll Exp $"); #include #include @@ -110,7 +110,7 @@ cpu_initclocks(void) * Initialize PCC timecounter, unless we're running in Qemu * (we will use a different timecounter in that case). */ - if (! alpha_is_qemu) { + if (!alpha_is_qemu) { const uint64_t pcc_freq = cpu_frequency(curcpu()); cc_init(NULL, pcc_freq, "PCC", PCC_QUAL); alpha_use_cctr = 1;
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: skrll Date: Tue Apr 5 04:33:36 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: clock.c Log Message: KNF To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: riastradh Date: Sun Feb 27 14:17:10 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: cpu.c Log Message: alpha: Fix placement of membar for sending ICCB message. While here, reduce it to membar_exit -- it's obviously not needed for store-before-load here (although alpha doesn't have anything weaker than the full sequential consistency `mb'), and although we do need a store-before-load (and load-before-load) to spin waiting for the CPU to wake up, that already happens a few lines below with alpha_mb in the loop anyway. So no need for membar_sync, which is just `mb' under the hood -- deleting the membar_sync in this place can't hurt. The membar_sync had been inserted automatically when converting from an older style of atomic_ops(3) API. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 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.104 src/sys/arch/alpha/alpha/cpu.c:1.105 --- src/sys/arch/alpha/alpha/cpu.c:1.104 Wed May 5 03:54:16 2021 +++ src/sys/arch/alpha/alpha/cpu.c Sun Feb 27 14:17:10 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.104 2021/05/05 03:54:16 thorpej Exp $ */ +/* $NetBSD: cpu.c,v 1.105 2022/02/27 14:17:10 riastradh 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.104 2021/05/05 03:54:16 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.105 2022/02/27 14:17:10 riastradh Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -882,12 +882,13 @@ cpu_iccb_send(long cpu_id, const char *m /* * Copy the message into the ICCB, and tell the secondary console - * that it's there. + * that it's there. Ensure the buffer is initialized before we + * set the rxrdy bits, as a store-release. */ strcpy(pcsp->pcs_iccb.iccb_rxbuf, msg); pcsp->pcs_iccb.iccb_rxlen = strlen(msg); + membar_exit(); atomic_or_ulong(>rpb_rxrdy, cpumask); - membar_sync(); /* Wait for the message to be received. */ for (timeout = 1; timeout != 0; timeout--) {
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: riastradh Date: Sun Feb 27 14:17:10 UTC 2022 Modified Files: src/sys/arch/alpha/alpha: cpu.c Log Message: alpha: Fix placement of membar for sending ICCB message. While here, reduce it to membar_exit -- it's obviously not needed for store-before-load here (although alpha doesn't have anything weaker than the full sequential consistency `mb'), and although we do need a store-before-load (and load-before-load) to spin waiting for the CPU to wake up, that already happens a few lines below with alpha_mb in the loop anyway. So no need for membar_sync, which is just `mb' under the hood -- deleting the membar_sync in this place can't hurt. The membar_sync had been inserted automatically when converting from an older style of atomic_ops(3) API. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: andvar Date: Thu Dec 9 21:13:18 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Few typos slipped in the last review, fixing them. To generate a diff of this commit: cvs rdiff -u -r1.303 -r1.304 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: andvar Date: Thu Dec 9 21:13:18 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: Few typos slipped in the last review, fixing them. To generate a diff of this commit: cvs rdiff -u -r1.303 -r1.304 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.303 src/sys/arch/alpha/alpha/pmap.c:1.304 --- src/sys/arch/alpha/alpha/pmap.c:1.303 Sun Sep 19 20:43:46 2021 +++ src/sys/arch/alpha/alpha/pmap.c Thu Dec 9 21:13:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.303 2021/09/19 20:43:46 andvar Exp $ */ +/* $NetBSD: pmap.c,v 1.304 2021/12/09 21:13:18 andvar 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.303 2021/09/19 20:43:46 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.304 2021/12/09 21:13:18 andvar Exp $"); #include #include @@ -2106,7 +2106,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 actually - * free the PT page untl we've shot down any TLB entries + * free the PT page until we've shot down any TLB entries * for this VPT index. */ @@ -3810,7 +3810,7 @@ pmap_l2pt_delref(pmap_t pmap, pt_entry_t "0x%lx\n", pmap_pte_pa(l1pte)); #endif /* - * You can pass NULL if you know the last refrence won't + * You can pass NULL if you know the last reference won't * be dropped. */ KASSERT(tlbctx != NULL); @@ -3870,7 +3870,7 @@ pmap_asn_alloc(pmap_t const pmap, struct KASSERT(pmap->pm_percpu[ci->ci_cpuid].pmc_lev1map != kernel_lev1map); KASSERT(kpreempt_disabled()); - /* No work to do if the the CPU does not implement ASNs. */ + /* No work to do if the CPU does not implement ASNs. */ if (pmap_max_asn == 0) return 0;
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: andvar Date: Sun Sep 19 20:43:46 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: review and fix rest of the typos in alpha pmap.c. To generate a diff of this commit: cvs rdiff -u -r1.302 -r1.303 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.
CVS commit: src/sys/arch/alpha/alpha
Module Name:src Committed By: andvar Date: Sun Sep 19 20:43:46 UTC 2021 Modified Files: src/sys/arch/alpha/alpha: pmap.c Log Message: review and fix rest of the typos in alpha pmap.c. To generate a diff of this commit: cvs rdiff -u -r1.302 -r1.303 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.302 src/sys/arch/alpha/alpha/pmap.c:1.303 --- src/sys/arch/alpha/alpha/pmap.c:1.302 Sun Sep 19 10:34:07 2021 +++ src/sys/arch/alpha/alpha/pmap.c Sun Sep 19 20:43:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.302 2021/09/19 10:34:07 andvar Exp $ */ +/* $NetBSD: pmap.c,v 1.303 2021/09/19 20:43:46 andvar 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.302 2021/09/19 10:34:07 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.303 2021/09/19 20:43:46 andvar Exp $"); #include #include @@ -544,7 +544,7 @@ pmap_pvlist_free(struct pmap_pvlist * co * Some things that add complexity: * * ==> ASNs. A CPU may have valid TLB entries for other than the current - * address spaace. We can only invalidate TLB entries for the current + * address space. We can only invalidate TLB entries for the current * address space, so when asked to invalidate a VA for the non-current * pmap on a given CPU, we simply invalidate the ASN for that pmap,CPU * tuple so that new one is allocated on the next activation on that @@ -587,7 +587,7 @@ pmap_pvlist_free(struct pmap_pvlist * co * global bitmap off CPUs to be notified, and then send the IPIs to * each victim. While the other CPUs are in-flight, we then perform * any invalidations necessary on the local CPU. Once that is done, - * we then wait the the global context pointer to be cleared, which + * we then wait 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 processing. * @@ -597,7 +597,7 @@ pmap_pvlist_free(struct pmap_pvlist * co * CPU might hold for the respective recursive VPT mappings. This must * be done whenever an L1 or L2 PTE is invalidated. Until these VPT * translations are invalidated, the PT pages must not be reused. For - * this reason, we keep a list of freed PT pages in the context stucture + * this reason, we keep a list of freed PT pages in the context structure * and drain them off once all invalidations are complete. * * NOTE: The value of TLB_CTX_MAXVA is tuned to accommodate the UBC @@ -3635,7 +3635,7 @@ pmap_l1pt_ctor(void *arg, void *object, /* * pmap_l1pt_alloc: * - * Page alloctaor for L1 PT pages. + * Page allocator for L1 PT pages. */ static void * pmap_l1pt_alloc(struct pool *pp, int flags)
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: 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.
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.
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.
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: 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.
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.
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 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.
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: 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.
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 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.
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.
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.
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 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.
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: 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.
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: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.
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: 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.
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.
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: 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.
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.
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 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.
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: 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.
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.
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 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.
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: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.
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: 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.
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.
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 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.
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.
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 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.
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.
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: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.
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: 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.