Add support for Restartable Atomic Sequences.

XXX: ptrace(2) does not currently work on SH5, so there are no checks for
tracing through a RAS at this time.
This commit is contained in:
scw 2002-10-12 11:39:53 +00:00
parent ba5fd9b3f8
commit 2991c538da
3 changed files with 31 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: types.h,v 1.4 2002/10/09 20:27:35 scw Exp $ */
/* $NetBSD: types.h,v 1.5 2002/10/12 11:39:53 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -77,6 +77,7 @@ typedef struct label_t {
#define __HAVE_DEVICE_REGISTER
#define __HAVE_GENERIC_SOFT_INTERRUPTS
#define __HAVE_SYSCALL_INTERN
#define __HAVE_RAS
#ifdef notyet
#define __HAVE_AST_PERPROC /* Not reqd. until we support SMP */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu_switch.S,v 1.12 2002/10/09 20:27:35 scw Exp $ */
/* $NetBSD: cpu_switch.S,v 1.13 2002/10/12 11:39:54 scw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -378,6 +378,31 @@ Lsw2:
blink tr0, r18
or r28, r63, r2 /* new proc to r2 */
/*
* Check for restartable atomic sequences (RAS)
*/
pta/l 2f, tr0
ld.l r2, P_NRAS, r0
beq/l r2, r63, tr0 /* Skip if no RAS registered for proc */
LEAF(_C_LABEL(ras_lookup), r0)
ptabs/l r0, tr0
LDPTR r2, P_ADDR, r3 /* Fetch new process' pcb */
LDPTR r2, P_MD_REGS, r29 /* Fetch pointer to trapframe */
ld.q r29, TF_SPC, r3 /* Fetch user-space program-counter */
#ifndef _LP64
add.l r3, r63, r3 /* Sign-extend for ILP32 ABI */
#endif
blink tr0, r18 /* r2 = ras_lookup(newproc, spc) */
pta/l 2f, tr0
#ifndef _LP64
add.l r2, r63, r3 /* Sign-extend result for ILP32 ABI */
#else
or r2, r63, r3
#endif
or r28, r63, r2 /* Restore new proc to r2 */
beqi/l r3, -1, tr0 /* Jump if no need to restart */
st.q r29, TF_SPC, r3 /* Otherwise, reset the process' PC */
2:
LDPTR r2, P_ADDR, r3 /* Fetch new process' pcb */
LDPTR r2, P_MD_REGS, r1 /* Fetch pointer to trapframe */

View File

@ -1,4 +1,4 @@
# $NetBSD: genassym.cf,v 1.10 2002/09/12 12:44:14 scw Exp $
# $NetBSD: genassym.cf,v 1.11 2002/10/12 11:39:54 scw Exp $
# Copyright 2002 Wasabi Systems, Inc.
# All rights reserved.
@ -208,6 +208,7 @@ define TF_TR5 offsetof(struct trapframe, tf_callee.tr5)
define TF_TR6 offsetof(struct trapframe, tf_callee.tr6)
define TF_TR7 offsetof(struct trapframe, tf_callee.tr7)
define TF_SSR offsetof(struct trapframe, tf_state.sf_ssr)
define TF_SPC offsetof(struct trapframe, tf_state.sf_spc)
define TF_USR offsetof(struct trapframe, tf_state.sf_usr)
# Exception Scratch Frame Offsets
@ -242,6 +243,7 @@ define P_BACK offsetof(struct proc, p_back)
define P_FORW offsetof(struct proc, p_forw)
define P_STAT offsetof(struct proc, p_stat)
define P_WCHAN offsetof(struct proc, p_wchan)
define P_NRAS offsetof(struct proc, p_nras)
define P_MD_SYSCALL offsetof(struct proc, p_md.md_syscall)
define P_MD_ASTPENDING offsetof(struct proc, p_md.md_astpending)
define P_MD_REGS offsetof(struct proc, p_md.md_regs)