Implement restartable atomic sequences (RAS) for sparc64.
This commit is contained in:
parent
d63b2431fa
commit
1cfee605ee
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: types.h,v 1.35 2003/09/26 22:46:01 nathanw Exp $ */
|
||||
/* $NetBSD: types.h,v 1.36 2004/01/06 21:35:18 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -102,7 +102,10 @@ typedef __volatile int __cpu_simple_lock_t;
|
||||
#define __GENERIC_SOFT_INTERRUPTS_ALL_LEVELS
|
||||
|
||||
#ifdef SUN4U
|
||||
#define __HAVE_CPU_COUNTER /* sparc64 has %tick */
|
||||
#define __HAVE_CPU_COUNTER /* sparc v9 CPUs have %tick */
|
||||
#endif
|
||||
#ifdef __arch64__
|
||||
#define __HAVE_RAS /* sparc64 implements RAS */
|
||||
#endif
|
||||
|
||||
#endif /* _MACHTYPES_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: genassym.cf,v 1.32 2004/01/06 09:38:19 petrov Exp $
|
||||
# $NetBSD: genassym.cf,v 1.33 2004/01/06 21:35:18 martin Exp $
|
||||
|
||||
#
|
||||
# Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -128,6 +128,7 @@ define L_WCHAN offsetof(struct lwp, l_wchan)
|
||||
define L_CPU offsetof(struct lwp, l_cpu)
|
||||
define L_PROC offsetof(struct lwp, l_proc)
|
||||
define L_PRIORITY offsetof(struct lwp, l_priority)
|
||||
define L_TF offsetof(struct lwp, l_md.md_tf)
|
||||
define L_FPSTATE offsetof(struct lwp, l_md.md_fpstate)
|
||||
|
||||
define LSRUN LSRUN
|
||||
@ -137,6 +138,7 @@ define LSONPROC LSONPROC
|
||||
define P_STAT offsetof(struct proc, p_stat)
|
||||
define P_VMSPACE offsetof(struct proc, p_vmspace)
|
||||
define P_PID offsetof(struct proc, p_pid)
|
||||
define P_RASLIST offsetof(struct proc, p_raslist)
|
||||
|
||||
# user structure fields
|
||||
define USIZ sizeof(struct user)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.s,v 1.187 2004/01/06 09:38:19 petrov Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.188 2004/01/06 21:35:18 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996-2002 Eduardo Horvath
|
||||
@ -8085,7 +8085,7 @@ cpu_loadproc:
|
||||
#endif
|
||||
STPTR %l4, [%l7 + %lo(CURLWP)] ! restore old proc so we can save it
|
||||
|
||||
cmp %l3, %l4 ! p == lastproc?
|
||||
cmp %l3, %l4 ! new lwp == curlwp?
|
||||
be,a,pt %xcc, Lsw_sameproc ! yes, go return 0
|
||||
clr %i0
|
||||
mov 1, %i0
|
||||
@ -8216,8 +8216,8 @@ Lsw_load:
|
||||
* can talk about user space stuff. (Its pcb_uw is currently
|
||||
* zero so it is safe to have interrupts going here.)
|
||||
*/
|
||||
LDPTR [%l3 + L_PROC], %l3 ! now %l3 points to p
|
||||
LDPTR [%l3 + P_VMSPACE], %o3 ! vm = p->p_vmspace;
|
||||
LDPTR [%l3 + L_PROC], %l4 ! now %l4 points to p
|
||||
LDPTR [%l4 + P_VMSPACE], %o3 ! vm = p->p_vmspace;
|
||||
sethi %hi(_C_LABEL(kernel_pmap_)), %o1
|
||||
mov CTX_SECONDARY, %l5 ! Recycle %l5
|
||||
LDPTR [%o3 + VM_PMAP], %o2 ! if (vm->vm_pmap.pm_ctx != NULL)
|
||||
@ -8316,6 +8316,24 @@ Lsw_havectx:
|
||||
1:
|
||||
#endif
|
||||
|
||||
#ifdef __arch64__
|
||||
/*
|
||||
* Check for restartable atomic sequences (RAS)
|
||||
*/
|
||||
mov %l4, %o0 ! p is first arg to ras_lookup
|
||||
ldx [%o0 + P_RASLIST], %o1 ! any RAS in p?
|
||||
brz,pt %o1, Lsw_noras ! no, skip RAS check
|
||||
ldx [%l3 + L_TF], %l3 ! pointer to trap frame
|
||||
call _C_LABEL(ras_lookup)
|
||||
ldx [%l3 + TF_PC], %o1
|
||||
cmp %o0, -1
|
||||
be,pt %xcc, Lsw_noras
|
||||
add %o0, 4, %o1
|
||||
stx %o0, [%l3 + TF_PC] ! store rewound %pc
|
||||
stx %o1, [%l3 + TF_NPC] ! and %npc
|
||||
|
||||
Lsw_noras:
|
||||
#endif
|
||||
|
||||
Lsw_sameproc:
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: machdep.c,v 1.160 2003/12/30 12:33:19 pk Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.161 2004/01/06 21:35:18 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
@ -78,7 +78,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.160 2003/12/30 12:33:19 pk Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.161 2004/01/06 21:35:18 martin Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
@ -93,6 +93,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.160 2003/12/30 12:33:19 pk Exp $");
|
||||
#include <sys/savar.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/ras.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -1797,6 +1798,9 @@ cpu_getmcontext(l, mcp, flags)
|
||||
unsigned int *flags;
|
||||
{
|
||||
__greg_t *gr = mcp->__gregs;
|
||||
#ifdef __arch64__
|
||||
__greg_t ras_pc;
|
||||
#endif
|
||||
const struct trapframe64 *tf = l->l_md.md_tf;
|
||||
|
||||
/* First ensure consistent stack state (see sendsig). */ /* XXX? */
|
||||
@ -1836,6 +1840,14 @@ cpu_getmcontext(l, mcp, flags)
|
||||
#if 0 /* not yet supported */
|
||||
gr[_REG_FPRS] = ;
|
||||
#endif
|
||||
|
||||
/* only sparc64 has RAS support */
|
||||
if ((ras_pc = (__greg_t)ras_lookup(l->l_proc,
|
||||
(caddr_t) gr[_REG_PC])) != -1) {
|
||||
gr[_REG_PC] = ras_pc;
|
||||
gr[_REG_nPC] = ras_pc + 4;
|
||||
}
|
||||
|
||||
#endif /* __arch64__ */
|
||||
*flags |= _UC_CPU;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.107 2004/01/02 20:49:18 martin Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.108 2004/01/06 21:35:19 martin 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.107 2004/01/02 20:49:18 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.108 2004/01/06 21:35:19 martin Exp $");
|
||||
|
||||
#define NEW_FPSTATE
|
||||
|
||||
@ -66,6 +66,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.107 2004/01/02 20:49:18 martin Exp $");
|
||||
#include <sys/pool.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/ras.h>
|
||||
#include <sys/sa.h>
|
||||
#include <sys/savar.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -884,11 +885,14 @@ badtrap:
|
||||
break;
|
||||
|
||||
case T_BREAKPOINT:
|
||||
sig = SIGTRAP;
|
||||
KSI_INIT_TRAP(&ksi);
|
||||
ksi.ksi_trap = type;
|
||||
ksi.ksi_code = TRAP_BRKPT;
|
||||
ksi.ksi_addr = (void *)pc;
|
||||
if (LIST_EMPTY(&p->p_raslist) ||
|
||||
(ras_lookup(p, (caddr_t)tf->tf_pc) == (caddr_t)-1)) {
|
||||
sig = SIGTRAP;
|
||||
KSI_INIT_TRAP(&ksi);
|
||||
ksi.ksi_trap = type;
|
||||
ksi.ksi_code = TRAP_BRKPT;
|
||||
ksi.ksi_addr = (void *)pc;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_IDIV0:
|
||||
|
Loading…
Reference in New Issue
Block a user