This makes the tests pass on sparc64 where the hardware doesn't give
us the low bits of the faulting address.
ok?
Index: regress/sys/kern/siginfo-fault/siginfo-fault.c
===================================================================
RCS file: /cvs/src/regress/sys/kern/siginfo-fault/siginfo-fault.c,v
retrieving revision 1.5
diff -u -p -r1.5 siginfo-fault.c
--- regress/sys/kern/siginfo-fault/siginfo-fault.c 20 Jul 2017 18:22:25
-0000 1.5
+++ regress/sys/kern/siginfo-fault/siginfo-fault.c 22 Jul 2017 15:25:56
-0000
@@ -24,10 +24,20 @@
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+/*
+ * Some architectures deliver an imprecise fault address.
+ */
+#ifdef __sparc64__
+#define EXPADDR_MASK ~(3UL)
+#else
+#define EXPADDR_MASK ~(0UL)
+#endif
+
#define CHECK_EQ(a, b) assert((a) == (b))
#define CHECK_NE(a, b) assert((a) != (b))
#define CHECK_LE(a, b) assert((a) <= (b))
@@ -76,6 +86,9 @@ checksig(const char *name, int expsigno,
{
int fail = 0;
char str1[NL_TEXTMAX], str2[NL_TEXTMAX];
+
+ expaddr = (char *)((uintptr_t)expaddr & EXPADDR_MASK);
+
if (expsigno != gotsigno) {
strlcpy(str1, strsignal(expsigno), sizeof(str1));
strlcpy(str2, strsignal(gotsigno), sizeof(str2));