CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: snj Date: Mon Sep 4 16:05:13 UTC 2017 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: compat_13_machdep.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1501): sys/arch/sparc64/sparc64/compat_13_machdep.c: revision 1.24 Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get kernel privileges on the hardware. ok martin To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.23.18.1 \ src/sys/arch/sparc64/sparc64/compat_13_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/sparc64/sparc64/compat_13_machdep.c diff -u src/sys/arch/sparc64/sparc64/compat_13_machdep.c:1.23 src/sys/arch/sparc64/sparc64/compat_13_machdep.c:1.23.18.1 --- src/sys/arch/sparc64/sparc64/compat_13_machdep.c:1.23 Sat Nov 21 04:16:52 2009 +++ src/sys/arch/sparc64/sparc64/compat_13_machdep.c Mon Sep 4 16:05:13 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_13_machdep.c,v 1.23 2009/11/21 04:16:52 rmind Exp $ */ +/* $NetBSD: compat_13_machdep.c,v 1.23.18.1 2017/09/04 16:05:13 snj Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.23 2009/11/21 04:16:52 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.23.18.1 2017/09/04 16:05:13 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -129,7 +129,7 @@ compat_13_sys_sigreturn(struct lwp *l, c return (EINVAL); /* take only psr ICC field */ #ifdef __arch64__ - tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | scp->sc_tstate; + tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | (scp->sc_tstate & TSTATE_CCR); #else tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(scp->sc_psr); #endif
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: snj Date: Mon Sep 4 16:05:13 UTC 2017 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: compat_13_machdep.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1501): sys/arch/sparc64/sparc64/compat_13_machdep.c: revision 1.24 Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get kernel privileges on the hardware. ok martin To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.23.18.1 \ src/sys/arch/sparc64/sparc64/compat_13_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sat Sep 24 13:18:43 UTC 2016 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s Log Message: Pull up following revision(s) (requested by nakayama in ticket #1408): sys/arch/sparc64/sparc64/locore.s: revision 1.401 Fix RAS for 32-bit kernels. trapframe is always 64-bit. To generate a diff of this commit: cvs rdiff -u -r1.338.8.7 -r1.338.8.8 src/sys/arch/sparc64/sparc64/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sat Sep 24 13:18:43 UTC 2016 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s Log Message: Pull up following revision(s) (requested by nakayama in ticket #1408): sys/arch/sparc64/sparc64/locore.s: revision 1.401 Fix RAS for 32-bit kernels. trapframe is always 64-bit. To generate a diff of this commit: cvs rdiff -u -r1.338.8.7 -r1.338.8.8 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.338.8.7 src/sys/arch/sparc64/sparc64/locore.s:1.338.8.8 --- src/sys/arch/sparc64/sparc64/locore.s:1.338.8.7 Sun Nov 15 21:02:13 2015 +++ src/sys/arch/sparc64/sparc64/locore.s Sat Sep 24 13:18:43 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.338.8.7 2015/11/15 21:02:13 bouyer Exp $ */ +/* $NetBSD: locore.s,v 1.338.8.8 2016/09/24 13:18:43 bouyer Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -5202,12 +5202,12 @@ ENTRY(cpu_switchto) brz,pt %o1, Lsw_noras ! no, skip RAS check LDPTR [%i1 + L_TF], %l3 ! pointer to trap frame call _C_LABEL(ras_lookup) - LDPTR [%l3 + TF_PC], %o1 + ldx [%l3 + TF_PC], %o1 cmp %o0, -1 - be,pt %xcc, Lsw_noras + be,pt CCCR, Lsw_noras add %o0, 4, %o1 - STPTR %o0, [%l3 + TF_PC] ! store rewound %pc - STPTR %o1, [%l3 + TF_NPC] ! and %npc + stx %o0, [%l3 + TF_PC] ! store rewound %pc + stx %o1, [%l3 + TF_NPC] ! and %npc Lsw_noras:
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sat Sep 24 13:06:41 UTC 2016 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: kobj_machdep.c Log Message: Pull up following revision(s) (requested by martin in ticket #1405): sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.5 sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.6 Follow rev. 1.54, 1.55 of libexec/ld.elf_so/arch/sparc64/mdreloc.c. The target of the OLO10 relocation is the simd13 field of the instruction, so use a 13 bit target mask. Fixes PR kern/51436 (I broke this myself in rev 1.4) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.4.14.1 src/sys/arch/sparc64/sparc64/kobj_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sat Sep 24 13:06:41 UTC 2016 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: kobj_machdep.c Log Message: Pull up following revision(s) (requested by martin in ticket #1405): sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.5 sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.6 Follow rev. 1.54, 1.55 of libexec/ld.elf_so/arch/sparc64/mdreloc.c. The target of the OLO10 relocation is the simd13 field of the instruction, so use a 13 bit target mask. Fixes PR kern/51436 (I broke this myself in rev 1.4) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.4.14.1 src/sys/arch/sparc64/sparc64/kobj_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/sparc64/sparc64/kobj_machdep.c diff -u src/sys/arch/sparc64/sparc64/kobj_machdep.c:1.4 src/sys/arch/sparc64/sparc64/kobj_machdep.c:1.4.14.1 --- src/sys/arch/sparc64/sparc64/kobj_machdep.c:1.4 Sun May 2 11:43:30 2010 +++ src/sys/arch/sparc64/sparc64/kobj_machdep.c Sat Sep 24 13:06:41 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: kobj_machdep.c,v 1.4 2010/05/02 11:43:30 martin Exp $ */ +/* $NetBSD: kobj_machdep.c,v 1.4.14.1 2016/09/24 13:06:41 bouyer Exp $ */ /*- * Copyright (c) 2001 Jake Burkholder. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.4 2010/05/02 11:43:30 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.4.14.1 2016/09/24 13:06:41 bouyer Exp $"); #define ELFSIZE ARCH_ELFSIZE @@ -164,15 +164,15 @@ static const long reloc_target_bitmask[] _BM(22), _BM(10), /* _HIPLT22, LOPLT10 */ _BM(32), _BM(22), _BM(10), /* _PCPLT32, _PCPLT22, _PCPLT10 */ _BM(10), _BM(11), -1, /* _10, _11, _64 */ - _BM(10), _BM(22), /* _OLO10, _HH22 */ + _BM(13), _BM(22), /* _OLO10, _HH22 */ _BM(10), _BM(22), /* _HM10, _LM22 */ _BM(22), _BM(10), _BM(22), /* _PC_HH22, _PC_HM10, _PC_LM22 */ _BM(16), _BM(19), /* _WDISP16, _WDISP19 */ -1,/* GLOB_JMP */ - _BM(7), _BM(5), _BM(6) /* _7, _5, _6 */ + _BM(7), _BM(5), _BM(6), /* _7, _5, _6 */ -1, -1,/* DISP64, PLT64 */ _BM(22), _BM(13), /* HIX22, LOX10 */ - _BM(22), _BM(10), _BM(13), /* H44, M44, L44 */ + _BM(22), _BM(10), _BM(12), /* H44, M44, L44 */ -1, -1, _BM(16), /* REGISTER, UA64, UA16 */ #undef _BM };
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sun Nov 15 21:02:13 UTC 2015 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s netbsd32_machdep.c vm_machdep.c Log Message: Pull up following revision(s) (requested by martin in ticket #1343): sys/arch/sparc64/sparc64/locore.s: revision 1.386 sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101 sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105 sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106 Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c: Remove special case handling for userland lwps from cpu_lwp_fork, instead do it in lwp_trampoline when we first return to userland. which was a stupid idea - since we did now set all fork child's %tstate (and thus %pstate when back in userland) to the current kernel's userland default. This meant we lost the address mask bit for 32bit processes and all memory model details for 64bit ones. Move it back to cpu_lwp_fork and fix the condition to only do it once when forking init. Fix kmem_free() size mismatch Convert siginfo to 32bit version before copying it out to 32bit userland. To generate a diff of this commit: cvs rdiff -u -r1.338.8.6 -r1.338.8.7 src/sys/arch/sparc64/sparc64/locore.s cvs rdiff -u -r1.96.2.1 -r1.96.2.2 \ src/sys/arch/sparc64/sparc64/netbsd32_machdep.c cvs rdiff -u -r1.98 -r1.98.8.1 src/sys/arch/sparc64/sparc64/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sun Nov 15 21:02:13 UTC 2015 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s netbsd32_machdep.c vm_machdep.c Log Message: Pull up following revision(s) (requested by martin in ticket #1343): sys/arch/sparc64/sparc64/locore.s: revision 1.386 sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101 sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105 sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106 Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c: Remove special case handling for userland lwps from cpu_lwp_fork, instead do it in lwp_trampoline when we first return to userland. which was a stupid idea - since we did now set all fork child's %tstate (and thus %pstate when back in userland) to the current kernel's userland default. This meant we lost the address mask bit for 32bit processes and all memory model details for 64bit ones. Move it back to cpu_lwp_fork and fix the condition to only do it once when forking init. Fix kmem_free() size mismatch Convert siginfo to 32bit version before copying it out to 32bit userland. To generate a diff of this commit: cvs rdiff -u -r1.338.8.6 -r1.338.8.7 src/sys/arch/sparc64/sparc64/locore.s cvs rdiff -u -r1.96.2.1 -r1.96.2.2 \ src/sys/arch/sparc64/sparc64/netbsd32_machdep.c cvs rdiff -u -r1.98 -r1.98.8.1 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.338.8.6 src/sys/arch/sparc64/sparc64/locore.s:1.338.8.7 --- src/sys/arch/sparc64/sparc64/locore.s:1.338.8.6 Tue Mar 24 08:51:14 2015 +++ src/sys/arch/sparc64/sparc64/locore.s Sun Nov 15 21:02:13 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.338.8.6 2015/03/24 08:51:14 snj Exp $ */ +/* $NetBSD: locore.s,v 1.338.8.7 2015/11/15 21:02:13 bouyer Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -5368,12 +5368,6 @@ ENTRY(lwp_trampoline) mov %l1, %o0 /* - * Going to userland - set proper tstate in trap frame - */ - set (ASI_PRIMARY_NO_FAULT<ksi_signo; ucontext32_t uc; struct sparc32_sigframe_siginfo *fp; + siginfo32_t si32; netbsd32_intptr_t catcher; struct trapframe64 *tf = l->l_md.md_tf; struct rwindow32 *oldsp, *newsp; @@ -342,15 +343,16 @@ netbsd32_sendsig_siginfo(const ksiginfo_ else fp = (struct sparc32_sigframe_siginfo *)oldsp; fp = (struct sparc32_sigframe_siginfo*)((u_long)(fp - 1) & ~7); + /* * Build the signal context to be used by sigreturn. */ + memset(, 0, sizeof uc); uc.uc_flags = _UC_SIGMASK | ((l->l_sigstk.ss_flags & SS_ONSTACK) ? _UC_SETSTACK : _UC_CLRSTACK); uc.uc_sigmask = *mask; uc.uc_link = (uint32_t)(uintptr_t)l->l_ctxlink; - memset(_stack, 0, sizeof(uc.uc_stack)); sendsig_reset(l, sig); @@ -365,9 +367,10 @@ netbsd32_sendsig_siginfo(const ksiginfo_ */ mutex_exit(p->p_lock); cpu_getmcontext32(l, _mcontext, _flags); + netbsd32_si_to_si32(, (const siginfo_t *)>ksi_info); ucsz = (int)(intptr_t)__uc_pad - (int)(intptr_t) newsp = (struct rwindow32*)((intptr_t)fp - sizeof(struct frame32)); - error = (copyout(>ksi_info, >sf_si, sizeof ksi->ksi_info) || + error = (copyout(, >sf_si, sizeof si32) || copyout(, >sf_uc, ucsz) || suword(>rw_in[6], (intptr_t)oldsp)); mutex_enter(p->p_lock); @@ -1367,7 +1370,8 @@ startlwp32(void *arg) error = cpu_setmcontext32(l, >uc_mcontext, uc->uc_flags); KASSERT(error == 0); - kmem_free(uc, sizeof(ucontext32_t)); + /* Note: we are freeing ucontext_t, not ucontext32_t. */ + kmem_free(arg, sizeof(ucontext_t)); userret(l, 0, 0); } Index: src/sys/arch/sparc64/sparc64/vm_machdep.c diff -u
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: snj Date: Tue Mar 24 08:51:14 UTC 2015 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s Log Message: Pull up following revision(s) (requested by nakayama in ticket #1265): sys/arch/sparc64/sparc64/locore.s: revision 1.380 PANICSTACK is a pointer itself, not a pointer to pointer. To generate a diff of this commit: cvs rdiff -u -r1.338.8.5 -r1.338.8.6 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.338.8.5 src/sys/arch/sparc64/sparc64/locore.s:1.338.8.6 --- src/sys/arch/sparc64/sparc64/locore.s:1.338.8.5 Sat Dec 14 19:33:28 2013 +++ src/sys/arch/sparc64/sparc64/locore.s Tue Mar 24 08:51:14 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.338.8.5 2013/12/14 19:33:28 bouyer Exp $ */ +/* $NetBSD: locore.s,v 1.338.8.6 2015/03/24 08:51:14 snj Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -1890,9 +1890,7 @@ winfixspill: wrpr %g0, 0, %otherwin or %lo(2f), %o0, %o0 wrpr %g0, WSTATE_KERN, %wstate - sethi %hi(PANICSTACK), %sp - LDPTR [%sp + %lo(PANICSTACK)], %sp - add %sp, -CC64FSZ-STKB, %sp + set PANICSTACK-CC64FSZ-STKB, %sp ta 1; nop ! This helps out traptrace. call _C_LABEL(panic)! This needs to be fixed properly but we should panic here mov %g1, %o1 @@ -2570,9 +2568,7 @@ slowtrap: cmp %g7, WSTATE_KERN bnz,pt %icc, 1f ! User stack -- we'll blow it away nop - sethi %hi(PANICSTACK), %sp - LDPTR [%sp + %lo(PANICSTACK)], %sp - add %sp, -CC64FSZ-STKB, %sp + set PANICSTACK-CC64FSZ-STKB, %sp 1: #endif rdpr %tt, %g4
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: snj Date: Tue Mar 24 08:51:14 UTC 2015 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s Log Message: Pull up following revision(s) (requested by nakayama in ticket #1265): sys/arch/sparc64/sparc64/locore.s: revision 1.380 PANICSTACK is a pointer itself, not a pointer to pointer. To generate a diff of this commit: cvs rdiff -u -r1.338.8.5 -r1.338.8.6 src/sys/arch/sparc64/sparc64/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: msaitoh Date: Sun Nov 9 06:53:32 UTC 2014 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: machdep.c Log Message: Pull up following revision(s) (requested by nakayama in ticket #1176): sys/arch/sparc64/sparc64/machdep.c: revision 1.280 sys/arch/sparc64/sparc64/machdep.c: revision 1.274 Remove duplicate/unused declarations. Sync cpu_reboot with i386: - avoid sync and unmount after panic. - remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead. - resurrect doshutdownhooks since some drivers still use it (eg. sab(4)). To generate a diff of this commit: cvs rdiff -u -r1.265.2.1 -r1.265.2.2 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/machdep.c diff -u src/sys/arch/sparc64/sparc64/machdep.c:1.265.2.1 src/sys/arch/sparc64/sparc64/machdep.c:1.265.2.2 --- src/sys/arch/sparc64/sparc64/machdep.c:1.265.2.1 Mon May 21 15:25:56 2012 +++ src/sys/arch/sparc64/sparc64/machdep.c Sun Nov 9 06:53:32 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.265.2.1 2012/05/21 15:25:56 riz Exp $ */ +/* $NetBSD: machdep.c,v 1.265.2.2 2014/11/09 06:53:32 msaitoh Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.265.2.1 2012/05/21 15:25:56 riz Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.265.2.2 2014/11/09 06:53:32 msaitoh Exp $); #include opt_ddb.h #include opt_multiprocessor.h @@ -156,13 +156,10 @@ extern vaddr_t avail_end; #ifdef MODULAR vaddr_t module_start, module_end; static struct vm_map module_map_store; -extern struct vm_map *module_map; #endif int physmem; -extern void *msgbufaddr; - /* * Maximum number of DMA segments we'll allow in dmamem_load() * routines. Can be overridden in config files, etc. @@ -609,12 +606,13 @@ cpu_reboot(int howto, char *user_boot_st */ maybe_dump(howto); - if ((howto RB_NOSYNC) == 0 !syncdone) { - extern struct lwp lwp0; - + /* + * If we've panic'd, don't make the situation potentially + * worse by syncing or unmounting the file systems. + */ + if ((howto RB_NOSYNC) == 0 panicstr == NULL) { if (!syncdone) { - syncdone = true; - vfs_shutdown(); + syncdone = true; /* XXX used to force unmount as well, here */ vfs_sync_all(l); /* @@ -642,6 +640,7 @@ cpu_reboot(int howto, char *user_boot_st splhigh(); haltsys: + doshutdownhooks(); #ifdef MULTIPROCESSOR /* Stop all secondary cpus */
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: msaitoh Date: Sun Nov 9 06:53:32 UTC 2014 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: machdep.c Log Message: Pull up following revision(s) (requested by nakayama in ticket #1176): sys/arch/sparc64/sparc64/machdep.c: revision 1.280 sys/arch/sparc64/sparc64/machdep.c: revision 1.274 Remove duplicate/unused declarations. Sync cpu_reboot with i386: - avoid sync and unmount after panic. - remove vfs_shutdown, we call vfs_sync_all and vfs_unmount* instead. - resurrect doshutdownhooks since some drivers still use it (eg. sab(4)). To generate a diff of this commit: cvs rdiff -u -r1.265.2.1 -r1.265.2.2 src/sys/arch/sparc64/sparc64/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sat Dec 14 19:33:28 UTC 2013 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s Log Message: Pull up following revision(s) (requested by nakayama in ticket #994): sys/arch/sparc64/sparc64/locore.s: revision 1.350 Increase an interrupt depth only in the case of hardware interrupts, and remove the ci_idepth trick in softint_fastintr. Fixes the following diagnostic panic reported in port-sparc64. panic: kernel diagnostic assertion !cpu_intr_p() failed: file ../../../../kern/subr_xcall.c, line 351 To generate a diff of this commit: cvs rdiff -u -r1.338.8.4 -r1.338.8.5 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.338.8.4 src/sys/arch/sparc64/sparc64/locore.s:1.338.8.5 --- src/sys/arch/sparc64/sparc64/locore.s:1.338.8.4 Fri Feb 8 20:58:17 2013 +++ src/sys/arch/sparc64/sparc64/locore.s Sat Dec 14 19:33:28 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.338.8.4 2013/02/08 20:58:17 riz Exp $ */ +/* $NetBSD: locore.s,v 1.338.8.5 2013/12/14 19:33:28 bouyer Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -3284,12 +3284,6 @@ ENTRY_NOPROFILE(sparc_interrupt) LDPTR [%g3 + %lo(CPUINFO_VA+CI_TICK_IH)], %g5 0: - ! Increment the per-cpu interrupt level - sethi %hi(CPUINFO_VA+CI_IDEPTH), %g1 - ld [%g1 + %lo(CPUINFO_VA+CI_IDEPTH)], %g2 - inc %g2 - st %g2, [%g1 + %lo(CPUINFO_VA+CI_IDEPTH)] - #ifdef TRAPSTATS sethi %hi(_C_LABEL(kintrcnt)), %g1 sethi %hi(_C_LABEL(uintrcnt)), %g2 @@ -3378,6 +3372,17 @@ ENTRY_NOPROFILE(sparc_interrupt) wrpr %l6, %pil +#define SOFTINT_INT \ + (1IPL_SOFTCLOCK|1IPL_SOFTBIO|1IPL_SOFTNET|1IPL_SOFTSERIAL) + + ! Increment the per-cpu interrupt depth in case of hardintrs + btst SOFTINT_INT, %l3 + bnz,pn %icc, sparc_intr_retry + sethi %hi(CPUINFO_VA+CI_IDEPTH), %l1 + ld [%l1 + %lo(CPUINFO_VA+CI_IDEPTH)], %l2 + inc %l2 + st %l2, [%l1 + %lo(CPUINFO_VA+CI_IDEPTH)] + sparc_intr_retry: wr %l3, 0, CLEAR_SOFTINT ! (don't clear possible %tick IRQ) sethi %hi(CPUINFO_VA+CI_INTRPENDING), %l4 @@ -3477,11 +3482,14 @@ intrcmplt: bnz,pn %icc, sparc_intr_retry mov 1, %l5 ! initialize intr count for next run - ! Decrement this cpu's interrupt depth - sethi %hi(CPUINFO_VA+CI_IDEPTH), %l4 + ! Decrement this cpu's interrupt depth in case of hardintrs + btst SOFTINT_INT, %l3 + bnz,pn %icc, 1f + sethi %hi(CPUINFO_VA+CI_IDEPTH), %l4 ld [%l4 + %lo(CPUINFO_VA+CI_IDEPTH)], %l5 dec %l5 st %l5, [%l4 + %lo(CPUINFO_VA+CI_IDEPTH)] +1: #ifdef NOT_DEBUG set _C_LABEL(intrdebug), %o2 @@ -5233,11 +5241,8 @@ ENTRY(softint_fastintr) set CPUINFO_VA, %l0 ! l0 = curcpu() rdpr %pil, %l7 ! l7 = splhigh() wrpr %g0, PIL_HIGH, %pil - ld [%l0 + CI_IDEPTH], %l1 LDPTR [%l0 + CI_EINTSTACK], %l6 ! l6 = ci_eintstack - dec %l1 add %sp, -CC64FSZ, %l2 ! ci_eintstack = sp - CC64FSZ - st %l1, [%l0 + CI_IDEPTH] ! adjust ci_idepth STPTR %l2, [%l0 + CI_EINTSTACK] ! save intstack for nexted intr mov %i0, %o0 ! o0/i0 = softint lwp @@ -5282,10 +5287,7 @@ ENTRY(softint_fastintr) restore ! rewind register window - ld [%l0 + CI_IDEPTH], %l1 STPTR %l6, [%l0 + CI_EINTSTACK] ! restore ci_eintstack - inc %l1 - st %l1, [%l0 + CI_IDEPTH] ! re-adjust ci_idepth wrpr %g0, %l7, %pil ! restore ipl ret restore %g0, 1, %o0 @@ -5309,10 +5311,7 @@ softint_fastintr_ret: st %o1, [%l0 + CI_MTX_COUNT] st %g0, [%o0 + L_CTXSWTCH] ! prev-l_ctxswtch = 0 - ld [%l0 + CI_IDEPTH], %l1 STPTR %l6, [%l0 + CI_EINTSTACK] ! restore ci_eintstack - inc %l1 - st %l1, [%l0 + CI_IDEPTH] ! re-adjust ci_idepth wrpr %g0, %l7, %pil ! restore ipl ret restore %g0, 1, %o0
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sat Dec 14 19:33:28 UTC 2013 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s Log Message: Pull up following revision(s) (requested by nakayama in ticket #994): sys/arch/sparc64/sparc64/locore.s: revision 1.350 Increase an interrupt depth only in the case of hardware interrupts, and remove the ci_idepth trick in softint_fastintr. Fixes the following diagnostic panic reported in port-sparc64. panic: kernel diagnostic assertion !cpu_intr_p() failed: file ../../../../kern/subr_xcall.c, line 351 To generate a diff of this commit: cvs rdiff -u -r1.338.8.4 -r1.338.8.5 src/sys/arch/sparc64/sparc64/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: riz Date: Fri Feb 8 20:58:17 UTC 2013 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s mp_subr.S Log Message: Pull up following revision(s) (requested by martin in ticket #797): sys/arch/sparc64/sparc64/locore.s: revision 1.347 sys/arch/sparc64/sparc64/mp_subr.S: revision 1.4 Fix sparc64_ipi_ccall by adding proper trap setup. Fixes xcall(9) problems, as exposed by pserialize(9). Noticed by J. Hannken-Illjes, cause pointed out by Takeshi Nakayama. To generate a diff of this commit: cvs rdiff -u -r1.338.8.3 -r1.338.8.4 src/sys/arch/sparc64/sparc64/locore.s cvs rdiff -u -r1.3 -r1.3.8.1 src/sys/arch/sparc64/sparc64/mp_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/sparc64/sparc64/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.338.8.3 src/sys/arch/sparc64/sparc64/locore.s:1.338.8.4 --- src/sys/arch/sparc64/sparc64/locore.s:1.338.8.3 Fri Nov 23 16:12:36 2012 +++ src/sys/arch/sparc64/sparc64/locore.s Fri Feb 8 20:58:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.338.8.3 2012/11/23 16:12:36 riz Exp $ */ +/* $NetBSD: locore.s,v 1.338.8.4 2013/02/08 20:58:17 riz Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -6302,6 +6302,67 @@ ENTRY(OF_val2sym32) #endif /* _LP64 */ #endif /* DDB */ + +#if defined(MULTIPROCESSOR) +/* + * IPI target function to setup a C compatible environment and call a MI function. + * + * On entry: + * We are on one of the alternate set of globals + * %g2 = function to call + * %g3 = single argument to called function + */ +ENTRY(sparc64_ipi_ccall) +#ifdef TRAPS_USE_IG + wrpr %g0, PSTATE_KERN|PSTATE_IG, %pstate ! DEBUG +#endif + TRAP_SETUP(-CC64FSZ-TF_SIZE) + +#ifdef DEBUG + rdpr %tt, %o1 ! debug + sth %o1, [%sp + CC64FSZ + STKB + TF_TT]! debug +#endif + mov %g3, %o0 ! save argument of function to call + mov %g2, %o5 ! save function pointer + + wrpr %g0, PSTATE_KERN, %pstate ! Get back to normal globals + stx %g1, [%sp + CC64FSZ + STKB + TF_G + ( 1*8)] + mov %g1, %o1 ! code + rdpr %tpc, %o2 ! (pc) + stx %g2, [%sp + CC64FSZ + STKB + TF_G + ( 2*8)] + rdpr %tstate, %g1 + stx %g3, [%sp + CC64FSZ + STKB + TF_G + ( 3*8)] + rdpr %tnpc, %o3 + stx %g4, [%sp + CC64FSZ + STKB + TF_G + ( 4*8)] + rd %y, %o4 + stx %g5, [%sp + CC64FSZ + STKB + TF_G + ( 5*8)] + stx %g6, [%sp + CC64FSZ + STKB + TF_G + ( 6*8)] + wrpr %g0, 0, %tl ! return to tl=0 + stx %g7, [%sp + CC64FSZ + STKB + TF_G + ( 7*8)] + + stx %g1, [%sp + CC64FSZ + STKB + TF_TSTATE] + stx %o2, [%sp + CC64FSZ + STKB + TF_PC] + stx %o3, [%sp + CC64FSZ + STKB + TF_NPC] + st %o4, [%sp + CC64FSZ + STKB + TF_Y] + + rdpr %pil, %g5 + stb %g5, [%sp + CC64FSZ + STKB + TF_PIL] + stb %g5, [%sp + CC64FSZ + STKB + TF_OLDPIL] + + !! In the EMBEDANY memory model %g4 points to the start of the data segment. + !! In our case we need to clear it before calling any C-code + clr %g4 + wr %g0, ASI_NUCLEUS, %asi ! default kernel ASI + + call %o5 ! call function + nop + + ba,a return_from_trap ! and return from IPI + nop + +#endif + + .data _ALIGN #if NKSYMS || defined(DDB) || defined(LKM) Index: src/sys/arch/sparc64/sparc64/mp_subr.S diff -u src/sys/arch/sparc64/sparc64/mp_subr.S:1.3 src/sys/arch/sparc64/sparc64/mp_subr.S:1.3.8.1 --- src/sys/arch/sparc64/sparc64/mp_subr.S:1.3 Tue Jul 12 07:51:34 2011 +++ src/sys/arch/sparc64/sparc64/mp_subr.S Fri Feb 8 20:58:17 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mp_subr.S,v 1.3 2011/07/12 07:51:34 mrg Exp $ */ +/* $NetBSD: mp_subr.S,v 1.3.8.1 2013/02/08 20:58:17 riz Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -410,22 +410,4 @@ ENTRY(sparc64_ipi_dcache_flush_page_us) ba,a ret_from_intr_vector nop -/* - * Setup a C compatible environment and call a MI function. - * - * On entry: - * %g2 = function to call - * %g3 = single argument to called function - */ -ENTRY(sparc64_ipi_ccall) - save %sp, -CC64FSZ-16, %sp ! create a stack frame - stx %g2, [%fp + BIAS -16 + 0] ! save function pointer - stx %g3, [%fp + BIAS -16 + 8] ! and argument - wrpr%g0, PSTATE_KERN, %pstate ! switch globals - ldx [%fp + BIAS -16 + 0], %l0 ! reload function - call %l0 ! call function - ldx [%fp + BIAS -16 + 8], %o0 ! reload argument - restore ! pop stack frame - ba,a ret_from_intr_vector ! and return from IPI - nop #endif
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: riz Date: Fri Feb 8 20:58:17 UTC 2013 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s mp_subr.S Log Message: Pull up following revision(s) (requested by martin in ticket #797): sys/arch/sparc64/sparc64/locore.s: revision 1.347 sys/arch/sparc64/sparc64/mp_subr.S: revision 1.4 Fix sparc64_ipi_ccall by adding proper trap setup. Fixes xcall(9) problems, as exposed by pserialize(9). Noticed by J. Hannken-Illjes, cause pointed out by Takeshi Nakayama. To generate a diff of this commit: cvs rdiff -u -r1.338.8.3 -r1.338.8.4 src/sys/arch/sparc64/sparc64/locore.s cvs rdiff -u -r1.3 -r1.3.8.1 src/sys/arch/sparc64/sparc64/mp_subr.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: jdc Date: Thu Aug 9 06:55:02 UTC 2012 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: trap.c Log Message: Pull up revision 1.177 (requested by martin in ticket #462). Do not spam the console when sending a sigill due to a T_ILLINST trap, new openssl probes for the cpu sub family/features by trying some new instructions and catching sigill. In all other cases, move the printf inside a #ifdef DEBUG. To generate a diff of this commit: cvs rdiff -u -r1.168.8.3 -r1.168.8.4 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/trap.c diff -u src/sys/arch/sparc64/sparc64/trap.c:1.168.8.3 src/sys/arch/sparc64/sparc64/trap.c:1.168.8.4 --- src/sys/arch/sparc64/sparc64/trap.c:1.168.8.3 Thu Apr 26 02:57:48 2012 +++ src/sys/arch/sparc64/sparc64/trap.c Thu Aug 9 06:55:01 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.168.8.3 2012/04/26 02:57:48 riz Exp $ */ +/* $NetBSD: trap.c,v 1.168.8.4 2012/08/09 06:55:01 jdc Exp $ */ /* * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved. @@ -50,7 +50,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.168.8.3 2012/04/26 02:57:48 riz Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.168.8.4 2012/08/09 06:55:01 jdc Exp $); #include opt_ddb.h #include opt_multiprocessor.h @@ -627,13 +627,15 @@ badtrap: preempt(); break; - case T_ILLINST: case T_INST_EXCEPT: case T_TEXTFAULT: +#ifdef DEBUG /* This is not an MMU issue */ printf(trap: pid=%d.%d comm=%s textfault at %lx!! sending SIGILL due to trap %d: %s\n, l-l_proc-p_pid, l-l_lid, l-l_proc-p_comm, pc, type, type N_TRAP_TYPES ? trap_type[type] : T); +#endif + case T_ILLINST: #if defined(DDB) defined(DEBUG) if (trapdebug TDB_STOPSIG) Debugger();
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: jdc Date: Thu Aug 9 06:55:02 UTC 2012 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: trap.c Log Message: Pull up revision 1.177 (requested by martin in ticket #462). Do not spam the console when sending a sigill due to a T_ILLINST trap, new openssl probes for the cpu sub family/features by trying some new instructions and catching sigill. In all other cases, move the printf inside a #ifdef DEBUG. To generate a diff of this commit: cvs rdiff -u -r1.168.8.3 -r1.168.8.4 src/sys/arch/sparc64/sparc64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: riz Date: Thu Apr 26 02:57:48 UTC 2012 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: trap.c Log Message: Pull up following revision(s) (requested by martin in ticket #201): sys/arch/sparc64/sparc64/trap.c: revision 1.176 Fix 32bit build To generate a diff of this commit: cvs rdiff -u -r1.168.8.2 -r1.168.8.3 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/trap.c diff -u src/sys/arch/sparc64/sparc64/trap.c:1.168.8.2 src/sys/arch/sparc64/sparc64/trap.c:1.168.8.3 --- src/sys/arch/sparc64/sparc64/trap.c:1.168.8.2 Tue Apr 24 19:44:16 2012 +++ src/sys/arch/sparc64/sparc64/trap.c Thu Apr 26 02:57:48 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.168.8.2 2012/04/24 19:44:16 riz Exp $ */ +/* $NetBSD: trap.c,v 1.168.8.3 2012/04/26 02:57:48 riz Exp $ */ /* * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved. @@ -50,7 +50,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.168.8.2 2012/04/24 19:44:16 riz Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.168.8.3 2012/04/26 02:57:48 riz Exp $); #include opt_ddb.h #include opt_multiprocessor.h @@ -748,7 +748,7 @@ badtrap: sig = SIGBUS; ksi.ksi_trap = type; ksi.ksi_code = BUS_ADRALN; - ksi.ksi_addr = (void*)dsfar; + ksi.ksi_addr = (void*)(intptr_t)dsfar; } break;
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: riz Date: Thu Apr 26 02:57:48 UTC 2012 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: trap.c Log Message: Pull up following revision(s) (requested by martin in ticket #201): sys/arch/sparc64/sparc64/trap.c: revision 1.176 Fix 32bit build To generate a diff of this commit: cvs rdiff -u -r1.168.8.2 -r1.168.8.3 src/sys/arch/sparc64/sparc64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: riz Date: Tue Apr 24 19:44:17 UTC 2012 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: trap.c Log Message: Pull up following revision(s) (requested by martin in ticket #199): sys/arch/sparc64/sparc64/trap.c: revision 1.175 Report faulting data address with SIGBUS (instead of the faulting instruction) To generate a diff of this commit: cvs rdiff -u -r1.168.8.1 -r1.168.8.2 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/trap.c diff -u src/sys/arch/sparc64/sparc64/trap.c:1.168.8.1 src/sys/arch/sparc64/sparc64/trap.c:1.168.8.2 --- src/sys/arch/sparc64/sparc64/trap.c:1.168.8.1 Wed Mar 21 16:10:21 2012 +++ src/sys/arch/sparc64/sparc64/trap.c Tue Apr 24 19:44:16 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.168.8.1 2012/03/21 16:10:21 riz Exp $ */ +/* $NetBSD: trap.c,v 1.168.8.2 2012/04/24 19:44:16 riz Exp $ */ /* * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved. @@ -50,7 +50,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.168.8.1 2012/03/21 16:10:21 riz Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.168.8.2 2012/04/24 19:44:16 riz Exp $); #include opt_ddb.h #include opt_multiprocessor.h @@ -732,7 +732,6 @@ badtrap: l-l_proc-p_pid, l-l_lid, l-l_proc-p_comm, fmt64(dsfsr), fmt64(dsfar), fmt64(isfsr), pc); #endif - } #if defined(DDB) defined(DEBUG) if (trapdebug TDB_STOPSIG) { @@ -749,7 +748,8 @@ badtrap: sig = SIGBUS; ksi.ksi_trap = type; ksi.ksi_code = BUS_ADRALN; - ksi.ksi_addr = (void *)pc; + ksi.ksi_addr = (void*)dsfar; + } break; case T_FP_IEEE_754: @@ -1573,7 +1573,7 @@ text_access_error(struct trapframe64 *tf ksi.ksi_signo = SIGBUS; ksi.ksi_code = BUS_OBJERR; ksi.ksi_trap = type; - ksi.ksi_addr = (void *)pc; + ksi.ksi_addr = (void *)afva; trapsignal(l, ksi); }
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: riz Date: Tue Apr 24 19:44:17 UTC 2012 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: trap.c Log Message: Pull up following revision(s) (requested by martin in ticket #199): sys/arch/sparc64/sparc64/trap.c: revision 1.175 Report faulting data address with SIGBUS (instead of the faulting instruction) To generate a diff of this commit: cvs rdiff -u -r1.168.8.1 -r1.168.8.2 src/sys/arch/sparc64/sparc64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: riz Date: Wed Mar 21 16:10:22 UTC 2012 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s trap.c Log Message: Pull up following revision(s) (requested by mrg in ticket #131): sys/arch/sparc64/sparc64/trap.c: revision 1.170 sys/arch/sparc64/sparc64/trap.c: revision 1.171 sys/arch/sparc64/sparc64/locore.s: revision 1.341 port the corrected ECC error handling code from freebsd. i noticed my U10 took one of these and then hang. it shouldn't hang, there's a 'sir' here that doesn't seem to reset properly. oh well. tested by simulated a trap via 'ta 0x10' and considering that the same, but it hasn't been tested against a real ECC error yet. count ECC corrected traps with evcnt(9). To generate a diff of this commit: cvs rdiff -u -r1.338.8.1 -r1.338.8.2 src/sys/arch/sparc64/sparc64/locore.s cvs rdiff -u -r1.168 -r1.168.8.1 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.338.8.1 src/sys/arch/sparc64/sparc64/locore.s:1.338.8.2 --- src/sys/arch/sparc64/sparc64/locore.s:1.338.8.1 Mon Mar 5 20:59:25 2012 +++ src/sys/arch/sparc64/sparc64/locore.s Wed Mar 21 16:10:21 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.338.8.1 2012/03/05 20:59:25 sborrill Exp $ */ +/* $NetBSD: locore.s,v 1.338.8.2 2012/03/21 16:10:21 riz Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -491,7 +491,7 @@ _C_LABEL(trapbase): VTRAP(0x060, interrupt_vector); ! 060 = interrupt vector TRAP(T_PA_WATCHPT) ! 061 = physical address data watchpoint TRAP(T_VA_WATCHPT) ! 062 = virtual address data watchpoint - UTRAP(T_ECCERR) ! We'll implement this one later + TRAP(T_ECCERR) ! 063 = corrected ECC error ufast_IMMU_miss: ! 064 = fast instr access MMU miss ldxa [%g0] ASI_IMMU_8KPTR, %g2 ! Load IMMU 8K TSB pointer #ifdef NO_TSB @@ -727,7 +727,7 @@ kdatafault: VTRAP(0x060, interrupt_vector); ! 060 = interrupt vector TRAP(T_PA_WATCHPT) ! 061 = physical address data watchpoint TRAP(T_VA_WATCHPT) ! 062 = virtual address data watchpoint - UTRAP(T_ECCERR) ! We'll implement this one later + TRAP(T_ECCERR) ! 063 = corrected ECC error kfast_IMMU_miss: ! 064 = fast instr access MMU miss ldxa [%g0] ASI_IMMU_8KPTR, %g2 ! Load IMMU 8K TSB pointer #ifdef NO_TSB Index: src/sys/arch/sparc64/sparc64/trap.c diff -u src/sys/arch/sparc64/sparc64/trap.c:1.168 src/sys/arch/sparc64/sparc64/trap.c:1.168.8.1 --- src/sys/arch/sparc64/sparc64/trap.c:1.168 Sat Jul 30 19:29:12 2011 +++ src/sys/arch/sparc64/sparc64/trap.c Wed Mar 21 16:10:21 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.168 2011/07/30 19:29:12 martin Exp $ */ +/* $NetBSD: trap.c,v 1.168.8.1 2012/03/21 16:10:21 riz Exp $ */ /* * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved. @@ -50,7 +50,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.168 2011/07/30 19:29:12 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.168.8.1 2012/03/21 16:10:21 riz Exp $); #include opt_ddb.h #include opt_multiprocessor.h @@ -94,6 +94,8 @@ __KERNEL_RCSID(0, $NetBSD: trap.c,v 1.1 #include machine/svr4_32_machdep.h #endif +#include sparc64/sparc64/cache.h + #include sparc/fpu/fpu_extern.h #ifndef offsetof @@ -159,6 +161,10 @@ int trapdebug = 0/*|TDB_SYSCALL|TDB_STOP #define Debugger() #endif +struct evcnt ecc_corrected = +EVCNT_INITIALIZER(EVCNT_TYPE_MISC,0,ECC,corrected); +EVCNT_ATTACH_STATIC(ecc_corrected); + /* * Initial FPU state is all registers == all 1s, everything else == all 0s. * This makes every floating point register a signalling NaN, with sign bit @@ -371,6 +377,7 @@ void text_access_fault(struct trapframe6 u_long sfsr); void text_access_error(struct trapframe64 *, unsigned int, vaddr_t, u_long, vaddr_t, u_long); +void ecc_corrected_error(unsigned int type, vaddr_t pc); #ifdef DEBUG void print_trapframe(struct trapframe64 *); @@ -540,6 +547,9 @@ trap(struct trapframe64 *tf, unsigned in /* Enable the FPU */ tf-tf_tstate |= TSTATE_PEF; return; + } else if (type == T_ECCERR) { + ecc_corrected_error(type, pc); + return; } goto dopanic; } @@ -855,6 +865,9 @@ badtrap: ksi.ksi_code = FPE_INTOVF; ksi.ksi_addr = (void *)pc; break; + case T_ECCERR: + ecc_corrected_error(type, pc); + break; } if (sig != 0) { ksi.ksi_signo = sig; @@ -1622,3 +1635,48 @@ out: } #endif } + +/* + * Handle an ECC corrected event. + */ +void +ecc_corrected_error(unsigned int type, vaddr_t pc) +{ + uint64_t eeer, afar, afsr; + char buf[128]; + int s; + + /* Clear the error */ + eeer = ldxa(0, ASI_ERROR_EN_REG); + s = intr_disable(); + stxa(0, ASI_ERROR_EN_REG, + eeer ~(P_EER_NCEEN | P_EER_CEEN)); + membar_Sync(); + intr_restore(s); + + /* Flush the caches in order ensure no corrupt
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: riz Date: Wed Mar 21 16:10:22 UTC 2012 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s trap.c Log Message: Pull up following revision(s) (requested by mrg in ticket #131): sys/arch/sparc64/sparc64/trap.c: revision 1.170 sys/arch/sparc64/sparc64/trap.c: revision 1.171 sys/arch/sparc64/sparc64/locore.s: revision 1.341 port the corrected ECC error handling code from freebsd. i noticed my U10 took one of these and then hang. it shouldn't hang, there's a 'sir' here that doesn't seem to reset properly. oh well. tested by simulated a trap via 'ta 0x10' and considering that the same, but it hasn't been tested against a real ECC error yet. count ECC corrected traps with evcnt(9). To generate a diff of this commit: cvs rdiff -u -r1.338.8.1 -r1.338.8.2 src/sys/arch/sparc64/sparc64/locore.s cvs rdiff -u -r1.168 -r1.168.8.1 src/sys/arch/sparc64/sparc64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.