aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2007-01-23 13:34:13 +0800
committerrodrigc <rodrigc@FreeBSD.org>2007-01-23 13:34:13 +0800
commit25fdc8405e29ace2ba1008dcd8cf3af3e1e457b9 (patch)
tree990b67bd8d897e11017ff02759467dc931bf4cbf /sysutils
parent27e09755f3c62c604d785384b359ac0d64531a9f (diff)
downloadfreebsd-ports-graphics-25fdc8405e29ace2ba1008dcd8cf3af3e1e457b9.tar.gz
freebsd-ports-graphics-25fdc8405e29ace2ba1008dcd8cf3af3e1e457b9.tar.zst
freebsd-ports-graphics-25fdc8405e29ace2ba1008dcd8cf3af3e1e457b9.zip
- FreeBSD patches to include <machine/cpufunc.h> to get rdtsc() function,
instead of using local one in hourglass.h. - Other minor amd64 compilation fixes.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/hourglass/files/patch-hourglass.h49
-rw-r--r--sysutils/hourglass/files/patch-main.c20
-rw-r--r--sysutils/hourglass/files/patch-work.c20
3 files changed, 89 insertions, 0 deletions
diff --git a/sysutils/hourglass/files/patch-hourglass.h b/sysutils/hourglass/files/patch-hourglass.h
new file mode 100644
index 00000000000..8bbbc3c7f44
--- /dev/null
+++ b/sysutils/hourglass/files/patch-hourglass.h
@@ -0,0 +1,49 @@
+--- src/hourglass.h.orig Wed Oct 8 20:26:08 2003
++++ src/hourglass.h Tue Jan 23 05:28:40 2007
+@@ -38,6 +38,11 @@
+ #include <pthread.h>
+ #include <assert.h>
+
++#ifdef __FreeBSD__
++#include <machine/cpufunc.h>
++#include <machine/atomic.h>
++#endif
++
+ #include "config.h"
+
+ #define DBGPrint(lev,str) do { \
+@@ -197,6 +202,8 @@
+ cycle_time start, end;
+ };
+
++#ifndef __FreeBSD__
++
+ #ifdef CPU_586
+ /*
+ * a bit of documentation since the rdrsc function seems to often be
+@@ -228,7 +235,7 @@
+
+ static inline int my_InterlockedIncrement (long *dest)
+ {
+- return my_InterlockedExchangeAdd (dest, 1) + 1;
++ return my_InterlockedExchangeAdd (dest, 1L) + 1;
+ }
+
+ #endif /* defined CPU_586 */
+@@ -275,6 +282,16 @@
+ }
+
+ #endif /* defined CPU_PPC */
++
++#else
++
++static inline long my_InterlockedIncrement (long *dest)
++{
++ atomic_add_long(dest, 1L);
++ return *dest;
++}
++
++#endif /* !__FreeBSD__ */
+
+ static inline sec_time cycle_to_sec (cycle_time c)
+ {
diff --git a/sysutils/hourglass/files/patch-main.c b/sysutils/hourglass/files/patch-main.c
new file mode 100644
index 00000000000..871ab43dc52
--- /dev/null
+++ b/sysutils/hourglass/files/patch-main.c
@@ -0,0 +1,20 @@
+--- src/main.c.orig Tue Jan 23 04:45:05 2007
++++ src/main.c Tue Jan 23 04:46:29 2007
+@@ -168,7 +168,7 @@
+ retval = pthread_create (&thrd_data[i].thrd,
+ NULL,
+ thrd_func,
+- (void *)i);
++ (void *)(intptr_t)i);
+ if (retval != 0) {
+ printf ("Hrm: error creating thread %d\n", i);
+ exit (-1);
+@@ -178,7 +178,7 @@
+ retval = pthread_create (&thrd_data[i].monitor_thrd,
+ NULL,
+ monitor_thrd_func,
+- (void *)i);
++ (void *)(intptr_t)i);
+ if (retval != 0) {
+ printf ("Hrm: error creating monitor thread %d\n", i);
+ exit (-1);
diff --git a/sysutils/hourglass/files/patch-work.c b/sysutils/hourglass/files/patch-work.c
new file mode 100644
index 00000000000..3eebe290b37
--- /dev/null
+++ b/sysutils/hourglass/files/patch-work.c
@@ -0,0 +1,20 @@
+--- src/work.c.orig Tue Jan 23 04:28:43 2007
++++ src/work.c Tue Jan 23 05:09:28 2007
+@@ -176,7 +176,7 @@
+
+ void *monitor_thrd_func (void *arg)
+ {
+- int id = (int)arg;
++ int id = (int)(intptr_t)arg;
+
+ assert (thrd_data[id].s_time != -1);
+
+@@ -202,7 +202,7 @@
+
+ void *thrd_func (void *arg)
+ {
+- int id = (int)arg;
++ int id = (int)(intptr_t )arg;
+
+ set_priority (thrd_data[id].pri);
+