Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/include Modify __lwp_getprivate_fast to call _l...
details: https://anonhg.NetBSD.org/src/rev/22b4917b7e7d
branches: trunk
changeset: 773704:22b4917b7e7d
user: matt <matt%NetBSD.org@localhost>
date: Mon Feb 13 17:07:45 2012 +0000
description:
Modify __lwp_getprivate_fast to call _lwp_getprivate if the mrc instruction
returns 0 (some ARM cores are broken and don't raise an undefined exception
when encountering an unknown or privileged mrc instruction in user mode).
diffstat:
sys/arch/arm/include/mcontext.h | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (29 lines):
diff -r 9e5798a01e3c -r 22b4917b7e7d sys/arch/arm/include/mcontext.h
--- a/sys/arch/arm/include/mcontext.h Mon Feb 13 16:35:59 2012 +0000
+++ b/sys/arch/arm/include/mcontext.h Mon Feb 13 17:07:45 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mcontext.h,v 1.9 2011/04/07 10:20:29 matt Exp $ */
+/* $NetBSD: mcontext.h,v 1.10 2012/02/13 17:07:45 matt Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -112,9 +112,18 @@
static __inline void *
__lwp_getprivate_fast(void)
{
+ extern void *_lwp_getprivate(void);
void *rv;
__asm("mrc p15, 0, %0, c13, c0, 3" : "=r"(rv));
- return rv;
+ if (__predict_true(rv))
+ return rv;
+ /*
+ * Some ARM cores are broken and don't raise an undefined fault when an
+ * unrecogized mrc instruction is encountered, but just return zero.
+ * To do deal with that, if we get a zero we (re-)fetch the value using
+ * syscall.
+ */
+ return _lwp_getprivate();
}
#endif /* !_ARM_MCONTEXT_H_ */
Home |
Main Index |
Thread Index |
Old Index