mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-19 00:13:33 +00:00
security/masscan: fix build on powerpc*
Implement rdtsc, similar to ARM. Builds fine with clang.
This commit is contained in:
parent
127ab8c824
commit
ff9319692d
@ -17,12 +17,6 @@ CFLAGS+= -Wno-format
|
||||
|
||||
PLIST_FILES= bin/masscan man/man8/masscan.8.gz
|
||||
|
||||
.include <bsd.port.options.mk>
|
||||
|
||||
.if ${ARCH} == powerpc64 || ${ARCH} == powerpc
|
||||
USE_GCC= yes
|
||||
.endif
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/bin/masscan ${STAGEDIR}${PREFIX}/bin
|
||||
${INSTALL_MAN} ${WRKSRC}/doc/masscan.8 ${STAGEDIR}${MANPREFIX}/man/man8
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- src/smack1.c.orig 2021-01-31 09:13:30 UTC
|
||||
+++ src/smack1.c
|
||||
@@ -119,8 +119,7 @@
|
||||
@@ -119,9 +119,8 @@
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <sys/types.h>
|
||||
#include <machine/cpufunc.h>
|
||||
@ -10,12 +10,35 @@
|
||||
unsigned long long rdtsc(void)
|
||||
{
|
||||
uint32_t pmccntr;
|
||||
@@ -138,6 +137,10 @@ unsigned long long rdtsc(void)
|
||||
uint32_t pmuseren;
|
||||
@@ -138,6 +137,32 @@ unsigned long long rdtsc(void)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
+#elif defined(__aarch64__)
|
||||
+#define __rdtsc() 0
|
||||
+#elif defined(__powerpc64__)
|
||||
+unsigned long long __rdtsc(void)
|
||||
+{
|
||||
+ unsigned long long rval;
|
||||
+ __asm__ __volatile__("mfspr %%r3, 268": "=r" (rval));
|
||||
+ return rval;
|
||||
+}
|
||||
+#elif defined(__powerpc__)
|
||||
+unsigned long long __rdtsc(void)
|
||||
+{
|
||||
+ unsigned int tmp;
|
||||
+ union { unsigned long long complete; unsigned int part[2]; } ticks;
|
||||
+ __asm__ ("0:"
|
||||
+ "mftbu %[hi32]\n"
|
||||
+ "mftb %[lo32]\n"
|
||||
+ "mftbu %[tmp]\n"
|
||||
+ "cmpw %[tmp],%[hi32]\n"
|
||||
+ "bne 0b\n"
|
||||
+ : [hi32] "=r"(ticks.part[0]), [lo32] "=r"(ticks.part[1]),
|
||||
+ [tmp] "=r"(tmp));
|
||||
+ return ticks.complete;
|
||||
+}
|
||||
+#else
|
||||
+#define __rdtsc rdtsc
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user