Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/include Put "memory" to asm inline for read...
details: https://anonhg.NetBSD.org/src/rev/76e00b7d605b
branches: trunk
changeset: 335096:76e00b7d605b
user: nakayama <nakayama%NetBSD.org@localhost>
date: Thu Dec 25 14:02:03 2014 +0000
description:
Put "memory" to asm inline for reading privilege registers on sun4v
to avoid issuing rdpr %ver before checking cputyp as a result of
code moving by compiler optimization.
diffstat:
sys/arch/sparc64/include/psl.h | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diffs (49 lines):
diff -r f0abbe87c455 -r 76e00b7d605b sys/arch/sparc64/include/psl.h
--- a/sys/arch/sparc64/include/psl.h Thu Dec 25 13:39:41 2014 +0000
+++ b/sys/arch/sparc64/include/psl.h Thu Dec 25 14:02:03 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psl.h,v 1.55 2014/12/05 11:34:00 nakayama Exp $ */
+/* $NetBSD: psl.h,v 1.56 2014/12/25 14:02:03 nakayama Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -284,6 +284,21 @@
#if defined(_KERNEL) && !defined(_LOCORE)
+#if defined(_KERNEL_OPT)
+#include "opt_sparc_arch.h"
+#endif
+
+/*
+ * Put "memory" to asm inline on sun4v to avoid issuing rdpr %ver
+ * before checking cputyp as a result of code moving by compiler
+ * optimization.
+ */
+#ifdef SUN4V
+#define constasm_clobbers "memory"
+#else
+#define constasm_clobbers
+#endif
+
/*
* Inlines for manipulating privileged and ancillary state registers
*/
@@ -291,7 +306,7 @@
static __inline __constfunc type get##name(void) \
{ \
type _val; \
- __asm(#rd " %" #reg ",%0" : "=r" (_val)); \
+ __asm(#rd " %" #reg ",%0" : "=r" (_val) : : constasm_clobbers); \
return _val; \
}
#define SPARC64_RD_DEF(rd, name, reg, type) \
@@ -318,7 +333,7 @@
{ \
uint32_t _hi, _lo; \
__asm(#rd " %" #reg ",%0; srl %0,0,%1; srlx %0,32,%0" \
- : "=r" (_hi), "=r" (_lo)); \
+ : "=r" (_hi), "=r" (_lo) : : constasm_clobbers); \
return ((uint64_t)_hi << 32) | _lo; \
}
#define SPARC64_RD64_DEF(rd, name, reg) \
Home |
Main Index |
Thread Index |
Old Index