Module Name: src Committed By: matt Date: Mon Feb 13 17:07:45 UTC 2012
Modified Files: src/sys/arch/arm/include: mcontext.h Log Message: 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). To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/include/mcontext.h 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/arm/include/mcontext.h diff -u src/sys/arch/arm/include/mcontext.h:1.9 src/sys/arch/arm/include/mcontext.h:1.10 --- src/sys/arch/arm/include/mcontext.h:1.9 Thu Apr 7 10:20:29 2011 +++ src/sys/arch/arm/include/mcontext.h Mon Feb 13 17:07:45 2012 @@ -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 @@ typedef struct { 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_ */