Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc/powerpc implement ucas_* for powerpc/oea.
details: https://anonhg.NetBSD.org/src/rev/2a2916fca04b
branches: trunk
changeset: 756128:2a2916fca04b
user: chs <chs%NetBSD.org@localhost>
date: Wed Jul 07 01:19:54 2010 +0000
description:
implement ucas_* for powerpc/oea.
diffstat:
sys/arch/powerpc/powerpc/locore_subr.S | 18 ++++++++++++++++-
sys/arch/powerpc/powerpc/trap.c | 35 ++++++++++++++++++++++++++++++++-
2 files changed, 50 insertions(+), 3 deletions(-)
diffs (92 lines):
diff -r 20c9e73ef05f -r 2a2916fca04b sys/arch/powerpc/powerpc/locore_subr.S
--- a/sys/arch/powerpc/powerpc/locore_subr.S Wed Jul 07 01:19:09 2010 +0000
+++ b/sys/arch/powerpc/powerpc/locore_subr.S Wed Jul 07 01:19:54 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore_subr.S,v 1.39 2009/12/10 05:10:03 rmind Exp $ */
+/* $NetBSD: locore_subr.S,v 1.40 2010/07/07 01:19:54 chs Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -340,3 +340,19 @@
b _C_LABEL(idle_loop)
#endif /*MULTIPROCESSOR + OEA*/
+
+/*
+ * int do_ucas_32(int32_t *uptr, int32_t old, int32_t new, int32_t *ret);
+ */
+ENTRY(do_ucas_32)
+1:
+ lwarx %r10,0,%r3
+ cmpw %r10, %r4
+ bne 2f
+ stwcx. %r5,0,%r3
+ bne 1b
+ mr %r5,%r10
+2:
+ li %r3,0
+ stw %r10,0(%r6)
+ blr
diff -r 20c9e73ef05f -r 2a2916fca04b sys/arch/powerpc/powerpc/trap.c
--- a/sys/arch/powerpc/powerpc/trap.c Wed Jul 07 01:19:09 2010 +0000
+++ b/sys/arch/powerpc/powerpc/trap.c Wed Jul 07 01:19:54 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.135 2010/04/23 19:18:10 rmind Exp $ */
+/* $NetBSD: trap.c,v 1.136 2010/07/07 01:19:54 chs Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.135 2010/04/23 19:18:10 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.136 2010/07/07 01:19:54 chs Exp $");
#include "opt_altivec.h"
#include "opt_ddb.h"
@@ -72,6 +72,9 @@
static inline vaddr_t setusr(vaddr_t, size_t *);
static inline void unsetusr(void);
+extern int do_ucas_32(volatile int32_t *, int32_t, int32_t, int32_t *);
+int ucas_32(volatile int32_t *, int32_t, int32_t, int32_t *);
+
void trap(struct trapframe *); /* Called from locore / trap_subr */
/* Why are these not defined in a header? */
int badaddr(void *, size_t);
@@ -623,6 +626,34 @@
}
int
+ucas_32(volatile int32_t *uptr, int32_t old, int32_t new, int32_t *ret)
+{
+ vaddr_t uva = (vaddr_t)uptr;
+ vaddr_t p;
+ struct faultbuf env;
+ size_t seglen;
+ int rv;
+
+ if (uva & 3) {
+ return EFAULT;
+ }
+ if ((rv = setfault(&env)) != 0) {
+ unsetusr();
+ goto out;
+ }
+ p = setusr(uva, &seglen);
+ KASSERT(seglen >= sizeof(*uptr));
+ do_ucas_32((void *)p, old, new, ret);
+ unsetusr();
+
+out:
+ curpcb->pcb_onfault = 0;
+ return rv;
+}
+__strong_alias(ucas_ptr,ucas_32);
+__strong_alias(ucas_int,ucas_32);
+
+int
badaddr(void *addr, size_t size)
{
return badaddr_read(addr, size, NULL);
Home |
Main Index |
Thread Index |
Old Index