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 The real cause for removing asm inl...
details: https://anonhg.NetBSD.org/src/rev/d213ecfa45eb
branches: trunk
changeset: 840457:d213ecfa45eb
user: nakayama <nakayama%NetBSD.org@localhost>
date: Sat Apr 06 21:40:15 2019 +0000
description:
The real cause for removing asm inline code on clang is that the
"r" constraint cannot handle 64-bit and is treated as 32-bit.
So code that refers to the upper 32-bit (manuf or impl) of the %ver
register is removed by optimization.
Use 32-bit kernel code as a workaround when referring to the %ver
register.
diffstat:
sys/arch/sparc64/include/psl.h | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diffs (50 lines):
diff -r 969caa22fb2b -r d213ecfa45eb sys/arch/sparc64/include/psl.h
--- a/sys/arch/sparc64/include/psl.h Sat Apr 06 20:25:26 2019 +0000
+++ b/sys/arch/sparc64/include/psl.h Sat Apr 06 21:40:15 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psl.h,v 1.59 2019/04/05 12:15:41 nakayama Exp $ */
+/* $NetBSD: psl.h,v 1.60 2019/04/06 21:40:15 nakayama Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -292,9 +292,8 @@
* Put "memory" to asm inline on sun4v to avoid issuing rdpr %ver
* before checking cputyp as a result of code moving by compiler
* optimization.
- * For clang, to prevent it from being removed by optimization.
*/
-#if defined(SUN4V) || defined(__clang__)
+#ifdef SUN4V
#define constasm_clobbers "memory"
#else
#define constasm_clobbers
@@ -323,11 +322,13 @@
__asm volatile(#wr " %0,0,%" #reg : : "r" (_val) : "memory"); \
}
-#ifdef __arch64__
+/*
+ * XXX: clang's "r" constraint cannot handle 64-bit,
+ * so use 32-bit kernel code as a workaround.
+ */
+#if defined(__arch64__) && !defined(__clang__)
#define SPARC64_RDCONST64_DEF(rd, name, reg) \
SPARC64_RDCONST_DEF(rd, name, reg, uint64_t)
-#define SPARC64_RD64_DEF(rd, name, reg) SPARC64_RD_DEF(rd, name, reg, uint64_t)
-#define SPARC64_WR64_DEF(wr, name, reg) SPARC64_WR_DEF(wr, name, reg, uint64_t)
#else
#define SPARC64_RDCONST64_DEF(rd, name, reg) \
static __inline __constfunc uint64_t get##name(void) \
@@ -337,6 +338,12 @@
: "=r" (_hi), "=r" (_lo) : : constasm_clobbers); \
return ((uint64_t)_hi << 32) | _lo; \
}
+#endif
+
+#ifdef __arch64__
+#define SPARC64_RD64_DEF(rd, name, reg) SPARC64_RD_DEF(rd, name, reg, uint64_t)
+#define SPARC64_WR64_DEF(wr, name, reg) SPARC64_WR_DEF(wr, name, reg, uint64_t)
+#else
#define SPARC64_RD64_DEF(rd, name, reg) \
static __inline uint64_t get##name(void) \
{ \
Home |
Main Index |
Thread Index |
Old Index