Skip to contentSkip to conversation

sparc: Fix syscall fallback bugs in VDSO.

PATCH New David Miller 1 participant 1 message Oct 18, 2018 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 1/1 sparc: Fix syscall fallback bugs in VDSO.

First, the trap number for 32-bit syscalls is 0x10.

Also, only negate the return value when syscall error is indicated by the carry bit being set.

---
 arch/sparc/vdso/vclock_gettime.c | 12 +++++++++++-
 tools/perf/util/event.c          |  5 +++++
 2 files changed, 16 insertions(+), 1 deletion(-)
arch/sparc/vdso/vclock_gettime.c +11 -1
index 3feb3d960ca5..75dca9aab737 100644
@@ -33,9 +33,19 @@
 #define	TICK_PRIV_BIT	(1ULL << 63)
 #endif
 
+#ifdef	CONFIG_SPARC64
 #define SYSCALL_STRING							\
 	"ta	0x6d;"							\
-	"sub	%%g0, %%o0, %%o0;"					\
+	"bcs,a	1f;"							\
+	" sub	%%g0, %%o0, %%o0;"					\
+	"1:"
+#else
+#define SYSCALL_STRING							\
+	"ta	0x10;"							\
+	"bcs,a	1f;"							\
+	" sub	%%g0, %%o0, %%o0;"					\
+	"1:"
+#endif
 
 #define SYSCALL_CLOBBERS						\
 	"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",			\